Repository navigation
fix(apply): defer folder reconciliation on GitHub rate limit instead of failing the close lane - #1158
Conversation
…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.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 13, 2026, 10:57 PM ET / August 14, 2026, 02:57 UTC. ClawSweeper reviewWhat this changesThe PR makes folder reconciliation return a zero-mutation deferred result when GitHub rate limiting prevents its initial open-item scan. Regression provenancePossible 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 Review scores
Verification
How this fits togetherThe 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]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
Every scheduled
Apply close proposalsrun has been dying before it could close anything. Theapply-proofjob's "Reconcile read-only proof inputs" step performs a full open-item scan; when the shared GitHub credential is rate limited,ghWithRetrydeliberately throwsGitHubRateLimitError, thereconcileCLI exits 1, the proof job fails beforeproof_readyis ever exported, and the downstream apply job is skipped. Observed on runs 31764392301 and 31763539358 (both failed at this exact step withAPI 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
reconcileFoldersand 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_recordsvalidates 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 typeddeferred: { reason: "github_rate_limited", retryAt }field onReconcileResultand logged to stderr.This also protects the other
pnpm run reconcilecall 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
deferred.reason === "github_rate_limited", zero moves, and byte-identical record files. All 5 reconcile tests pass.node --test test/apply-*.test.ts).test/close-reasons.test.ts,test/review-close-policy.test.ts).pnpm run check:static(including docs check) andpnpm run lintclean.patch is correct, 0.99).