Skip to content

consult impl-review subagent resolves relative 'Changed Files' paths against outer checkout, not worktree #1092

Description

@colleen110

Symptom

When consult runs an implementation review (--type impl / --type integration) against a builder operating in a git worktree (e.g. .builders/<branch>/...), the reviewing sub-agent reads the outer repo's files instead of the worktree's files. The review's verdicts describe main branch content, not the builder's actual committed changes — producing false REQUEST_CHANGES.

Codev version: @cluesmith/codev@2.1.5

Root cause (diagnosed by a builder running on studio-manager#484; full rebuttal: https://github.com/colleen110/studio-manager/blob/main/codev/projects/484-aspir-schedule-management-filt/484-phase_1-iter1-rebuttals.md)

buildImplQuery passes the reviewing model a "File List" of bare repo-relative paths (e.g. app/javascript/controllers/foo.js) plus "read the changed files from disk."

The sub-agent has no Bash access (allowedTools: ['Read', 'Glob', 'Grep']) and no explicit statement of its launching cwd, so it guesses the absolute base path to join with each entry. It guesses the outer checkout, not the worktree it was actually launched in — even though cwd is set correctly.

Reproduced by replaying the exact prompt through @anthropic-ai/claude-agent-sdk (claude-opus-4-6, same allowedTools/cwd/permissionMode) with tool-call logging:

TOOL_USE: Read {"file_path":"/Users/.../studio-manager/app/javascript/controllers/foo.js"}
TOOL_USE: Read {"file_path":"/Users/.../studio-manager/app/views/.../index.html.erb"}

— missing the .builders/<branch>/ segment.

When the sub-agent is handed an absolute worktree path directly (as happens for Spec/Plan paths included in the prompt), it reads correctly. So the bug is specifically in how the "Changed Files" relative-path list is presented.

Suggested fix

In buildImplQuery, expand each relative entry to an absolute path rooted at the worktree's cwd before handing the list to the sub-agent (or include the cwd explicitly in the prompt so the model can join correctly).

Impact

Every ASPIR/SPIR builder running in a worktree gets false REQUEST_CHANGES verdicts on any review that lists relative changed-file paths. Likely affects all current codev users using af spawn ... --protocol spir/aspir.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/consultArea: Consult CLI / consultation tooling

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions