fix(atlas): use worktree path for git verification when available (fixes #2229)#2669
Conversation
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4723319eef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const worktreePath = boulderState?.worktree_path?.trim() | ||
| const verificationDirectory = worktreePath ? worktreePath : ctx.directory | ||
| const gitStats = collectGitDiffStats(verificationDirectory) |
There was a problem hiding this comment.
Fix Atlas's actual verification path, not just the summary
When worktree_path is set, this only switches the pre-rendered fileChanges block over to the worktree. The verifier Atlas is told to run immediately afterwards still says git diff --stat in Phase 1 (src/hooks/atlas/system-reminder-templates.ts:54), and Atlas continuations are still sent with query.directory: ctx.directory (src/hooks/atlas/boulder-continuation-injector.ts:62). In worktree-based sessions that means the summary here can look correct, but the real verification step still inspects the main checkout and reports no changes, so the false "fabricated results" flow from #2229 can still happen.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Safe logic change that correctly resolves the verification directory using worktree_path with a proper fallback to ctx.directory, fixing a reported bug with no regressions.
Summary
Problem
When subagents work in git worktrees, Atlas verifies their work using
ctx.directory(main repo). Since changes exist only in the worktree directory, Atlas incorrectly reports fabricated results. This affects worktree-based Atlas verification flows.Fix
Read boulder state first and resolve a verification directory: use
boulderState.worktree_pathwhen it is non-empty, otherwise fall back toctx.directory. Use that resolved directory forcollectGitDiffStats.Changes
src/hooks/atlas/tool-execute-after.tsFixes #2229
Summary by cubic
Atlas now verifies subagent work against the active git worktree path, preventing false fabrication reports when changes live in a worktree. Falls back to the repo path when no worktree is set. Fixes #2229.
worktree_pathwhen present; otherwise usectx.directory.collectGitDiffStatsinsrc/hooks/atlas/tool-execute-after.ts.Written for commit 4723319. Summary will update on new commits.