Skip to content

fix(publish): defer active review lease collisions - #715

Merged
brokemac79 merged 4 commits into
mainfrom
codex/csw-049-active-lease-publication
Jul 20, 2026
Merged

brokemac79 merged 4 commits into
mainfrom
codex/csw-049-active-lease-publication

Conversation

@brokemac79

@brokemac79 brokemac79 commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Defer a publisher that collides with a verified same-revision ClawSweeper review lease, then requeue it at that lease's expiry. This prevents a known temporary coordination state from being reported as a generic publication failure and consuming publisher capacity repeatedly.

Problem and causal proof

At the incident peak, review generation continued while result publication was saturated: all 32 publisher slots were leased and pending work grew. The representative lifecycle was:

same-head/same-revision ClawSweeper review is active until <expiry>
  -> apply-decisions records kept_open
  -> publish-event-result throws "was not applied; actions: kept_open"
  -> durable queue records a generic failure and retries

The lease guard itself was introduced by #462 (d43deab4b78d0e58ecc7525cef175106b2fc559d), but it is a correct safety invariant. Its publisher classification was latent until same-revision review overlap occurred; it is not evidence that the July 10 merge immediately caused the later backlog.

The same signature, including workflow URLs, was recorded in #635 on July 16, before #707 and #712. That excludes timing-only attribution to #712: #712 repairs unavailable state objects in ledger publication, and #714 repairs remote-known ledger trees. Neither changes the active-review kept_open lifecycle.

Thanks to Peter Steinberger for the lease invariant in #462 and the independent ledger recovery work in #712/#714, and to @brokemac79 for the incident evidence in #635.

Scope and implementation

  • Carry a typed, verified active-review lease expiry from apply-decisions into the exact-event apply proof. Only a sole kept_open result from the live lease guard qualifies.
  • Bound the retry timestamp to 110 minutes, inside the queue's two-hour acceptance window.
  • Emit retryable_failure/review_lease_active from the publisher, while completing the workflow successfully so it is not classified as GitHub pressure or an unknown publisher failure.
  • Preserve that typed retry through the generic workflow completion normalizer; without this final narrow guard, it would be overwritten as superseded/live_terminal and removed instead of deferred.
  • Let the durable queue accept the typed completion, retain the artifact, and schedule it for lease expiry without capacity-control failure feedback.
  • Avoid reporting the command as failed for this typed deferral; update it to Waiting only after durable completion succeeds.

This deliberately does not change queue capacity, retry budgets, the dashboard, dispatch/gates, or unrelated kept_open reasons.

Validation

All executable proof ran through Docker-backed local Crabbox (mcr.microsoft.com/playwright:v1.60.0-noble). The final functional proof used lease cbx_d9709b7b46bb:

corepack pnpm install --frozen-lockfile
./node_modules/.bin/tsc -p tsconfig.json
./node_modules/.bin/tsc -p tsconfig.repair.json
./node_modules/.bin/tsc -p tsconfig.dashboard.json
./node_modules/.bin/oxlint src ...
./node_modules/.bin/oxlint src/repair ...
./node_modules/.bin/oxlint scripts test ...
./node_modules/.bin/oxlint dashboard ...
node --test test/repair/event-apply-proof.test.ts test/dashboard-worker.test.ts

Result: all builds and four lint surfaces clean; 171 focused tests passed. The explicit workflow contract proves the repair lifecycle: verified active lease -> typed retry with timestamp -> preserved past generic normalization -> queue retry timestamp -> successful completion reaches Waiting.

Scoped Actionlint on the changed workflow passed in Crabbox lease cbx_749bcda5a05b:

actionlint -shellcheck= -ignore 'unexpected key "queue" for "concurrency" section' .github/workflows/sweep.yml

git diff --check passed. Baseline noise: repository-wide Actionlint also reports custom Blacksmith/Crabbox runner labels in unrelated workflows; the raw Windows test/sweep-workflow.test.ts suite lacks jq for an unrelated Bash fixture. The exact changed workflow assertion passed during Codex review. The synced Windows checkout also has pre-existing mixed/CRLF formatting differences, so no broad formatter rewrite is included.

Codex review closeout:

  • codex review --uncommitted found the completion-normalizer overwrite; it was fixed, Docker proof was rerun, and the final dirty review was clean with no actionable findings.
  • codex review --base origin/main was clean with no actionable findings for head dd68cdb4762b1e8812c5766129e7580384c5f08f.

Risks and rollout

The live review lease remains authoritative: this delays publication rather than overriding, dropping, or duplicating a review. A malformed or unverified lease result still follows the existing failure path. The only new typed queue completion is review_lease_active; it neither reports a GitHub failure kind nor increases capacity.

Normal CI for this head is pending. After deployment, monitor publisher pending depth, lease utilization, net drain, and review_lease_active completions. Do not merge automatically; this requires Martin's explicit merge decision.

@brokemac79
brokemac79 requested a review from a team as a code owner July 20, 2026 09:22
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@brokemac79
brokemac79 merged commit f509393 into main Jul 20, 2026
11 checks passed
@brokemac79
brokemac79 deleted the codex/csw-049-active-lease-publication branch July 20, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant