Repository navigation
Raise work queue publication retry budget for contended ledgers - #76425
Conversation
Raise the default maxRetries from 5 to 32, the validation bound from 10 to 128, and the stress worker budget from 10 to 64. Keep the exponential schedule unchanged because immediate retries measured slower (135 s / max attempt 39 versus 69 s / max attempt 13 on the 256-item profile). Add workflow_dispatch inputs and raise the PR lifecycle profile from 16 to 128.
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Found one non-blocking performance/operational concern: the shared retry default also affects compaction, increasing its unbacked API work under checkpoint contention. Inline comment added. Static review only; no tests run per review instructions.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
| const LEGACY_LOGS = ["dispatch-work-coordinator.jsonl"]; | ||
| const DEFAULT_MAX_RETRIES = 5; | ||
| // Contended ledgers routinely need 10+ fast-forward attempts; exponential backoff caps at 1 s, so 33 attempts bound a publication to ~30 s of sleep. | ||
| const DEFAULT_MAX_RETRIES = 32; |
There was a problem hiding this comment.
The retry default is shared by publishWorkQueueRequest and compactWorkQueueImpl, so this change also raises compaction from 6 attempts to 33. Compaction retries do not back off and each attempt rereads and validates the ledger, which can substantially increase API calls and contention under a checkpoint race. Please either give compaction an explicit, independently justified retry budget or add coverage/telemetry demonstrating that the larger shared default is safe for both publication paths.
There was a problem hiding this comment.
Publication keeps its larger retry budget; compaction now has an independent default of five retries, covered by a regression test. Commit: 24e9e77.
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. The change is a sound fix for CAS exhaustion, and the new test covers the stale fast-forward path. One behaviour change needs a decision before merge: the shared retry default also governs compaction.
📋 Key Themes & Highlights
Key Themes
- Shared default leaks into compaction:
DEFAULT_MAX_RETRIESalso drivescompactWorkQueueImpl, which has no backoff. Its attempts go from 6 to 33 with no delay. - Regression test asserts too much in one
it: the default-budget behaviour and the 128 bound are combined, so a failure in one hides the other. - Boundary not exercised: the 128 check only confirms validation accepts the value. It does not show the loop honours a 128-retry budget.
Positive Highlights
- ✅ Keeps the existing exponential backoff and caps it at 1 s, as the PR describes.
- ✅ The new test asserts exact delays (
[50, 100, 200, 400, 800, 1000×15]) and checks the replayed state, not just that publish succeeded. - ✅ The CI proof is verifiable: run 42767352887 succeeded on
b181560, which matches the PR head. - ✅ The
workflow_dispatchinputs keep 100k/1024 as defaults, so scheduled and push runs are unchanged.
Verification
- Ran the new regression test with
node --test(viawork_queue_store_checks.cjs): passes. - Could not run vitest: the npm registry is unreachable from this sandbox (TLS certificate error), so the
vitestsuites were not run.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| const LEGACY_LOGS = ["dispatch-work-coordinator.jsonl"]; | ||
| const DEFAULT_MAX_RETRIES = 5; | ||
| // Contended ledgers routinely need 10+ fast-forward attempts; exponential backoff caps at 1 s, so 33 attempts bound a publication to ~30 s of sleep. | ||
| const DEFAULT_MAX_RETRIES = 32; |
There was a problem hiding this comment.
[/diagnosing-bugs] This shared default also drives compactWorkQueueImpl, whose retry loop (around line 565) has no backoff sleep. Raising it to 32 lets compaction make up to 33 back-to-back read and CAS attempts, up from 6, with no delay between them. Give compaction its own budget, or add the same backoff there.
💡 Suggested change
const DEFAULT_MAX_RETRIES = 32;
const COMPACTION_MAX_RETRIES = 5;Then default maxRetries to COMPACTION_MAX_RETRIES in compactWorkQueueImpl so its behavior is unchanged.
@copilot please address this.
There was a problem hiding this comment.
Compaction now uses its own five-retry default; publication retains the 32-retry default. Added a test verifying compaction’s default attempt count. Commit: 24e9e77.
| assert.equal(state.claims.size, 2); | ||
| assert.equal(state.requests.get("local-grant").request.fingerprint, request.fingerprint); | ||
| }); | ||
| it("keeps retrying stale fast-forward CAS conflicts within the default budget and bounds explicit budgets at 128", async () => { |
There was a problem hiding this comment.
[/tdd] This it covers two behaviours: default-budget retries and the explicit 128 bound. Split it so each name reads as a specification, for example retries 20 consecutive stale fast-forward conflicts under the default budget and rejects explicit publication retry budgets above 128. A failure in one should not hide the other.
@copilot please address this.
There was a problem hiding this comment.
Split the default 20-conflict retry test from the explicit retry-budget validation and boundary tests. Commit: 24e9e77.
| const fake2 = fakeGitHub(initial); | ||
| const request2 = newRequest("explicit-retry-bound", "dispatch_next", dispatcher, { pool: "default", max_claims: 1, max_dispatches: 1, max_bytes: 49152 }); | ||
| await assert.rejects(publishWorkQueueRequest(options(fake2, request2, dispatcher, { maxRetries: 129 })), /publication retries/); | ||
| await publishWorkQueueRequest(options(fake2, request2, dispatcher, { maxRetries: 128 })); |
There was a problem hiding this comment.
[/diagnosing-bugs] This line only shows that 128 passes validation, since the publish succeeds on the first attempt with no conflicts. It does not show that the loop honors a 128-retry budget. Assert the boundary directly: with maxRetries: 128, 128 consecutive conflicts should still publish, and 129 should throw publication_unresolved. That exercises attempt <= maxRetries, which the validator check does not cover.
@copilot please address this.
There was a problem hiding this comment.
Added direct boundary tests: 128 consecutive conflicts succeed with 128 retries, while 129 conflicts exhaust that budget. Commit: 24e9e77.
There was a problem hiding this comment.
🟡 Changes recommended
The shared retry increase expands unpaced compaction retries, while deterministic publisher backoff can prolong collisions and repeat costly work under contention.
2 open issues
What changed in this PR
Improves gh-aw work-queue publication resilience under contention by increasing retry budgets while preserving the existing capped exponential backoff.
Changes:
- Raise default publication retries from 5 to 32 and the accepted maximum from 10 to 128.
- Give stress workers 64 retries, add manual profile inputs, and increase the pull-request lifecycle profile to 128 items.
- Add regression coverage for 20 consecutive conflicts and the retry-budget boundary.
| File | Description |
|---|---|
actions/setup/js/work_queue_stress_workflow.test.cjs |
Verify manual profile defaults and updated CI profile sizes. |
actions/setup/js/work_queue_store.cjs |
Increase the shared retry default and publication retry limit. |
actions/setup/js/work_queue_store_checks.cjs |
Test sustained conflict recovery and retry-limit validation. |
.github/workflows/work-queue-stress.yml |
Add manual profile inputs and expand pull-request stress coverage. |
.github/scripts/work-queue-stress-worker.cjs |
Increase stress-worker publication retries to 64. |
Review effort: Max (auto)
| const LEGACY_LOGS = ["dispatch-work-coordinator.jsonl"]; | ||
| const DEFAULT_MAX_RETRIES = 5; | ||
| // Contended ledgers routinely need 10+ fast-forward attempts; exponential backoff caps at 1 s, so 33 attempts bound a publication to ~30 s of sleep. | ||
| const DEFAULT_MAX_RETRIES = 32; |
| const LEGACY_LOGS = ["dispatch-work-coordinator.jsonl"]; | ||
| const DEFAULT_MAX_RETRIES = 5; | ||
| // Contended ledgers routinely need 10+ fast-forward attempts; exponential backoff caps at 1 s, so 33 attempts bound a publication to ~30 s of sleep. | ||
| const DEFAULT_MAX_RETRIES = 32; |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "b181560325781fe66557f4d9449ffc4794ffb16b",
"kind": "requested",
"schema_version": "1",
"state": "69380319910ba5d30637c5635b90502fc18718abf26b984cb6875a372cc83cf1",
"work": [
"7f3b39a3615219246b72bcbaec170b1f03862c516219b4bdce4916d14513cfa5",
"b3d97b697b16dceb141513939d5ad38393a4f696d129b182a5b91719051c5c18",
"b5c9d853c7b2d20476dc348b19e0dd589c390875c25c3b3af7403f50a6db856a",
"bbb878249c8e93fcb3c00860362a72f34d7d10c29d2001201bdb2f98a99b684f"
],
"workflow": "pr-sous-chef"
}
|
…n-budget Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
| } catch { | ||
| // Delivery settlement reports invalid immutable contracts. | ||
| } |
| const [owner, repo] = repository.split("/"); | ||
| const namespace = path.basename(claimArtifactPath("", factoryClaim)); | ||
| const branch = normalizeBranchName(config.branch || `assets/${process.env.GH_AW_WORKFLOW_ID || "work-queue"}`) + `/claims/${namespace}`; | ||
| const branch = normalizeBranchName(config.branch || `assets/${process.env.GH_AW_WORKFLOW_ID || "work-queue"}`) + `-claims/${namespace}`; |
|
Category: bug | Risk: medium | Priority: medium | Score: 63/100 (impact 34 + urgency 17 + quality 12)
|
|
🎉 This pull request is included in a new release. Release: |


Work Queue Stress was repeatedly exhausting its CAS publication retries when four workers contended on the same ledger. This keeps the existing exponential backoff and raises the attempt budget to cover the measured contention tail.
workflow_dispatchinputs for the main-sized profiles and raise the pull-request lifecycle profile from 16 to 128 items so PR CI exercises concurrent publishers.CI proof
Work Queue Stress run 42767352887 passed on commit
b181560325781fe66557f4d9449ffc4794ffb16bin 9m14s.Validation
make agent-report-progressnpx vitest run work_queue_store.test.cjs work_queue_telemetry.test.cjs work_queue_checkpoint.test.cjs work_queue_aw_bootstrap.test.cjs work_queue_stress_workflow.test.cjs— 115 tests passednode --test .github/scripts/work-queue-stress.test.cjs .github/scripts/work-queue-stress-summary.test.cjs— 26 tests passed