Repository navigation
Description
Problem
review:quality-gate self prefers this plugin's code-reviewer agent as its worker (plugins/review/skills/quality-gate/context/self.md:10). In a reported run, the dispatched review:code-reviewer (model opus, a gate brief with value traces, a reverse-dependency sweep and completeness tags; 11 modified plus 6 untracked files across two modules) hit its maxTurns: 30 limit after 38 tool uses with no hand-back and no report. The caller learned this only from the task notification. A SendMessage resume capped at 8 more tool calls produced a good report, which said it never read the project's REVIEW.md or its cited criteria docs because it ran out of turns first.
So a cap stop leaves the gate with no result, and a resumed or partial result can silently omit the project-criteria half of the review.
Evidence
Verified on origin/main 4ed0fcf5a (review 0.34.3):
plugins/review/agents/code-reviewer.mdfrontmatter:tools: "Read, Grep, Glob, Bash",maxTurns: 30, preloadstesting:test-value.- "Before reviewing" step 1 already says "Read the project's own review criteria first" (REVIEW.md, cited criteria, unscoped rules). So the order is specified; the agent did not follow it under pressure. The gap is enforcement under the cap, not the documented order.
- "Turn budget" section (added by docs(review): code-reviewer when not to delegate + turn-budget coverage (#4268) #4621) says to review highest-risk files first and, "if you run short", end with a
Coverage:line. It names no turn at which to stop gathering, reserves no turns for the report, and does not require an early partial report. A run that never reaches the report never emits theCoverage:line. self.mdorchestrator sequence (lines 8-15) says to verify each finding and write the findings artifact, but does not tell the orchestrator to treat a missing report, a missingCoverage:line, or a "criteria not read" admission as a partial gate.- The discovery plugin solved the same failure shape in fix(discovery): agents write early, reserve their last turns, and mark the primary source #4501 (agents write a disk skeleton with a
Run status:marker early and reserve final turns). That remedy does not transfer directly:code-reviewerhas noWritetool, so the reserve must be in turns and in text. - Sibling agents at the same cap with the same exposure:
architecture-guardian,security-reviewer,doc-drift-detector,ecosystem-specialist(maxTurns: 30),ci-log-auditor(25). Related, not in scope. - Issue search (
review code-reviewer turn,maxTurns reserve hand back agents) finds no open issue.
Reported, not reproduced here (evidence is in a work-domain session not reachable from this domain): the 38-tool-use stop, the resume, and the report's own words "did not read root REVIEW.md or its cited criteria docs; I ran out of turns first."
Proposed approach
- In
agents/code-reviewer.md"Turn budget": state the cap (30), a stop-gathering turn (for example turn 22), and that the remaining turns are for writing the report. Require criteria reading (step 1) to complete, or be explicitly recorded as skipped, before the first diff read. Require the report to open with aCriteria read:line (which of REVIEW.md, cited docs, unscoped rules were read) and to end with theCoverage:line on every run, not only a short one. - In
quality-gate/context/self.mdstep 4, add: a worker return with no report, noCoverage:line, orCriteria read:naming anything unread is a partial gate; the orchestrator resumes the worker once for the report, or runs the criteria lens itself, and the verdict says the gate is partial. - Optionally let the dispatcher pass a
Turn budget:line lower than the default, mirroring the discovery envelope.
Alternatives: raising maxTurns for gate use (rejected as the primary fix: a larger cap still ends silently; can be combined); splitting criteria and diff into two workers (heavier; self.md already offers two lenses for large diffs).
Files: plugins/review/agents/code-reviewer.md, plugins/review/skills/quality-gate/context/self.md, review evals, review plugin.json + CHANGELOG.md.
Acceptance criteria
-
code-reviewer.mdnames a stop-gathering turn belowmaxTurnsand reserves the rest for the report. - Every code-reviewer report carries
Criteria read:andCoverage:lines; an eval asserts both on a large change set. -
self.mdtells the orchestrator how to detect and label a partial gate (no report, missingCoverage:, criteria unread). - review version bumped with a CHANGELOG entry.
Constraints and gotchas
- The agent is read-only by tools (no Write/Edit); do not add Write to get a disk marker.
self.md's template (lines 22-34) also tells the worker to read criteria first; keep the two in agreement.- The performance plugin's verifier dispatch has the same exposure (see feat(performance): support browser-load and telemetry-counter subjects #5638); keep the remedy shape consistent.
Context
Source: local handoff item 20260929-203530-review-code-reviewer-turn-cap-no-handback.md (retired into this issue). Related: #4501 (discovery write-early / reserve turns), #4621 (code-reviewer turn-budget coverage line).
Activity
fix(review): detect and label a partial self-review gate
fix(review): treat a missing criteria marker as a partial gate
fix(review): treat a reported coverage gap as a partial gate
fix(review): align evals with re-dispatch, cover named coverage gaps,…
fix(review): enumerate every criteria source and qualify the exact-ou…
fix(review): name every criteria source in the self-mode worker prompt
fix(review): tie the criteria marker to the criteria-reading step
fix(review): include convention docs in the criteria marker
fix(review): compare the criteria marker with the resolved sources
fix(review): order the unresolved-base warning after the criteria mar…
fix(review): redispatch a fresh worker for a partial criteria lens
fix(review): reserve code-reviewer report turns and label partial gat…
fix(performance): reserve the verify verifier's final turns for its r…