LearnNewsExamplesServices
Frontmatter
id11885
titleMake PR review circuit breaker enforce micro-delta reviews
stateClosed
labels
bugdocumentationaimodel-experience
assignees[]
createdAtMay 24, 2026, 11:29 AM
updatedAtMay 24, 2026, 11:36 AM
githubUrlhttps://github.com/neomjs/neo/issues/11885
authorneo-gpt
commentsCount3
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMay 24, 2026, 11:36 AM

Make PR review circuit breaker enforce micro-delta reviews

Closed v13.0.0/archive-v13-0-0-chunk-13 bugdocumentationaimodel-experience
neo-gpt
neo-gpt commented on May 24, 2026, 11:29 AM

Context

Operator correction on 2026-05-24 during PR #11876 review flow: repeated full PR-review bodies in late-cycle review threads are creating context-drain minefields. A future model reading a 20+ page PR conversation risks context pruning before it can reason over the actual delta.

This is a friction → gold ticket. The current substrate already recognizes review-loop cost, but it does not reliably prevent agents from preparing or posting another full follow-up review once the conversation is already over the danger threshold.

Origin Session ID: 967e325b-d90a-43f4-9e91-c212e9bda746 Retrieval Hint: "PR #11876 review-cost circuit breaker full follow-up review context drain micro-delta operator STOP"

The Problem

V-B-A evidence from PR #11876:

node ai/scripts/diagnostics/review-cost-meter.mjs 11876
=== Review-Loop Cost Meter for PR #11876 ===
Title Bytes:      114
Body Bytes:       9990
Comments Bytes:   4032 (2 comments)
Reviews Bytes:    20124 (3 reviews)
Total Discussion: 34260 bytes
Formal Reviews:   3
[WARNING] Circuit Breaker Thresholds Exceeded!

The existing circuit breaker payload says it fires when either formal reviews are >= 3 or discussion bytes exceed 24,000. PR #11876 satisfies both conditions. Despite that, the active reviewer path still naturally drifted toward loading and drafting another full follow-up review because:

  • .agents/skills/pr-review/SKILL.md still routes Cycle N to pr-review-followup-template.md as the normal shape.
  • .agents/skills/pr-review/audits/review-cost-circuit-breaker.md marks contract-blocker as ineligible for micro-delta, which pushes late-cycle contract-drift fixes back into full-template reviews even when the blocker is atomic and already understood.
  • manage_pr_review / PullRequestService validation requires template anchors; the current micro-delta template is not obviously accepted as a first-class formal review body.
  • The circuit breaker payload documents the wrong meter path: node ai/scripts/review-cost-meter.mjs <prNumber> fails because the actual script is ai/scripts/diagnostics/review-cost-meter.mjs.

Duplicate sweep:

  • ask_knowledge_base(... type='ticket') failed with Internal error: Error finding id, so exact repo sweep was used.
  • Existing #11440 / review-cost discussion and review-cost-circuit-breaker.md are predecessors, not duplicates: they created the primitive, but current evidence shows the primitive is not strong enough at execution time.
  • Existing #11546 / collapsed-N/A conciseness reduced template bulk, but does not prevent full late-cycle reviews from accumulating in the PR conversation.
  • Existing #11465/#11467 CI fail-fast reduces premature review churn, but does not address late-cycle context-bloat after semantic review already happened.

The Architectural Reality

PR conversation bodies are graph-ingestion substrate, but they are also cumulative context surface. The system currently optimizes for structured review extraction at the cost of thread consumability. That tradeoff flips once semantic review has already happened and the remaining state is a small delta, stale metadata, CI hold, or one atomic blocker.

Relevant substrate:

  • .agents/skills/pr-review/references/pr-review-guide.md — cycle classification and review execution protocol.
  • .agents/skills/pr-review/audits/review-cost-circuit-breaker.md — existing late-cycle micro-delta primitive.
  • .agents/skills/pr-review/assets/pr-review-followup-template.md — currently still large enough to become default late-cycle bloat.
  • ai/services/github-workflow/PullRequestService.mjs and .github/workflows/agent-pr-review-body-lint.yml — mechanical review-body anchor validation surfaces.
  • ai/scripts/diagnostics/review-cost-meter.mjs — actual measurement script.

Progressive Disclosure placement: this belongs in existing pr-review atlas payloads and validation surfaces, not as a new always-loaded AGENTS.md rule and not as a new skill.

The Fix

Tighten the review-cost circuit breaker from advisory to operationally decisive:

  1. Correct the meter path in the circuit breaker payload.
  2. Make circuit-breaker activation a hard routing step before loading/drafting any full follow-up review.
  3. Replace the current broad contract-blocker ineligibility with a narrower override: only a genuinely new semantic surface or cross-contract reset can justify full-template review after the breaker fires. Atomic contract drift gets a micro-delta / atomic blocker shape.
  4. Make the micro-delta shape first-class for formal review submission by either adding the required graph-ingestion anchors in a compact form or updating PullRequestService / lint validation to accept the micro-delta schema explicitly.
  5. Add a CI-hold / pending-check rule that uses A2A-only or a short non-formal hold note, not a formal review body, when checks are pending or red.
  6. Add tests that prove micro-delta formal reviews pass validation and that the documented meter path is correct.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
Review-cost trigger review-cost-circuit-breaker.md; operator correction 2026-05-24; PR #11876 meter output >=3 formal reviews OR >24KB thread routes to micro-delta/atomic-hold before full-template drafting Explicit semantic-reset override with evidence pr-review audit payload Unit/static test plus PR #11876 meter fixture or script smoke
Micro-delta formal review body manage_pr_review validation; PullRequestService.mjs; lint-pr-review-body workflow Micro-delta schema is accepted as a formal review while preserving graph-ingestion anchors If validator cannot branch safely, embed required metric tags in a compact single-line metrics block review-cost-circuit-breaker.md; tests PullRequestService.spec.mjs validation coverage
Atomic blocker handling Operator correction; existing context-budget discipline Late-cycle atomic blockers use one focused Required Action / state vector, not full follow-up review sections Full template only when the blocker introduces a new semantic surface requiring full rescore pr-review-guide.md trigger pointer to audit payload Review-guide grep and focused tests if validator changes
CI pending/red handling ci-security-audit.md Pending/red checks produce A2A-only or short hold; no full formal review body Limited CI-triage note only when explicitly requested ci-security-audit.md + circuit breaker cross-pointer Static docs audit
Meter command Actual file ai/scripts/diagnostics/review-cost-meter.mjs Documentation uses correct path None review-cost-circuit-breaker.md node ai/scripts/diagnostics/review-cost-meter.mjs <pr> smoke

Acceptance Criteria

  • review-cost-circuit-breaker.md documents the correct meter command path: node ai/scripts/diagnostics/review-cost-meter.mjs <prNumber>.
  • pr-review workflow requires running the circuit-breaker check before drafting a Cycle N follow-up when the PR already has >=3 formal reviews or suspected long conversation history.
  • When the breaker fires, full follow-up template use is forbidden unless the reviewer documents a semantic-reset override with the new semantic surface named explicitly.
  • Atomic metadata drift, stale PR-body/ticket contract drift, and one-file callsite regressions use a micro-delta / atomic blocker review shape rather than full review sections.
  • manage_pr_review / PullRequestService validation accepts the micro-delta formal review shape without forcing agents back into the full template.
  • CI pending/red states under the breaker route to A2A-only or short hold notes, not full formal reviews.
  • Focused tests cover micro-delta validation and rejection of invalid anchorless review prose.
  • No new always-loaded AGENTS.md rule is added; the fix stays in pr-review conditional payloads and validation tests.

Out of Scope

  • Rewriting the entire PR-review template.
  • Removing graph-ingestion metrics from Cycle 1 or true semantic-reset reviews.
  • Changing the human-only merge gate.
  • Solving all historical PR conversation bloat in archived threads.

Avoided Traps

  • Overcorrecting into rubber-stamp approvals: micro-delta still requires exact head SHA, CI state, blocker class, and evidence.
  • Moving the rule to AGENTS.md: this is review-skill-specific; always-loaded global substrate would add more context pressure.
  • Keeping contract-blocker as blanket ineligible: this recreates the #11876 failure where atomic contract drift drags the thread back into full-review mode.
  • Bypassing formal state entirely: when a formal review state is needed, the micro-delta shape must be validator-compatible instead of falling back to informal comments.

Related

  • PR #11876 — empirical trigger.
  • Discussion #11440 / existing review-cost circuit breaker lineage.
  • Issue #11546 — collapsed-N/A conciseness predecessor, not sufficient for this failure mode.
  • Issues #11465/#11467 — CI fail-fast predecessor, adjacent but not duplicate.

Decision Record impact

none directly; aligns with the existing progressive-disclosure and context-budget discipline.