fix(publish): serialize exact state mutations#722
Merged
Conversation
Contributor
Author
|
@clawsweeper review |
Contributor
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
This was referenced Jul 20, 2026
This was referenced Jul 20, 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.
Summary
stateProblem and causal proof
Exact review generation and some GitHub publication calls still complete, but the queue is not draining because many exact publishers independently mutate the single
stateref. A representative run on currentmain, 29750012187, spent 12.8 minutes in result publication, repeatedly lost state pushes, and performed repeated 13–41 second state fetches before eventually succeeding. Comparable observed runs scaled from 2.8 minutes with no rejection to 5.6/10.6/20.6 minutes with 5/11/19 rejections. These were non-fast-forward/CAS losses, not GitHub authentication failures; the affected logs contained no 401/403 signature.At 2026-07-20T15:49:33Z the live publication lane still had 323 pending, 318 ready, 39 of 40 leases occupied, an oldest item age of 4h06m, and net drain of -88/hour over 15 minutes and -60/hour over 60 minutes.
The concurrency originated when #614 parallelized exact publication and #641 added adaptive capacity. #711 and #712 made losing state writers perform more recovery work, while #713 stopped those state-fetch timeouts from lowering global capacity. #714, #716, #720, and #721 repaired object/history recovery, but they do not prevent the 40 admitted exact publishers from colliding on the same ref. Thus #712 amplified/exposed this failure path; it did not create the underlying parallel-writer topology.
Implementation
refs/heads/clawsweeper-publish-lease/statebefore resetting/applying the exact record tuple.state, so there is no check/push gap.state_contentionthrough the existing transient publication retry budget (12 attempts/24 hours) without reporting a GitHub failure kind or reducing global capacity.The lock covers only the exact tuple mutation. It does not serialize review generation, GitHub comment/label calls, routing, or broad state publishers.
Validation
local-container/node:24-bookworm, leasecbx_80097db415d4(exit 0):test/repair/git-publish.test.tscases passedstate_contentionqueue-budget tests passedlocal-container/node:24-bookworm, leasecbx_b793a71f332b(exit 0):pnpm run checkpassed, including all unit/repair suites, both coverage gates, builds, lint, formatting, active-surface, dashboard-boundary, and limits checks. The disposable proof environment normalized host-synced CRLF text and supplied checksum-verifiedjq; neither adjustment is in this patch.pnpm run build:all; the lease, queue, and workflow tests; Oxlint; andgit diff --checkpassed. Native aggregate failures were unrelated Windows-host baseline constraints (Linux/Bash integrations, symlink privilege, and POSIX filesystem fixtures), so the authoritative aggregate proof ran in Crabbox Linux.actionlintis not installed locally; workflow source assertions, YAML formatting, the aggregate Linux suite, and normal CI cover the one completion-reason allowlist edit.CI timing follow-up
The first #722
pnpm checkfailed only two pre-existing action-ledger timing assertions: dead-owner reclamation took 3.64 seconds and Linux zombie-owner reclamation took 1.25 seconds against hard-coded one-second limits. The same tests passed on the immediately preceding main run in 361 ms and 66 ms. #722 does not change action-ledger runtime behavior; the limits originated in #511, while #709 had already widened comparable host-load-sensitive tests.The test-only follow-up widens all four prompt-reclamation guards from one second to five seconds. This remains below the production lock-wait fallback of ten seconds, so the tests still distinguish prompt dead-owner reclamation from the fallback path.
pnpm run build:all: passed.node --test --test-name-pattern 'producer locks reclaim fresh dead owners|Linux stale-lock checks bypass cached identities|Linux producer locks reclaim zombie owners' test/action-ledger-runtime.test.ts: one applicable Windows test passed in 1.475 seconds; two Linux-only tests skipped on Windows as designed.pnpm exec oxfmt --check test/action-ledger-runtime.test.ts: passed.git diff --check: passed.Review closeout
codex review --uncommittedfirst identified that a generic reason would use the poison-item budget. Accepted: addedstate_contention, its transient queue classification, and regression proof.codex review --uncommittedidentified expiry between ownership validation and a slow push. Accepted: changed renewal plus state update to an atomic fenced push and added post-expiry proof.codex review --uncommitted: no actionable defects; lease, atomic publish, and retry-classification paths internally consistent.codex review --base origin/main: no actionable correctness issues; focused build, lease, queue, and workflow tests passed.codex review --uncommitted: clean, no accepted/actionable findings.codex review --base origin/main: clean, no accepted/actionable findings; state-publish lease fencing and retry classification remain consistent across publisher, queue, and workflow contracts.Risk and rollout
state_contentionrather than dead-lettered early or fed into GitHub pressure control.Credit
The remote-lease design builds on Vincent Koc's earlier state-publication serialization work in
b72380fa711171e6d8cc0025ce8285472f25230e. It is narrowed here to exact result mutation and strengthened with atomic fencing. Peter Steinberger's recovery work in #711, #712, #714, #716, and #721 remains intact.