Skip to content

Consume durable gate state: seed ctx.metrics/ctx.settled and enforce exhausted budgets #181

Description

@aaddrick

Background

PR #177 (issue #166) shipped a durable, GitHub-native substrate for per-issue contrarian/review gate state (write, read, parse, self-validate) so it survives run boundaries — but explicitly ships no consumer. From the issue #166 body's "Out of scope" section:

Nothing consumes the parsed state in this issue. Seeding ctx.metrics and ctx.settled, and enforcing an exhausted budget, is the follow-up that depends on this.

What this follow-up covers

  • On a resumed run (or any run where attachGateStateBlocks finds a found block for the issue), seed ctx.metrics.pr_review_iters (and any other budget-bearing metrics) and ctx.settled from the parsed gate_budgets/settled payload, so a resumed review picks up where the prior run left off instead of drawing a fresh budget.
  • Enforce the budget: when the seeded count already meets/exceeds the cap, treat it as exhausted rather than granting another full MAX_PR_REVIEW_ITERATIONS cycle.
  • settledBlock(ctx) should render the seeded settled[] entries into the review prompts so reviewers see what was already adjudicated, not just a prose narrative pulled from gh comments.

Must be resolved first (or alongside)

The trust surface this consumer will lean on has an open gap: see the companion follow-up "Wire or remove the unproven claim_authors fallback in gate-state trust check" (empty-self_login fail-open, and the dead claim_authors fallback). Contrarian iteration 3 on issue #166 flagged that once a consumer exists, a forged ## Gate State block with an exhausted budget or fabricated settled[] text becomes load-bearing rather than inert — resolve or explicitly accept that risk before wiring this tier.

Also carry forward the payload's group_id/members gap noted during #166's implementation: blocks post only on ctx.issue, not on every consolidation-group member, so a re-anchored group primary fails open to a fresh budget. Decide whether this consumer needs to read across group members or whether the existing fail-open-to-fresh-budget behavior is acceptable, and document the decision in docs/architecture/gate-hygiene.md.

Source

Issue #166 "Out of scope" section; PR #177 implementation notes and contrarian review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgate-hygieneGate hygiene: findings, caps, and per-problem budgets (sequenced)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions