Skip to content

feat(review): let /review:quality-gate review a phase diff in a separate worktree - #8348

Merged
kyle-sexton merged 13 commits into
mainfrom
refactor/8327-quality-gate-phase-boundary-inputs
Oct 19, 2026
Merged

kyle-sexton merged 13 commits into
mainfrom
refactor/8327-quality-gate-phase-boundary-inputs

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Closes #8327

Summary

/review:quality-gate could not review a plan phase from an orchestrator: it read only the session's own checkout, looked up the pull request on the forge, and could stop to ask questions. This PR adds four inputs (--worktree, --base, --quality-bar, --report-only) so an orchestrator can review one phase's diff in a worker's separate worktree, with no forge lookup, no remote read, no file writes and no questions. It is the first item of spec container #8326, and the phase-boundary dispatch in #8331 builds on it.

Fix

  • quality-gate/context/phase-boundary.md (new) holds one input table, saying which modes read each input and what it changes, plus per-mode notes. pr and close-out stop when given --base or --worktree. criteria and restatement hand their review to a fresh-context review:brief-reviewer instead of reviewing inline. Code mode uses its own code-reviewer path instead of the pull-request plugin path. Downstream skips its remote policy read.
  • The reviewer brief carries the change-set commands, the concern tag, the quality bar and each mode's own required inputs. It never carries the plan rationale or the implementer's account. When a worktree is supplied, every command and file read targets it.
  • Out-of-phase rule: the brief tells each reviewer to rate only findings the phase diff causes (a line it adds or changes, or something the change requires that it leaves out), even when the named file is outside the diff, as in downstream, restatement and spec. Problems the diff did not cause go in an unrated Outside this phase list that never affects the verdict.
  • review:security-reviewer, review:code-reviewer and review:architecture-guardian each gain one sentence in step 2: a change set supplied in the brief replaces their own gh/fetch/ls-remote block, and a supplied worktree is the target of every command. Without a supplied change set the block runs unchanged. The maintainer approved widening the item's scope to these agents on 2026-10-18.
  • New eval case qg-phase-boundary-worktree: security mode run against a separate worktree and base SHA, 8 deterministic graders. One changelog fragment for the review plugin.

Deliberately not done: the item asks that allowed-tools cover the worktree-targeted diff form. No git -C * rule was added, because a wildcard before the subcommand also auto-approves -c core.fsmonitor=<cmd>, which runs a program, in a skill that reviews untrusted diffs. As a result, git -C <path> calls go through normal permission handling. On 2026-10-18 the maintainer deferred how unattended dispatch gets that permission to #8331.

Behavior shift: briefs that already supply diff commands to the three agents (fanout-sweep.js:147,153, quality-gate self.md, per-slice.md) now take the supplied-change-set branch and skip the agents' own unresolved-base handling. fanout-sweep validates its base, and self.md has its own unresolved-base clause.

Verification

  • scripts/check-affected.sh --tests --base origin/main, run from the branch worktree: 8 passed, 1 skipped (ruff: no .py changed).
  • plugins/review/tests/change-set-block.test.sh: 11 cases passed. validate-cases.py plugins/review/evals: exit 0, no FAIL, every grader sorts its samples.
  • A fresh-context phase verifier checked the change against 11 binary criteria over five rounds; its final pass at a2c7aadfc reported all PASS and no regression for callers that pass no new flag.
  • Paid eval, approved by the maintainer: claude plugin eval plugins/review --case qg-phase-boundary-worktree --scaffold --allow-tools Bash,Write,Edit --trust-plugin --judge-model opus --threshold 0.8 --max-cost-usd 5 --no-publish.
    • Run 1 at 06183950b: with plugin 0.857 (all 3 runs failed stays-in-phase-diff: the reviewer rated pre-existing admin.js outside the phase diff), without 0.714, delta +0.143, cost $1.94.
    • Fix 1347a220d added the out-of-phase rule.
    • Run 2 at 1347a220d: with plugin 1.0 (3/3 runs pass every grader), without 0.619 (0/3 pass; failing cites-search-sqli, diffs-worktree-from-base, security-reviewer-dispatched), delta +0.381, cost $1.95. Traces show the reviewer's git -C .worktrees/phase-2 diff <sha> calls reach the graders and no forge or remote lookup ran.
  • Left out: package-registry audits in security-reviewer (npm audit and similar) still make network calls under --base.

Related

Acceptance criteria

  • /review:quality-gate documents worktree path, base SHA, quality bar and report-only inputs for every mode
  • allowed-tools covers the worktree-targeted diff form (deliberately not met, see Fix)
  • With a base SHA given, the skill runs no forge lookup
  • Eval case qg-phase-boundary-worktree passes under /evals:plugin-eval with and without the plugin, difference recorded (with 1.0, without 0.619, delta +0.381; see Verification)
  • check-changed-skills.sh origin/main and check-affected.sh --tests exit 0 with no SKIP line other than ruff for no Python changes
  • A changelog fragment for the review plugin

🤖 Generated with Claude Code

kyle-sexton and others added 10 commits October 18, 2026 20:22
Every quality-gate mode takes --worktree, --base, --quality-bar and
--report-only, so an orchestrator can review a phase diff in a worker's
worktree. With a base SHA no pull-request lookup or fetch runs. Adds the
qg-phase-boundary-worktree eval case.

Refs #8327

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The phase-boundary inputs are passed explicitly by an orchestrator, so the
description needs no new trigger phrase.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d grants

Restore the argument-hint to the mode set so it fits the 100-character
budget and matches the lead of the Arguments line; the phase-boundary
flags stay documented in the Arguments line and context/phase-boundary.md.

Remove the allowed-tools entries that put a wildcard before the git
subcommand (git -C * ...). A wildcard there also approves options such as
-c core.fsmonitor=<cmd>, which runs a program, in a skill that reviews
untrusted diffs. Worktree-targeted commands go through normal permission
handling.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Under --base or --worktree, code mode skips the pr-review-toolkit path
for its code-reviewer fallback, and downstream mode skips the remote
downstream_probe layer and treats the floor as report. Under
--report-only the size-crossing loop reads git diff -z instead of a
written path file. Name the modes --quality-bar applies to, pass spec
text to the spec reviewer, and fail the eval grader only on a finding
in admin.js, not on a note that it predates the base.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Name pr and close-out in the --quality-bar row; brief reviewers with
  each mode's own required inputs; restatement dispatches under --base.
- Under --report-only the standards ladder takes its non-interactive rung.
- code skips size crossings under --worktree; define the report-only base.
- Step 0 skips the PR-exists signal with --base; drop restated upstream.
- Eval: fail on any Write, add a no-Edit grader.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
code-reviewer, security-reviewer and architecture-guardian run only the
change-set commands their brief supplies (worktree path and base SHA),
with no gh lookup, fetch or ls-remote; without one, step 2 is unchanged.
phase-boundary.md says the brief replaces that step. criteria mode under
--base or --worktree dispatches a fresh-context review:brief-reviewer
instead of reviewing inline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Restatement mode now dispatches its batch reviewer under --worktree as
well as --base, so a worktree-only run no longer reviews inline from the
invoking checkout.

The phase-boundary reviewer brief names the worktree's absolute path as
the file-read root, and code-reviewer, security-reviewer and
architecture-guardian resolve every Read, Grep, Glob and listed
untracked path under a supplied worktree. The advisory line no longer
reads as if per-slice passes the plan's rationale.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replace the per-command worktree anchoring with one rule: when the brief
supplies a worktree, every command and tool call in the review targets it
(git via git -C, Read/Grep/Glob, untracked paths, and any other command
such as a dependency audit), never the invoking checkout. Stated
identically in code-reviewer, security-reviewer and architecture-guardian,
and in the quality-gate phase-boundary brief for every dispatched
reviewer, review:brief-reviewer included. The downstream probe's
repository root is the worktree path under --worktree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 19, 2026 01:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T01:45:40.551280Z a3c0d8e Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 721e4c4d4ac44b367c2af0a3d987c35295a1edb3: 0 finding(s), 0 as inline comments.

No security findings in the incremental change since 1347a220.

Scope: .changes/review/refactor-8327-quality-gate-phase-boundary-inputs-6b1e94d2.md and plugins/review/skills/quality-gate/context/phase-boundary.md.

Instruction-surface check: The diff edits a standing instruction, so I read it under the instruction-surface lens instead of skipping it as prose-only. It replaces "Rate findings only on lines the phase diff adds or changes" with "Rate a finding only when the phase diff causes it". The new rule covers added or changed lines, things the diff leaves out that the change requires, and files outside the diff, such as a caller the change breaks. Problems the diff did not cause stay in the unrated Outside this phase list.

  • It widens what gets rated and removes or softens no control.
  • The reviewer-isolation guard is unchanged: no plan rationale, conversation or implementer account reaches the reviewer.
  • The Outside this phase list still has no severity and no effect on the verdict.
  • The change adds no command execution, token handling, path handling or injection surface, and no new untrusted-input path.
  • The changelog fragment only restates the new rule.

I did not read docs/conventions/instruction-exception-register/README.md. The diff removes no enforcement, so the protected-class list could not change the outcome.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a3c0d8e577

ℹ️ 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".

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 721e4c4d4ac44b367c2af0a3d987c35295a1edb3: 0 finding(s), 0 as inline comments.

Incremental review of 1347a220..721e4c4d: 0 findings. I checked two files, plugins/review/skills/quality-gate/context/phase-boundary.md and the changelog fragment .changes/review/refactor-8327-quality-gate-phase-boundary-inputs-6b1e94d2.md.

  • Rule rewrite: the verbatim reviewer rule now rates a finding only when the phase diff causes it: a line the diff adds or changes, or something it leaves out that the change requires. The named file may be outside the diff. This resolves the earlier contradiction in which downstream, restatement and spec could not rate breakage in untouched files. Pre-existing debt, such as admin.js in the eval fixture, still lands in the unrated Outside this phase list, so the qg-phase-boundary-worktree case's expected outcome still holds.
  • Consistency: the changelog fragment matches the new rule text. The old wording ("only on lines the phase diff adds or changes") is gone from the rest of plugins/review and docs, so no other file restates the old rule.
  • Not re-run: I read the eval case and its samples but did not re-run the paid eval. I did not independently confirm the PR body's reported run-2 scores (with plugin 1.0, without 0.619), which are author-claimed. Those scores came from the commit before this one. This commit only rewords the rule, so I did not treat the unchanged scores as a defect.

kyle-sexton and others added 2 commits October 18, 2026 22:06
…alternation

typos read the [Ss]earch character class as the misspelling "earch" and
failed lint-repo. (?:search|Search) matches the same strings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reviewer's brief under --base or --worktree now carries a verbatim
rule: findings are rated only on lines the phase diff adds or changes,
and anything noticed outside it goes in an unrated `Outside this phase`
list with no verdict effect, so pre-existing debt never blocks a phase.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
downstream, restatement and spec name files outside the diff by design;
the out-of-phase rule now keys on cause, not on the file a finding names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 19, 2026
Merged via the queue into main with commit 95338d5 Oct 19, 2026
25 checks passed
@kyle-sexton
kyle-sexton deleted the refactor/8327-quality-gate-phase-boundary-inputs branch October 19, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(review): let /review:quality-gate take phase-boundary inputs (worktree, base SHA, quality bar, report-only)

1 participant