Skip to content

fix(workboard): ignore expired claims for owner capacity - #113325

Closed
shaoohh wants to merge 3 commits into
openclaw:mainfrom
shaoohh:codex/fix-workboard-expired-claim-capacity
Closed

shaoohh wants to merge 3 commits into
openclaw:mainfrom
shaoohh:codex/fix-workboard-expired-claim-capacity

Conversation

@shaoohh

@shaoohh shaoohh commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

[AI-assisted]

Closes #113252

What Problem This Solves

Fixes a Workboard starvation case where a reclaimable running card on one board could continue consuming its owner's global concurrency slot and prevent ready cards on another board from starting.

Why This Change Was Made

  • Reuse one claim-reclaimability predicate for store cleanup and dispatcher capacity accounting.
  • Treat the whole stale active state consistently: after the existing five-minute grace, a claimed card's stale running card status, running execution, and claim no longer reserve global owner capacity.
  • Preserve the slot through the grace boundary, including for a genuinely live running card.
  • Keep cleanup board-scoped; cross-board capacity selection does not mutate the stale card.

User Impact

Workboard fleets can resume same-owner work on another board after an abandoned running claim becomes reclaimable, without weakening the existing late-heartbeat grace period or requiring a cleanup pass on the stale card's board first.

Evidence

  • Final product head: 9f8c1a7853f0.
  • Canonical PR CI: run 30149971736 is green, including check-lint, check-dependencies, check-test-types, build artifacts, and required openclaw/ci-gate.
  • Exact-head real-runtime proof: secretless fork run 30150439792 passed on Ubuntu 24.04 in 6m44s. The redacted runtime artifact is retained by the workflow.
  • The proof-only commit 446e6a391104 has parent exactly equal to the final product head. Its workflow verifies that only .github/proof/workboard-113325-real-dispatch.ts and .github/workflows/proof-workboard-113325.yml differ, so proof assets are not part of this PR's product diff.
  • Focused regressions: extensions/workboard/src/dispatcher.test.ts passed 27/27 tests and extensions/workboard/src/store.test.ts passed 100/100 tests in the proof run.
  • Real behavior trace: a real WorkboardStore and SQLite database held a cross-board card with both status=running and execution=running. Thirty seconds before the reclaim boundary it still reserved capacity (started=0, worker_calls=0); after the full grace it released capacity and the ready same-owner card on the other board started exactly once, while the stale card/claim/execution remained untouched for its board-scoped cleanup path.
  • Persistence trace: the primary store was closed, SQLite was reopened through a new store, and the started target still had status=running, execution=running, and run_id=proof-run-113325.
  • The unit regression checks the exact boundary and +1 ms behavior; the wall-clock proof uses a 30-second pre-boundary margin to avoid hosted-runner scheduling flakes.
  • Fresh external Codex autoreview of the final product follow-up tree returned no accepted/actionable findings and judged the patch correct with 0.91 confidence.
  • The two proof-only files underwent repeated external autoreview. After addressing findings about boundary strength, close/reopen semantics, and runner timing margin, the final review returned no findings and judged the proof patch correct with 0.91 confidence.
  • Contributor code was not executed locally. Tests and real behavior proof ran in secretless fork GitHub Actions.

Changelog

No root changelog edit in this contributor PR; release-note context remains here for maintainer release assembly.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. labels Jul 24, 2026
@clawsweeper

clawsweeper Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 25, 2026, 5:00 AM ET / 09:00 UTC.

ClawSweeper review

What this changes

The PR makes Workboard ignore a card’s running state, execution, and claim for global owner-capacity accounting after the claim has passed the existing five-minute reclaim grace period, with regression coverage at the boundary.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

The patch appears to be a focused, coherent fix for the linked Workboard starvation report and includes strong exact-head runtime proof. It should remain open for maintainer review because its branch is behind current main; the supplied GitHub state says it is cleanly mergeable, but the intervening Workboard changes still need a current three-way review before landing.

Priority: P1
Reviewed head: 9f8c1a7853f01c98983c4dbecaa35e0276f5f723

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is narrowly scoped and has convincing runtime proof; the remaining merge-readiness task is a current-main refresh rather than a demonstrated defect.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR body provides exact-head, after-fix real behavior evidence using a real Workboard store and SQLite database, including the reclaim-boundary result and persisted started-card state.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR body provides exact-head, after-fix real behavior evidence using a real Workboard store and SQLite database, including the reclaim-boundary result and persisted started-card state.
Evidence reviewed 5 items Shared lifecycle predicate: The proposed change centralizes the existing five-minute claim-reclaim threshold in isWorkboardClaimReclaimable, then uses that same predicate in both store cleanup and dispatcher capacity accounting; this directly addresses divergent stale-claim semantics.
Capacity behavior: The dispatcher still counts active cards globally by owner, but excludes a card only when its claim is reclaimable, preserving capacity through the grace window while allowing cross-board recovery afterward.
Cleanup alignment: Store cleanup uses the same reclaimability predicate before treating a running card as claim-expired, so dispatch no longer has a separate expiry interpretation.
Findings None None.
Security None None.

How this fits together

The bundled Workboard plugin persists cards, running executions, and claims, then its dispatcher selects ready cards to start while enforcing global per-owner capacity. A claim’s reclaimability is used by board-scoped cleanup and now also determines whether a stale card blocks another board’s ready work.

flowchart LR
  A[Persisted cards and claims] --> B[Shared reclaimability rule]
  B --> C[Global owner capacity accounting]
  D[Ready cards on selected board] --> C
  C --> E[Workboard dispatcher]
  E --> F[Agent run starts]
  B --> G[Board-scoped stale cleanup]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind current main; although GitHub reports it cleanly mergeable, a final current-three-way review should confirm that no intervening Workboard dispatch or claim-lifecycle change changes the shared invariant.
  • Complete next step (P2) - No discrete repair is identified; the remaining action is ordinary maintainer review of the current three-way merge.
