Skip to content

fix(automerge): preserve quota retry classification - #1168

Merged
steipete merged 2 commits into
mainfrom
steipete/fix-automerge-quota-fixture
Aug 14, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/fix-automerge-quota-fixture

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What broke

The inherited failure in automerge e2e run 31791711359 is a production classification regression, not a stale request-count fixture.

PR #1166 correctly changed close-mode quota exhaustion from a thrown error into a clean apply yield. The exact-event apply now records two skipped_runtime_budget actions: one for item 42 and one continuation sentinel for item 0. publish-event-result did not recognize that clean-yield proof, threw an untyped error, and converted the intended retry into permanent_failure/unknown_failure.

The request-count assertion was already correct. In the red 403 case it expected 1 request and observed 1 request, with 0 DELETEs; the failing assertion was retryable_failure expected versus permanent_failure actual. The 429 case was unreachable after that first assertion aborted. After the fix, 403 and 429 each observe exactly 1 authenticated GET and 0 DELETEs.

Fix

The apply yield now preserves the bounded retry deadline plus credential scope and reset provenance. The exact-publication boundary recognizes a rate-limit-backed skipped_runtime_budget result and reconstructs the existing GitHubRateLimitError, so the established completion path emits retryable_failure/github_rate_limit to both workflow outputs and the durable batch result.

No fixture count was changed. CHANGELOG.md was intentionally left untouched per the work order.

Behavior proof

  • Claim: an exact-event 403 or 429 quota response remains a durable retryable quota result after the clean apply yield.
  • Exercised surface: the production publish-event-result CLI and real GitHub CLI HTTP transport over the fixture's owned Unix socket.
  • Scenario: HTTP 403 and 429, one issue read each, synthetic credentials, no DELETE request.
  • Command/environment: Docker-backed Crabbox provider=local-container; committed docs/proof/fix-automerge-quota-fixture/run-proof.sh at runtime head e1b0e27e5fd8045ce65da1fdcdcfc6c145d1e8d0.
  • Observable result: statuses [403,429], requests [1,1], publisher exits [1,1], completion kinds retryable_failure twice, failure kinds github_rate_limit twice, durable batch kinds retryable_failure twice, cleanup deletes [0,0].
  • Receipt: docs/proof/fix-automerge-quota-fixture/container-receipt.json; lease cbx_c6ed44beacf2 (crimson-prawn-01cd), stopped and absent from the provider list.
  • SHA proof: commit, tree, and merge base were resolved programmatically and cross-checked with git cat-file; static jq validated the receipt.
  • Limits: deterministic loopback GitHub traffic only; no production GitHub, Worker, queue, deployment, or workflow state was mutated.

OpenClaw Bay is unaffected because this restores an internal exact-publication failure classification; no lifecycle, queue, status, telemetry, dashboard, or public observer contract changes.

Validation

  • Focused apply/publication tests: 50 passed, 0 failed.
  • Quota E2E: 403 and 429 green with the counts above.
  • pnpm run check: 3,463 tests; 3,455 passed, 8 skipped, 0 failed.
  • Pre-commit Codex autoreview: clean, no accepted/actionable findings.
  • Committed branch Codex autoreview against origin/main: clean, no accepted/actionable findings.

Proof is sufficient for the claimed loopback publication behavior. No review finding is unresolved.

@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 6:46 AM ET / 10:46 UTC.

ClawSweeper review

What this changes

This PR preserves quota retry metadata across an apply yield so exact-event publication reports GitHub throttling as a retryable failure.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main does not recognize a rate-limit-backed clean apply yield at exact publication, while this focused PR restores the established retry classification with strong real-behavior proof.

Priority: P2
Reviewed head: 0014afee966cef67a9cb1faf2e0fde4839ab1394

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused repair with current, transport-level after-fix proof and no actionable correctness finding.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The committed Crabbox receipt provides after-fix real transport proof for 403 and 429 through the production publisher and GitHub CLI, with observed retryable results and no DELETE requests.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The committed Crabbox receipt provides after-fix real transport proof for 403 and 429 through the production publisher and GitHub CLI, with observed retryable results and no DELETE requests.
Evidence reviewed 5 items Missing current-main classification: Current main reaches exact-event publication after reading apply actions but has no rate-limit-yield recognition before its generic unproven-action failure path.
Focused repair: The PR detects the exact item’s skipped-runtime-budget rate-limit reason and reconstructs GitHubRateLimitError, which the existing top-level handler emits as retryable_failure/github_rate_limit.
Metadata round-trip contract: GitHubRateLimitError already parses a propagated retry deadline, credential scope, and reset provenance; the PR’s apply-yield text carries those fields across the boundary.
Findings None None.
Security None None.

How this fits together

The apply lane processes reviewed GitHub items and can stop cleanly when its API budget is exhausted. Exact-event publication converts that apply result into workflow outputs and a durable batch outcome used to schedule retry behavior.

flowchart LR
  A[GitHub quota response] --> B[Apply lane]
  B --> C[Clean runtime-budget yield]
  C --> D[Exact event publication]
  D --> E[Retryable workflow result]
  D --> F[Durable batch result]
Loading

Before merge

  • Resolve merge risk (P1) - This changes exact-publication retry routing: an intended quota yield will be retried rather than recorded as an unknown permanent failure.
  • Complete next step (P2) - No repair lane is needed: the patch has no actionable finding and already supplies sufficient real-behavior proof; it awaits normal current-head checks and maintainer landing review.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch footprint 5 files; production +9/-1, test code +0, proof/docs +196 The runtime change is narrow; the remaining diff records and makes its transport-level validation reproducible.

Merge-risk options

Maintainer options:

  1. Retain the proven quota retry route (recommended)
    Merge after current-head checks complete; the committed 403/429 transport proof shows the intended retry classification without extra GitHub mutations.
  2. Pause for broader fault coverage
    Defer landing only if maintainers require evidence beyond the existing target-app quota fixture before changing retry scheduling.

Technical review

Best possible solution:

Land the focused classification repair after the current-head check gate completes, retaining the 403/429 transport fixture as regression coverage.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible with high confidence: the existing 403/429 exact-publication fixture exercises this boundary, and current main lacks its rate-limit-yield classification.

Is this the best way to solve the issue?

Yes. Reconstructing the existing typed quota error at the publication boundary is the narrowest solution and preserves its established retry handler and metadata contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against bf762f3f6f9e.

Labels

Label changes:

  • add P2: This is a bounded automation regression that misclassifies quota exhaustion and disrupts retry handling without indicating data loss or a core outage.
  • add merge-risk: 🚨 automation: The patch changes exact-event workflow and durable-batch retry classification after GitHub throttling.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The committed Crabbox receipt provides after-fix real transport proof for 403 and 429 through the production publisher and GitHub CLI, with observed retryable results and no DELETE requests.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The committed Crabbox receipt provides after-fix real transport proof for 403 and 429 through the production publisher and GitHub CLI, with observed retryable results and no DELETE requests.

Label justifications:

  • P2: This is a bounded automation regression that misclassifies quota exhaustion and disrupts retry handling without indicating data loss or a core outage.
  • merge-risk: 🚨 automation: The patch changes exact-event workflow and durable-batch retry classification after GitHub throttling.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The committed Crabbox receipt provides after-fix real transport proof for 403 and 429 through the production publisher and GitHub CLI, with observed retryable results and no DELETE requests.
  • proof: sufficient: Contributor real behavior proof is sufficient. The committed Crabbox receipt provides after-fix real transport proof for 403 and 429 through the production publisher and GitHub CLI, with observed retryable results and no DELETE requests.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the prior merged apply-yield behavior and this narrow publication-boundary repair. (role: recent automation contributor; confidence: high; commits: 386730fc41ae, e1b0e27e5fd8; files: src/clawsweeper-command-operations.ts, src/repair/publish-event-result.ts)
  • Martin Cleary: Blame attributes the rate-limit error’s retry-deadline, scope, and provenance reconstruction contract to this history. (role: introduced rate-limit metadata parsing; confidence: high; commits: 91272a65e6ff; files: src/github-retry.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit e17e094 into main Aug 14, 2026
18 checks passed
@steipete
steipete deleted the steipete/fix-automerge-quota-fixture branch August 14, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant