fix(publish): bound serialized writer contention#727
Merged
Conversation
Contributor
Author
|
@clawsweeper review |
Contributor
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
brokemac79
added a commit
that referenced
this pull request
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
state_contentionpublication completions into the existing adaptive capacity controller.state publish contentionin the operator dashboard instead of mislabeling the condition as GitHub 5xx pressure.Problem and causal proof
PR #722 added one global remote-ref lease around state mutation, but publication admission retained its adaptive 24–48 worker range. The two controls were not coordinated: healthy publishers serialized behind one owner, while later members of the 48-worker cohort exhausted the old 180-second acquisition budget and returned
retryable_failure/state_contention.This is not a GitHub-token failure. Post-#724 run 29781604190 eventually published
openclaw/openclaw#111766: it waited about 186 seconds through earlier owners, acquired the state lease, held it for about 44 seconds, released it cleanly, and completed aspublication_applied. In the same post-merge period, other publishers failed at 180 seconds while the observed owner continued renewing normally. Those failures were then retried or dead-lettered, so apparent queue resolution could be dominated by disposal rather than delivery.The production baseline immediately after #724 was 607 pending, 47/48 active, -40/hour 15-minute net drain, and zero publications in the prior 15 minutes. The lane later showed successful publications again, but state-contention retries and dead letters continued to dominate enough resolutions that delivery was not recovered.
Related issue #725 independently identified the same single global lease bottleneck and proposes broader per-item sharding. This PR is the narrow incident repair and remains compatible with that future architecture. Credit to @yetval for that independent report, and to the authors of #722/#724 for the serialization and state-safety work this patch coordinates.
Implementation
retryable_failurewith reasonstate_contentionbecomes publication-capacity failure feedback.EXACT_REVIEW_PUBLICATION_MIN_CONCURRENTis configured higher.No workflow dispatch, queue replay/reset, dead-letter replay, gate change, state layout change, retry-budget increase, or broad refactor is included.
Validation
Focused and broad checks
The controller regression uses
EXACT_REVIEW_PUBLICATION_MIN_CONCURRENT=12, proves state contention still sets capacity/ceiling to 4, then completes another publisher withgithub_transientand proves the ceiling remains 4. The renderer regression proves the dashboard saysstate publish contention, notGitHub 5xx.Docker-backed Crabbox contention proof
Provider:
local-container(Docker,mcr.microsoft.com/playwright:v1.60.0-noble)cbx_447c46b1810a: ran the production commit and patched checkout in parallel against separate bare Git origins with four simultaneous real remote-ref lease writers, each holding the critical section for 70 seconds.StatePublishContentionErrorat 180,051 ms.CRABBOX_PROOF=PASS.adaptive, expectedthrottled) and passed on the patch.cbx_9469821b180a: the completetest/repair/git-publish.test.tsproduction-surface file passed in Linux (exit 0).The final 366-second value is six seconds safer than the successful Crabbox checkout: committed review identified that an exact 360-second deadline could miss the boundary because the loop starts before jitter and polls strictly before its deadline.
Review closeout
codex review --uncommittedreviewed the initial dirty patch.origin/maincommit6444e678dccb3cce1505827674b05a1f2f7ce397after fix(dashboard): bound Bay terminal records to tide #726 landed, and overlapping dashboard tests were rerun.codex review --base origin/mainRisks and rollout
published + supersededdelivery matching arrivals with declining pending depth; dead-letter disposal is not recovery.Baseline noise
The native-Windows aggregate Git-publish file contains pre-existing mixed-platform fixture failures, including
/usr/bin/envassumptions and shared Git/CWD race cases. Per the platform-scope policy, this PR does not port that Linux-hosted surface. The same complete file passed in Docker-backed Crabbox Linux, and the native focused lease subset passed 5/5.