Repository navigation
fix(gateway): name the requested directory when it is not a git checkout - #178664
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThe PR names a caller-selected working directory when managed worktree creation rejects it as a non-Git directory. Example: Create a managed worktree with cwd=/tmp/unversioned-repo, an existing directory outside any Git checkout.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a misleading diagnostic still present on main, with no introduced correctness or security findings. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGateway session creation selects the requested or default workspace, validates its worktree source, and returns a structured RPC error when Git discovery fails. flowchart TD
A[Session caller] --> B[Sessions create RPC]
B --> C[Workspace selection]
C --> D[Git checkout discovery]
D --> E[Session request error formatter]
E --> F[Caller receives invalid request]
Technical reviewBest possible solution: Keep the existing worktree validation owner and return the selected directory in its rejection while preserving default-workspace wording. Do we have a high-confidence way to reproduce the issue? Current main demonstrably selects an explicit workspace and then emits the default-workspace error when Git discovery fails; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch is a focused fix using the existing error-text owner and regression case, with no new state, duplicate validation, or unrelated behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b7c858fcf245. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +9, Tests 0. Total +9 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 20, 2026, 3:02 PM ET / 19:02 UTC. |
|
Merged via squash auto-merge.
|
What Problem This Solves
When
sessions_spawnorsessions.createasked for a managed worktree (worktree: true) of a caller-suppliedcwdthat is not a git checkout (for example a mistyped or not-yet-created repo path), the request failed with:The
cwdwas correctly used as the worktree source, but the message blamed the agent workspace and named no path, so a parent couldn't tell its owncwdwas wrong. Live, a fleet parent whosecwdpointed at a missing repo got this for all 12 spawns and reported it as a workspace problem.User Impact
Callers can identify and correct the requested working directory from the error message. The default agent-workspace case keeps its existing wording. No migration or configuration change is required.
Why This Change Was Made
session-request-error.ts, which owns session-request error text, gainsnonGitWorktreeSourceMessage:requested working directory is not a git checkout: <path>.The call site in
session-worktree-preparation.tsstays the same size (that file is at its line cap).Evidence
server.sessions.create.workspace-policy.test.ts("uses a non-git Gateway cwd directly but not as a worktree source") now asserts the precise message. It is red on base (1 failed) and green with the fix; the file passes 17/17, andserver.sessions.create-worktree-spawn.test.tspasses 22/22 (default-workspace wording unchanged). oxlint/oxfmt are clean, and the line-cap ratchet passes.Landing check note: the direct oxlint rerun reports the existing
session-worktree-preparation.tsmax-lines warning (725 counted lines; cap 700). The base produces the identical warning, and this change does not grow that file. Formatting and diff whitespace checks pass.