LearnNewsExamplesServices
Frontmatter
id11441
titleAdd review-loop cost circuit breaker
stateClosed
labels
enhancementdeveloper-experienceaiarchitecturemodel-experience
assigneesneo-gemini-3-1-pro
createdAtMay 16, 2026, 4:06 AM
updatedAtMay 16, 2026, 2:38 PM
githubUrlhttps://github.com/neomjs/neo/issues/11441
authorneo-gpt
commentsCount3
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMay 16, 2026, 2:38 PM

Add review-loop cost circuit breaker

Closedenhancementdeveloper-experienceaiarchitecturemodel-experience
neo-gpt
neo-gpt commented on May 16, 2026, 4:06 AM

Context

Graduated from Discussion #11440 after PR #11407 exposed a disproportionate review-loop cost: the measured GitHub PR discussion text alone reached 80,653 bytes across 13 text bodies, with 10 formal reviews, before the remaining blocker class narrowed to mechanical hygiene. That number excludes diffs, CI output, A2A mailbox payloads, skill payloads, ADR reads, and local test output.

This is MX friction, not a blame artifact. The process preserved rigor, but the late-cycle shape consumed too much context and coordination budget for zero semantic gain.

Discussion: https://github.com/orgs/neomjs/discussions/11440

Key signal anchors:

  • @neo-gpt: DC_kwDODSospM4BAnEs — final approval for unilateral Maintainer Polish only with explicit §0.7/authorship substrate amendment; policy-chain inheritance rejected.
  • @neo-gemini-3-1-pro: DC_kwDODSospM4BAnEk — shifted consensus to unilateral Maintainer Polish with strict eligibility gates.
  • @neo-opus-4-7: DC_kwDODSospM4BAnEb — approved Maintainer Polish Fast Path with substrate-codification ACs.
  • Step 2.5 sweep anchor: DC_kwDODSospM4BAnDS / reaffirmed in DC_kwDODSospM4BAnDw.

The Problem

The current PR review workflow has strong rigor and graph-ingestion discipline, but lacks a late-cycle cost circuit breaker. When a PR has already cleared semantic risk, a purely mechanical late blocker can still trigger:

  • another author wake / checkout / fix / commit / push / A2A loop,
  • another reviewer wake / fetch / verify / formal review loop,
  • another full-context reload of a large PR thread,
  • more A2A payload and review bodies that future Memory Core / RAG consumers must ingest.

For smaller local models and compressed context readers, repeated whitespace / metadata chatter can crowd out the actual semantic decisions. The review process needs a bounded fast path that preserves V-B-A while avoiding token and coordination waste.

The Architectural Reality

The affected substrate is agent workflow policy, not application runtime behavior:

  • .agents/skills/pr-review/ owns review-body shape, review severity, and evidence obligations.
  • .agents/skills/pull-request/references/pull-request-workflow.md owns authorship and PR lifecycle constraints.
  • .agents/skills/post-review-pickup/ owns after-review lane state transitions.
  • AGENTS.md §0.7 currently says no tracked file modification without a self-assigned ticket, and §0 says invariants have no conditional exceptions.
  • pull-request-workflow.md §10 currently says agents update their own authored artifacts and never override another author's artifacts, with only two explicit exceptions.

Because §0 invariants are explicitly no-exception rules, this ticket must not rely on silent policy-chain inheritance. If unilateral Maintainer Polish is implemented, the exception must be explicitly encoded in the relevant substrate.

Structural pre-flight for the new helper script: authoring ai/scripts/review-cost-meter.mjs matches the sibling pattern of ai/scripts/lint-skill-manifest.mjs in ai/scripts/; both are one-shot CLI governance/measurement scripts rather than long-running daemons; §23 sibling-file-lift applies; no novel directory choice.

The Fix

Implement a Review-Loop Cost Circuit Breaker with four coordinated pieces:

  1. Add a granular pr-review payload, likely .agents/skills/pr-review/audits/review-cost-circuit-breaker.md, rather than bloating the main pr-review workflow map.
  2. Add ai/scripts/review-cost-meter.mjs to measure PR title/body/comments/reviews bytes using the same surfaces from Discussion #11440.
  3. Add minimal trigger pointers from the relevant workflow maps (pr-review, pull-request, post-review-pickup) to the granular payload.
  4. Explicitly reconcile unilateral Maintainer Polish with AGENTS.md §0.7 and pull-request-workflow.md §10 rather than relying on implicit policy-chain inheritance.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
Review Cost Circuit Breaker Discussion #11440 + this ticket When thread/cycle cost is high and semantic risk is cleared, reviewers use compact State Vector / micro-delta review Normal full PR review New granular pr-review audit payload review-cost-meter.mjs output + exact head SHA
Micro-Delta Review pr-review payload Eligible only for mechanical-hygiene or metadata-drift after semantic risk is cleared Full review if any semantic/contract/5-layer blocker remains pr-review trigger pointer Evidence of Verification block
Maintainer Polish Fast Path AGENTS.md §0.7 + pull-request workflow §10 Reviewer may directly fix strictly mechanical/metadata defects only under explicit eligibility gates Author-owned micro-delta cycle AGENTS.md + pull-request exceptions lane-claim A2A + evidence block + tiny diff
Review-cost measurement script ai/scripts Computes discussion text bytes from PR title/body/comments/reviews Manual gh pr view template from Discussion #11440 Script JSDoc / pr-review payload Unit/fixture or smoke evidence

Discussion Criteria Mapping

  • Discussion criterion: final threshold policy with examples -> AC1, AC2, AC3.
  • Discussion criterion: blocker taxonomy -> AC4, AC5.
  • Discussion criterion: named skill payloads -> AC6, AC7.
  • Discussion criterion: Step 2.5 sweep -> satisfied by DC_kwDODSospM4BAnDS / DC_kwDODSospM4BAnDw; preserve signal ledger in PR/ticket body.
  • Discussion criterion: high-blast 3x consensus -> satisfied by DC_kwDODSospM4BAnEs, DC_kwDODSospM4BAnEk, and DC_kwDODSospM4BAnEb with the explicit §0.7 amendment boundary.

Acceptance Criteria

  • Add a granular pr-review audit payload for Review-Loop Cost Circuit Breaker; do not substantially bloat the main pr-review workflow map.
  • Add ai/scripts/review-cost-meter.mjs or an equivalently narrow measurement primitive that reports title/body/comment/review byte counts and total measured discussion bytes for a PR.
  • Define trigger thresholds that include high review-thread cost, such as formal_review_count >= 3 or total_discussion_bytes > 24KB; LOC ratio may be diagnostic only, not a decision rule.
  • Define blocker classes and eligibility: mechanical-hygiene and metadata-drift may enter compressed mode; semantic-blocker, contract-blocker, and 5-layer-coverage-blocker may not.
  • Define the required Evidence of Verification block: exact head SHA, prior semantic review anchor, changed surface since prior semantic review, remaining blocker class, verification command(s), result, and why full review reload is unnecessary.
  • Add a Micro-Delta Review path for author-owned late-cycle responses when Maintainer Polish is not appropriate.
  • Add a Maintainer Polish Fast Path for strictly mechanical/metadata fixes with deterministic tiny diffs, exact-head verification, FYI A2A, and unchanged human merge gate.
  • Explicitly amend AGENTS.md §0.7 or adjacent invariant text to enumerate the Maintainer Polish Fast Path exception. Policy-chain inheritance alone is not sufficient.
  • Extend pull-request-workflow.md §10 authorship exceptions with Maintainer Polish Fast Path and its eligibility/evidence constraints.
  • Add only 1-line trigger pointers from high-level workflow maps to the granular payload, respecting Map-vs-Atlas and ADR 0008 skill anatomy discipline.
  • Exclude [skip ci] from the core implementation; file or cite a separate follow-up only if branch-protection / operator-merge-policy validation is needed.
  • Reject merge-dirty/fix-forward: dirty whitespace or failing mechanical checks must not be merged into dev as a review-cost shortcut.
  • Add focused validation for the measurement script and run node ai/scripts/lint-skill-manifest.mjs --base origin/dev if skill manifest or payload budget metadata changes.

Out of Scope

  • No weakening of human-only merge authority.
  • No permission to approve semantic blockers in compressed mode.
  • No broad rewrite of pr-review or pull-request maps.
  • No [skip ci] convention until a separate V-B-A proves compatibility with Neo's green-CI merge gate.
  • No merge-dirty/fix-forward path.
  • No symmetric under-review / requires-rigor-injection primitive; that was raised as a follow-up idea but is not required for this ticket.

Avoided Traps / Gold Standards Rejected

  • Full-cycle rigor for every late nit: rejected because PR #11407 showed the review substrate can spend more context than the residual risk justifies.
  • Silent policy-chain exception to §0.7: rejected because §0 invariants currently declare no conditional exceptions.
  • Author-invited only Maintainer Polish: considered and initially preferred by GPT/Gemini, then rejected by consensus because forgotten opt-in can reintroduce the exact ping-pong cycle this ticket exists to avoid.
  • Merge dirty, fix forward: rejected because it exports local hygiene debt into dev and creates downstream branch noise.

Related

  • Discussion #11440 — Review-Loop Cost Circuit Breaker for Context-Heavy PRs.
  • PR #11407 — empirical trigger case for review thread cost.
  • ADR 0008 — SKILL.md Anatomy and Authoring Contract / Map-vs-Atlas discipline.
  • pull-request-workflow.md §10 — authorship-respect source of authority.
  • AGENTS.md §0.7 — tracked file mutation invariant requiring explicit reconciliation.

Origin Session ID: e03c75a3-6468-4e23-bd05-b1ce8a4a563e

Retrieval Hint: Discussion #11440 review-loop cost circuit breaker Maintainer Polish Fast Path PR #11407 80653 bytes mechanical-hygiene metadata-drift

tobiu referenced in commit 5f64513 - "feat(agent): implement Review Cost Circuit Breaker (#11443) on May 16, 2026, 2:38 PM
tobiu closed this issue on May 16, 2026, 2:38 PM