Skip to content

source-control: the review-discipline finding-extractor subagent prompt has the same worktree-cwd gap #704 fixed one level up #1300

Description

@kyle-sexton

This was generated by AI on operator direction.

Lane: work (issue-execution loop) · Category: operational (correctness/safety gap)

Observation

Surfaced by review on #1299 (which closes #704). #704 anchored babysit-prs's Worker Contract and Worker Prompt Template so a dispatched worker never relies on cwd persisting across tool calls. That protects the worker itself — but not the subagent the worker is required to dispatch.

plugins/source-control/reference/review-discipline.md mandates a finding-extractor subagent whenever a single PR comment carries 3+ findings ("MANDATORY subagent dispatch for multi-finding comments"). Its verbatim dispatch prompt substitutes only <PR>, <COMMENT_ID>/<REVIEW_ID>, and <BRANCH>, and its ALLOWED scope reads:

- `Read` / `Grep` / `Glob` against the repo working tree
- `Bash` for git inspection (`git show`, `git log`, `git diff`) — NEVER state-mutating

No worktree path, no anchoring rule. So the extractor can read and grep the session's default checkout, return per-finding evidence from the wrong branch, and have that ledger consumed as the parent worker's D1–D4 result — precisely the failure #566/#702/#704 exist to prevent, one dispatch level down.

Why it was deferred rather than folded into #1299

review-discipline.md is the plugin-scope shared seam, consumed by both /source-control:babysit-prs and /source-control:pull-request's monitor phase. #704's brief is scoped to babysit-prs's Worker Contract; changing the shared seam widens blast radius into a second lane whose usage needs its own review. The gap also predates #1299 rather than being introduced by it.

Suggested direction (not yet evaluated)

Add a <WORKTREE> substitution slot to the extractor dispatch prompt carrying the absolute worktree path, and state the same anchoring rule the #704 contract now uses — absolute worktree-prefixed paths for Read/Grep/Glob, git -C <worktree> for the git-inspection commands. Verify the pull-request monitor lane, which does its own gh pr checkout rather than using a dedicated worktree, is either covered by the same wording or explicitly exempted.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.priority: mediumReal value, no hard deadline; normal backlog flow.work-class: structuralRefactors, migrations, contract changes; cross-cutting and hard to reverse.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions