Skip to content

fix(apply): defer folder reconciliation on GitHub rate limit instead of failing the close lane - #1158

Merged
steipete merged 1 commit into
mainfrom
steipete/cleanup-old-issues-prs-3f9c6d
Aug 14, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/cleanup-old-issues-prs-3f9c6d

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Every scheduled Apply close proposals run has been dying before it could close anything. The apply-proof job's "Reconcile read-only proof inputs" step performs a full open-item scan; when the shared GitHub credential is rate limited, ghWithRetry deliberately throws GitHubRateLimitError, the reconcile CLI exits 1, the proof job fails before proof_ready is ever exported, and the downstream apply job is skipped. Observed on runs 31764392301 and 31763539358 (both failed at this exact step with API rate limit exceeded for installation), during a window where only 3 items were closed in 12 hours despite all six close reasons being enabled and thousands of eligible candidates.

Why This Change Was Made

The open-state scan is the very first GitHub read in reconcileFolders and happens before any record mutation. Deferring the whole reconciliation at that boundary is therefore guaranteed zero-mutation: the emitted result truthfully reports no changed records (publish_reconciled_records validates and publishes nothing), and every downstream close still runs its own fail-closed live-state verification per item. The next scheduled pass retries folder placement after the reported reset. Reconciliation deferral is reported as a typed deferred: { reason: "github_rate_limited", retryAt } field on ReconcileResult and logged to stderr.

This also protects the other pnpm run reconcile call sites with the same throttle exposure: the review record publication step (which previously could fail record publication on a throttled reconcile) and the apply job's own "Reconcile before apply preselect" step.

Non-throttle errors still fail loudly; scoped reconciliation semantics are unchanged.

Evidence

  • New regression test: a rate-limited open-state scan yields exit 0, deferred.reason === "github_rate_limited", zero moves, and byte-identical record files. All 5 reconcile tests pass.
  • Full apply-lane suite: 250/250 tests pass (node --test test/apply-*.test.ts).
  • Close-policy suites: 70/70 tests pass (test/close-reasons.test.ts, test/review-close-policy.test.ts).
  • pnpm run check:static (including docs check) and pnpm run lint clean.
  • Codex-backed autoreview: clean, no accepted/actionable findings (patch is correct, 0.99).

…of failing the close lane

A throttled open-state scan in the reconcile step killed the apply-proof job
before proof selection, which skipped 'Apply close proposals' entirely — every
scheduled apply run died this way while the installation token was exhausted,
so no close proposals were applied at all. The scan runs before any record
mutation, so deferring with a zero-change result is safe: apply re-verifies
live state per item and the next 15-minute pass retries folder placement.
@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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 13, 2026, 10:57 PM ET / August 14, 2026, 02:57 UTC.

ClawSweeper review

What this changes

The PR makes folder reconciliation return a zero-mutation deferred result when GitHub rate limiting prevents its initial open-item scan.

Regression provenance

Possible regression — suspected (failure trace). No predecessor PR is attributed.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 4 items remain

Keep this PR open for a complete source review and real after-fix workflow proof. The review environment could not execute even read-only repository commands, so current-main behavior, full diff consumers, and history could not be verified.

Priority: P2
Reviewed head: eb2b455b439eccf195ebd25099b5bb2985db18e9

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The proposed change has a focused stated test, but real behavior proof and a complete reviewer source pass are still missing.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body reports regression tests and checks, but provides no inspectable after-fix workflow or controlled runtime trace showing deferral and safe close-lane continuation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports regression tests and checks, but provides no inspectable after-fix workflow or controlled runtime trace showing deferral and safe close-lane continuation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 2 items Repository inspection unavailable: Read-only inspection failed before commands could run: the sandbox reported bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted; no source, history, or current-main claims were inferred from local files.
PR-provided failure mechanism: The PR body reports that a GitHub-rate-limited open-state scan exits before proof selection, skipping the downstream apply job; the supplied patch introduces a typed deferred result for that path.
Findings None None.
Security None None.

How this fits together

The apply lane reconciles durable review-record folders with live GitHub item state before publishing proof and selecting safe close proposals. Its result feeds record publication and the live-verified close lane.

flowchart LR
  A[GitHub item state] --> B[Reconciliation scan]
  B --> C{Rate limited?}
  C -->|No| D[Reconcile record folders]
  C -->|Yes| E[Deferred zero-mutation result]
  D --> F[Proof and publication]
  E --> F
  F --> G[Live-verified close lane]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports regression tests and checks, but provides no inspectable after-fix workflow or controlled runtime trace showing deferral and safe close-lane continuation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - A deferred reconciliation is safe only if all proof, publication, and apply consumers explicitly preserve fail-closed selection semantics; the read-only source inspection required to confirm that could not run.
  • Resolve merge risk (P1) - The supplied evidence is test and claimed CI output, not an after-fix workflow trace showing rate-limit deferral followed by continued close-lane execution.
  • Complete next step (P2) - A complete source-path review and real after-fix behavior proof are needed before this automation-changing PR can be safely landed.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 4 files affected; +87, -11 The patch changes reconciliation control flow and its result contract, with one focused regression test file.

Merge-risk options

Maintainer options:

  1. Prove the deferred workflow path (recommended)
    Provide a redacted after-fix workflow or controlled run showing the rate-limit result, deferred reconciliation, and safe continuation to the downstream close selection.

Technical review

Best possible solution:

Preserve the zero-mutation deferral only after a complete consumer-path review and a redacted after-fix apply workflow trace demonstrate that live per-item verification remains fail closed.

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

No; the supplied PR describes failed runs and a regression test, but the review environment could not execute the stated reproduction or inspect the current workflow path.

Is this the best way to solve the issue?

Unclear; deferring before mutation may be the narrow solution, but consumer behavior and fail-closed application safety could not be verified in this environment.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: A rate-limited reconciliation can block scheduled proposal application, creating a bounded but real automation reliability problem.
  • add merge-risk: 🚨 automation: The patch changes reconciliation behavior consumed by proof publication and the apply workflow.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports regression tests and checks, but provides no inspectable after-fix workflow or controlled runtime trace showing deferral and safe close-lane continuation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: A rate-limited reconciliation can block scheduled proposal application, creating a bounded but real automation reliability problem.
  • merge-risk: 🚨 automation: The patch changes reconciliation behavior consumed by proof publication and the apply workflow.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports regression tests and checks, but provides no inspectable after-fix workflow or controlled runtime trace showing deferral and safe close-lane continuation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Repository inspection unavailable: Read-only inspection failed before commands could run: the sandbox reported bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted; no source, history, or current-main claims were inferred from local files.
  • PR-provided failure mechanism: The PR body reports that a GitHub-rate-limited open-state scan exits before proof selection, skipping the downstream apply job; the supplied patch introduces a typed deferred result for that path. (src/clawsweeper-dashboard-audit.ts:403, eb2b455b439e)

Likely related people:

  • steipete: The supplied PR context attributes the observed apply-lane failures and the proposed repair to this contributor; current-main ownership history could not be inspected. (role: proposed repair author and incident reporter; confidence: low; commits: eb2b455b439e; files: src/clawsweeper-dashboard-audit.ts, test/reconcile.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted after-fix workflow or controlled-run trace showing rate-limit deferral and downstream safe continuation.
  • Request a fresh review after the proof and complete source inspection are available.

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 c175faa into main Aug 14, 2026
17 checks passed
@steipete
steipete deleted the steipete/cleanup-old-issues-prs-3f9c6d branch August 14, 2026 03:03
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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant