Repository navigation
refactor(workboard): centralize dispatch owner selection - #130333
Conversation
Use one slot-owner policy for ready candidates and occupied workers while preserving heartbeat-reclaim grace. Remove the unused private KV store factory; doctor remains the legacy migration owner.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 4:02 PM ET / 20:02 UTC. ClawSweeper reviewWhat this changesThis PR centralizes Workboard dispatch and occupied-slot owner selection, removes an unused private KV-store factory, and updates ownership regression coverage. Merge readinessKeep open. Current main still has separate ready-card and occupied-slot owner selection, so this refactor is not obsolete; source review found no actionable patch defect. This is a protected maintainer PR and exact-head CI was still running. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherWorkboard persists task cards in SQLite and dispatches ready cards to subagent workers. Owner selection feeds both the capacity check for existing work and the claim used before a new worker starts. flowchart LR
Cards[Persisted Workboard cards] --> Claims[Claims and expiry]
Claims --> Owner[Owner selection]
Cards --> Owner
Owner --> Capacity[Occupied-slot check]
Owner --> Dispatch[Ready-card dispatch]
Capacity --> Dispatch
Dispatch --> Runs[Subagent runs]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -41, Tests +37, Other 0. Total -4 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land one canonical owner-selection helper after exact-head CI confirms the refactor, keeping dispatch-time expiry distinct from occupied-slot reclaim grace and retaining SQLite as the sole runtime store. Do we have a high-confidence way to reproduce the issue? Not applicable as a standalone report: this is a behavior-preserving refactor, although the added in-memory boundary test credibly demonstrates the blank-assignment capacity regression it guards. Is this the best way to solve the issue? Yes. Moving ready-card selection into the existing slot-owner policy removes duplicate ownership logic while preserving the intentionally different expiry treatment for dispatch and reclaim grace. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8585e7e04eef. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready verification for OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs extensions/workboard/src/dispatcher-ownership.test.ts extensions/workboard/src/dispatcher.test.ts extensions/workboard/src/dispatcher.races.test.ts extensions/workboard/src/dispatcher-compensation.test.ts extensions/workboard/src/store.test.ts extensions/workboard/src/sqlite-store-policy.test.ts extensions/workboard/src/lifecycle-sync.test.ts extensions/workboard/src/lifecycle-sync.restart.test.ts extensions/workboard/src/lifecycle-sync.cleanup-recovery.test.ts extensions/workboard/doctor-contract-api.test.ts
node scripts/check-changed.mjs -- config/assertion-safety-baseline.txt extensions/workboard/src/dispatcher-ownership.test.ts extensions/workboard/src/dispatcher.ts extensions/workboard/src/store-constants.ts extensions/workboard/src/store.tsAll 288 tests and the complete changed gate passed with matching dependencies, including real SQLite, lifecycle, restart, race, cleanup and migration behavior. A separate reviewer reran30 owner cases and inspected the exact committed boundary; fresh structured Codex P1 review is clean. Model/subagent acceptance is fixture controlled, not authenticated provider proof. The in-memory blank-assignment regression fails before and passes after, but SQLite already normalizes empty assignment values: this is not a new SQLite operator-bug claim. Exact-head CI is green: https://github.com/openclaw/openclaw/actions/runs/33007779554 . Current-main owner files remain unchanged relative to the reviewed base. There is no completed ClawSweeper review/rank-up list at this checkpoint; a queued publisher is not being treated as approval or as a blocker. Independent review and the native exact-head gates remain the landing authority under the maintainer's explicit autonomous direction. |
|
Merged via squash.
|
…0333) Use one slot-owner policy for ready candidates and occupied workers while preserving heartbeat-reclaim grace. Remove the unused private KV store factory; doctor remains the legacy migration owner.
Related: #115119
What Problem This Solves
Workboard used separate owner-selection logic when choosing ready tasks and when counting occupied worker slots. Its private store also retained an unused KV constructor after runtime registration moved to SQLite.
Why This Change Was Made
Use one private owner selector for dispatch and occupied-slot checks. Ready tasks ignore expired claims; occupied tasks retain their claim owner through the existing heartbeat-reclaim grace period. Delete the unused private KV factory and its unused attachment-entry cap. Doctor's legacy KV migration and the canonical SQLite runtime remain unchanged.
Production LOC: +14/-55 (net -41). Tests: +70/-33 (net +37). The assertion baseline shrinks from 5 to 1 only because four assertions were deleted with the dead constructor. No schema, migration, config, or public API change.
User Impact
No intended SQLite behavior change. Worker selection and occupied-slot accounting now share one policy while preserving claim expiry and reclaim behavior. The blank-assignment regression covers the in-memory store boundary; SQLite already normalizes empty assignment values, so this is not presented as a new reachable SQLite bug.
Evidence
099bd5a64aee6f0e41a358a9085cdb392f78f2aa.