Repository navigation
fix(publish): prevent state races from timing out result delivery - #720
Merged
Merged
Conversation
Contributor
Author
|
@clawsweeper review |
Contributor
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
This was referenced Jul 20, 2026
azaj01
pushed a commit
to azaj01/clawsweeper
that referenced
this pull request
Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #712
Related: #714
Related: #716
What Problem This Solves
Fixes an issue where completed issue and PR reviews remain queued when concurrent exact-result publishers race to update the shared state branch.
The incident began immediately after #712 merged at 2026-07-20 06:04:34Z. That change made a shallow publisher hydrate Git history when
merge-basecould not see common ancestry. Under the normal 32-writer publication load, losing writers repeatedly entered--deepen/--unshallow; many timed out after 60 seconds and held their publication lease through the failed attempt. The queue was still at 215 publication items with all 32 slots active at 2026-07-20 13:21Z.This is not a label-only or dashboard-only issue: the failure occurs in the exact-result publication step before the durable result can finish its comment/label/application lifecycle.
Why This Change Was Made
Exact event publication commits one known record tuple. This change gives that path a dedicated
pushSingleRecordTupleCommitentry point which:All generic
pushCommitcallers retain the existing #714/#716 hydration behavior. This does not change queue capacity, add retries, reset state, alter gates, dispatch Actions, or weaken reconciliation safety.User Impact
Issue and PR result publishers that lose a state-branch push race can reconcile immediately on the fetched remote head instead of spending up to 60 seconds hydrating history and failing. This should release publication leases promptly and let the backlog drain while preserving both independent record tuples and the newer winner for same-tuple races.
GitHub API rate limiting remains a separate possible failure mode; this patch intentionally addresses the dominant Git fetch timeout signature rather than masking it with capacity or retry changes.
Evidence
Production causal proof
846b73c666c01b1c29d8a65a93549fca5742b404.Publish event result and apply safe closeat 2026-07-20 12:17:06Z and failed after 9m24s. Its log shows rejected state pushes, no visible common base, fix(repair): recover unavailable state objects in ledger publish #712's shallow-recovery helper,fatal: shallow file has changed, andGitCommandTimeoutError: git fetch timed out after 60000msbefore retryable completion.git log -S mergeBaseWithShallowRecoverytraces the failing helper to fix(repair): recover unavailable state objects in ledger publish #712 (25135198f921b062b6d276931ca794d0222129c6). Timing alone is not the proof: the runtime stack and exact failing command both enter that helper.Real behavior proof
Environment: Crabbox
local-container, Docker imagemcr.microsoft.com/playwright:v1.60.0-noble.Focused lease:
cbx_00f30e0daaa8(pearl-shrimp). The Docker run builttsconfig.repair.json, ran the exact two-writer regression plus the existing shallow/unrelated-history guards, checked the production call-site contract, and ran scoped oxlint, oxfmt, andgit diff --check.The new integration case creates a depth-1 publisher and a second writer against a real bare Git remote. The second writer wins the first push; a shim fails the test if
git fetch --deepenis attempted. The publisher then rebuilds on the fetched remote head, pushes successfully, remains shallow, and the remote contains both the publisher's tuple and the concurrent writer's tuple.Broad lease:
cbx_53da04c5a2c5(golden-krill). The Docker run rebuilt all three TypeScript targets and ran the complete repair suite:The broad Crabbox setup materialized untouched files from Git's LF index because raw Windows-to-Linux sync otherwise presents repository-wide CRLF fixture noise. The initial raw-sync failure was entirely in workflow text/contained
pnpmharness expectations; after Linux checkout normalization and a Corepackpnpmshim, the unchanged full suite passed without exclusions.Not proven pre-merge: production backlog drain. The deterministic test proves the exact failed two-writer lifecycle and removes the 60-second hydration command from that bounded path; live drain must be observed after deployment.
Review gates
codex-review --mode local --full-access— clean, no accepted/actionable findings.codex-review --mode branch --base origin/main --full-access— clean, no accepted/actionable findings.git diff --checkpassed on the host and on the scoped Linux patch.Risks And Rollout
The behavior change is opt-in and limited to exact single-record result publication. A guard rejects zero or multiple tuple identities before enabling the bounded rebuild. Generic checkpoint, ledger, and other reconciliation callers are unchanged.
The main rollout signal is the publication queue: the active-lease timeout signature should disappear first, then leased duration and ready depth should fall. A remaining GitHub rate-limit signature would be separate evidence rather than a reason to broaden this patch.
No automerge is requested. A maintainer should make the explicit merge decision after normal CI and review-stage evidence.
Attribution
This repair builds on Peter Steinberger's state recovery and remote-head reconciliation work in #712, #714, and #716. It preserves those correctness changes while narrowing the exact event publisher's contention path.