treat missing git as inspect-failed instead of not-a-repo - #3141
treat missing git as inspect-failed instead of not-a-repo#3141thedhruvhegde wants to merge 1 commit into
Conversation
Greptile SummaryThis PR narrows workspace inspection’s fallback behavior so that missing Git and most other execution failures become
Confidence Score: 4/5This 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
|
| 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' }; |
There was a problem hiding this comment.
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.
summary
any git
ExecErrorwas treated as a plain directory. on nixos (and anywhere git is missing from PATH)gitexits 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