Agent review details

Security

None.

PR surface

Source +15, Tests +71. Total +86 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 22 7 +15
Tests 1 71 0 +71
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 93 7 +86

Review metrics

None.

Stored data model

Persistent data-model change detected: vector/embedding metadata: extensions/workboard/src/dispatcher.test.ts, vector/embedding metadata: extensions/workboard/src/dispatcher.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Rebase or inspect the exact current three-way merge, then land the narrow shared-predicate fix if the final Workboard dispatch and cleanup paths retain the same reclaimability boundary.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Rebase or inspect the exact current three-way merge, then land the narrow shared-predicate fix if the final Workboard dispatch and cleanup paths retain the same reclaimability boundary.

Do we have a high-confidence way to reproduce the issue?

Yes, from source and the supplied exact-head runtime trace: create a running card with a short-lived claim on one board, wait past the existing reclaim grace, then dispatch a ready card for the same owner on another board. The trace reports the pre-boundary block and post-boundary single start using a real SQLite-backed Workboard store.

Is this the best way to solve the issue?

Yes, subject to current-main merge review. Reusing the store’s existing reclaimability predicate is narrower and safer than adding a dispatcher-specific expiry rule, because it keeps cleanup and global capacity accounting on one lifecycle contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against aba0b12014a3.

Labels

Label justifications:

  • P1: A stale claim can prevent same-owner Workboard cards from starting across boards, making an active agent workflow appear to make no progress.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body provides exact-head, after-fix real behavior evidence using a real Workboard store and SQLite database, including the reclaim-boundary result and persisted started-card state.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head, after-fix real behavior evidence using a real Workboard store and SQLite database, including the reclaim-boundary result and persisted started-card state.

Evidence

What I checked:

  • Shared lifecycle predicate: The proposed change centralizes the existing five-minute claim-reclaim threshold in isWorkboardClaimReclaimable, then uses that same predicate in both store cleanup and dispatcher capacity accounting; this directly addresses divergent stale-claim semantics. (extensions/workboard/src/store-constants.ts:27, 9f8c1a7853f0)
  • Capacity behavior: The dispatcher still counts active cards globally by owner, but excludes a card only when its claim is reclaimable, preserving capacity through the grace window while allowing cross-board recovery afterward. (extensions/workboard/src/dispatcher.ts:235, 9f8c1a7853f0)
  • Cleanup alignment: Store cleanup uses the same reclaimability predicate before treating a running card as claim-expired, so dispatch no longer has a separate expiry interpretation. (extensions/workboard/src/store.ts:78, 9f8c1a7853f0)
  • Regression and runtime proof: The supplied PR body reports boundary coverage plus an exact-head real SQLite/Workboard trace: before the reclaim boundary the ready cross-board card did not start; after the grace period it started once while the stale card remained untouched for board-scoped cleanup. (extensions/workboard/src/dispatcher.test.ts:917, 9f8c1a7853f0)
  • Current merge state: Provided GitHub metadata reports the PR as mergeable but behind its base; this is a review-refresh concern rather than evidence that the merge would delete current-main behavior. (aba0b12014a3)

Likely related people:

  • shaoohh: Authored the focused Workboard dispatcher, store-constant, store, and regression-test changes in this PR; no independently verified current-main ownership history was available in this read-only environment. (role: proposed fix author and recent area contributor; confidence: low; commits: 31d02eda9b80, 24ca647d0618, 9f8c1a7853f0; files: extensions/workboard/src/dispatcher.ts, extensions/workboard/src/store.ts, extensions/workboard/src/store-constants.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase the branch or inspect the exact current three-way merge against main, then confirm the shared reclaimability invariant still covers both cleanup and owner-capacity selection.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-07-24T13:34:16.990Z sha 1f26658 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-25T06:30:04.041Z sha 31d02ed :: needs changes before merge. :: [P1] Exclude reclaimable running cards from capacity accounting
  • reviewed 2026-07-25T07:53:17.191Z sha 9f8c1a7 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-25T08:17:28.720Z sha 9f8c1a7 :: needs maintainer review before merge. :: none

shaoohh commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 24, 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: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@shaoohh
shaoohh force-pushed the codex/fix-workboard-expired-claim-capacity branch from 1f26658 to 31d02ed Compare July 24, 2026 16:42
@shaoohh
shaoohh marked this pull request as ready for review July 25, 2026 06:25
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 25, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 25, 2026

shaoohh commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 25, 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: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 25, 2026
@steipete

Copy link
Copy Markdown
Contributor

Thank you @shaoohh for investigating this and for the focused shared-reclaim-predicate solution. Your root-cause analysis directly informed the complete fix that has now landed on main in #114564 (ee9bc9a), with explicit attribution in the merged pull request and issue #113252.

The merged implementation keeps one canonical reclaimability rule for store cleanup and global owner-capacity accounting, preserves the existing five-minute running-worker heartbeat grace, and adds the genuine cross-board regression: the worker remains blocked exactly at the grace boundary and starts exactly once one millisecond afterward. It also adds owner-wide concurrency stress and passed the protected CI and runtime proof.

I’m closing this pull request only because its intended fix is now included in the merged change. Thanks again for the clear report, implementation, and useful test direction.

@steipete steipete closed this Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High-priority user-facing bug, regression, or broken workflow. plugin: workboard proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workboard dispatcher counts expired claims as occupied capacity, silently starving an agent fleet-wide

2 participants