Skip to content

treat missing git as inspect-failed instead of not-a-repo - #3141

Open
thedhruvhegde wants to merge 1 commit into
generalaction:mainfrom
thedhruvhegde:fix/git-inspect-missing-binary
Open

treat missing git as inspect-failed instead of not-a-repo#3141
thedhruvhegde wants to merge 1 commit into
generalaction:mainfrom
thedhruvhegde:fix/git-inspect-missing-binary

Conversation

@thedhruvhegde

@thedhruvhegde thedhruvhegde commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

summary

any git ExecError was treated as a plain directory. on nixos (and anywhere git is missing from PATH) git exits 127, so a real repo looked like a non-repo.

only exit 128 is "not a git repo". other exec failures stay inspect-failed.

closes #2990

test plan

  • PATH without git: opening a git workspace should fail inspect instead of looking like a folder
  • a real non-repo directory still inspects as a directory (exit 128)
  • normal git workspaces still work

@greptile-apps

greptile-apps Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR narrows workspace inspection’s fallback behavior so that missing Git and most other execution failures become inspect-failed rather than being treated as plain directories.

  • Changes the directory fallback from every non-null Git exit code to exit code 128.
  • Correctly fixes the missing-executable case, whose ExecError has a null exit code.
  • Still treats unrelated Git fatal errors returning 128 as non-repositories.

Confidence Score: 4/5

This PR should not merge until exit-128 Git failures are distinguished from the specific non-repository condition.

Missing Git is now handled correctly, but other fatal Git failures that also return 128 remain silently classified as valid plain directories.

Files Needing Attention: packages/core/src/runtimes/workspace-registry/node/inspect-path.ts

Important Files Changed

Filename Overview
packages/core/src/runtimes/workspace-registry/node/inspect-path.ts Narrows Git error classification, but exit code 128 alone does not uniquely identify a non-repository directory.
Prompt To Fix All With AI
### Issue 1
packages/core/src/runtimes/workspace-registry/node/inspect-path.ts:49
**Exit 128 Is Ambiguous**

Git also returns exit code 128 for fatal errors such as permission failures. In those cases, this branch classifies an inaccessible or broken repository as a plain directory instead of `inspect-failed`, so the workspace registry can accept it without surfacing the inspection error. The existing Git runtime avoids this by matching known non-repository messages rather than relying only on the exit code.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "only treat git exit 128 as not-a-repo so..." | Re-trigger Greptile

} catch (error) {
// Exit 128 = not inside a git work tree: a plain directory, not a failure.
if (error instanceof ExecError && error.exitCode !== null) return { kind: 'directory' };
if (error instanceof ExecError && error.exitCode === 128) return { kind: 'directory' };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Exit 128 Is Ambiguous

Git also returns exit code 128 for fatal errors such as permission failures. In those cases, this branch classifies an inaccessible or broken repository as a plain directory instead of inspect-failed, so the workspace registry can accept it without surfacing the inspection error. The existing Git runtime avoids this by matching known non-repository messages rather than relying only on the exit code.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/core/src/runtimes/workspace-registry/node/inspect-path.ts
Line: 49

Comment:
**Exit 128 Is Ambiguous**

Git also returns exit code 128 for fatal errors such as permission failures. In those cases, this branch classifies an inaccessible or broken repository as a plain directory instead of `inspect-failed`, so the workspace registry can accept it without surfacing the inspection error. The existing Git runtime avoids this by matching known non-repository messages rather than relying only on the exit code.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: git repo not detected in NixOS VM ssh target

1 participant