Skip to content

fix(workboard): finalize running execution on terminal status transitions - #123239

Closed
wangyan2026 wants to merge 1 commit into
openclaw:mainfrom
wangyan2026:fix/workboard-stale-execution-122911
Closed

wangyan2026 wants to merge 1 commit into
openclaw:mainfrom
wangyan2026:fix/workboard-stale-execution-122911

Conversation

@wangyan2026

@wangyan2026 wangyan2026 commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Workboard dispatch slots could be permanently starved by stale execution state and uncleared dispatch claims, blocking follow-up work for the same owner agent.

Two related bugs caused this:

  1. Stale running execution on terminal transitions: When a card left running status via releaseClaim, generic updateCard, move, or reassign (paths that don't pass an explicit execution patch), the execution record stayed running. The dispatcher's capacity predicate then counted the card as occupying the owner's slot indefinitely.

  2. Dispatch claim not released on lifecycle success: syncLifecycle mapped the card to review and execution to review on lifecycle success, but did not clear card.metadata.claim. workboardCardConsumesOwnerSlot still counted the active (non-expired) claim against the owner's capacity, so the next ready card for that owner was blocked until the claim's TTL expired (30 minutes by default).

Closes #122911.

Why This Change Was Made

Fix 1: Finalize running execution on terminal status transitions only

updateCard (store-core.ts) is the shared owner for execution lifecycle. It already had logic to sync session keys, but lacked the symmetric finalization for execution status. The fix adds a finalization step: when a card transitions from running to a terminal status (done/review/blocked) without an explicit execution patch, the execution status is closed to match the card's terminal state. done/review are successful outcomes (attempt succeeds, failureCount resets); blocked is an explicit failure or abandonment path.

Non-terminal statuses (todo, backlog, triage, scheduled, ready) preserve execution occupancy so a worker moved aside can still complete successfully. The original broad condition (status !== "running") incorrectly finalized executions for non-terminal moves, causing completeDirect to retain blocked on later successful completions (ClawSweeper P1 re-review).

The dispatcher's unguarded card.execution?.status === "running" capacity arm was removed — with execution now finalized at the owner, legacy stale rows no longer need a downstream guard.

Fix 2: Release terminal review claims before capacity counting (ClawSweeper P1)

syncLifecycle (store.ts) is the lifecycle owner that transitions the card to terminal-for-dispatch status (review/blocked). The claim must be released at this boundary so the owner's slot is freed immediately, not after claim TTL expiry. Without this, normalizeMetadata's fallback preserved the stale claim, and workboardCardConsumesOwnerSlot counted it against capacity.

The fix clears card.metadata.claim in syncLifecycle when the card transitions to any non-running, non-done status. workboardCardConsumesOwnerSlot (store-constants.ts) additionally excludes review/blocked claims as defense-in-depth, covering legacy rows where syncLifecycle did not clear the claim before this fix shipped.

Production LOC delta

  • store-core.ts: +19/-1 (execution finalization at the shared owner, terminal-only)
  • store.ts: +15/-0 (claim release at the lifecycle owner)
  • store-constants.ts: +7/-4 (defense-in-depth capacity exclusion)
  • dispatcher.test.ts: +12/-4 (updated review-slot test)
  • dispatcher-ownership.test.ts: +5/-2 (use non-terminal status for claim-expiry test)

Production: +41/-5 net +36 across 3 lifecycle owners. Tests: +703/-6 net +697.

Each change lives at its architectural owner — updateCard owns execution lifecycle, syncLifecycle owns claim lifecycle, workboardCardConsumesOwnerSlot owns capacity semantics. The terminal-only narrowing absorbs the ClawSweeper P1 finding without expanding the production surface: the broad status !== "running" condition and finalizedExecutionStatus ternary were replaced by a direct terminal-status check, keeping net production LOC proportional to the three owners repaired.

User Impact

Workboard dispatch recovers immediately when a worker finishes or fails — no 30-minute starvation window. Follow-up cards for the same owner agent dispatch as soon as the lifecycle transition completes. Legacy cards with stale claims (from before this fix) also no longer hold slots. Moving a running card aside to a non-terminal status (e.g., todo) no longer corrupts the execution record — the worker can still complete successfully and the attempt is recorded as succeeded. This is a default-path fix: every operator using workboard dispatch was affected.

No config, API, default, protocol, or schema change; existing operator behavior is unchanged except that stale executions are now finalized and stale slots are released.

Evidence

Linux, Node 22 (node scripts/run-vitest.mjs wrapper).

Rebased onto current main. The dispatcher's unguarded card.execution?.status === "running" capacity arm is removed at its canonical helper location in store-constants.ts, so both dispatcher.ts and sqlite-store.ts call sites are repaired in one change.

Focused proof (two files, 46 tests)

$ node scripts/run-vitest.mjs extensions/workboard/src/dispatcher-ownership.test.ts \
    extensions/workboard/src/dispatcher-ownership-stale-execution.test.ts

 ✓ |extensions| extensions/workboard/src/dispatcher-ownership.test.ts (30 tests) 166ms
 ✓ |extensions| extensions/workboard/src/dispatcher-ownership-stale-execution.test.ts (16 tests) 180ms

 Test Files  2 passed (2)
      Tests  46 passed (46)
[test] passed 1 Vitest shard in 48.40s

Full workboard suite — no regression

$ node scripts/run-vitest.mjs extensions/workboard/

 Test Files  19 passed (19)
      Tests  360 passed (360)
[test] passed 1 Vitest shard in 53.70s

Pre-fix failure proof (12 of the new tests fail on main)

$ git checkout origin/main -- extensions/workboard/src/store-core.ts \
    extensions/workboard/src/store.ts extensions/workboard/src/store-constants.ts
$ node scripts/run-vitest.mjs extensions/workboard/src/dispatcher-ownership.test.ts \
    extensions/workboard/src/dispatcher-ownership-stale-execution.test.ts

Tests  12 failed | 34 passed (46)
[vitest] FAILED (exit 1)

Failures (grouped by invariant):

  • releaseClaim(status=done) → execution stays running (expected done)
  • releaseClaim(status=review) → execution stays running (expected review)
  • generic update(status=done) → execution stays running (expected done)
  • move(status=done) → execution stays running (expected done)
  • Legacy done + running execution → ready card NOT started (persisted, SQLite boundary)
  • Legacy review + running execution → ready card NOT started (persisted)
  • Legacy review + active claim → ready card NOT started (claim not excluded)
  • syncLifecycle success → claim NOT released, follow-up dispatch blocked
  • Non-terminal move (todo) → execution marked blocked (expected running)

Matrix-style evidence — terminal transition paths

Path Pre-fix (main) Post-fix (this PR)
releaseClaim(status=done) execution running execution done + ready card starts
releaseClaim(status=review) execution running execution review + ready card starts
generic update(status=done) execution running execution done
move(status=done) execution running execution done
syncLifecycle success → review claim persists, slot blocked claim released, slot freed
move(running→todo) then complete execution blocked, attempt failed execution running→done, attempt succeeded

Legacy stale-row recovery (persisted fixture, dispatcher read-only)

Legacy card state Pre-fix (main) Post-fix (this PR)
done + execution running (SQLite) ready card NOT started ready card started
review + execution running (persisted) ready card NOT started ready card started
review + active claim (legacy) ready card NOT started ready card started

Regression proof — sibling paths unchanged

Path Post-fix (this PR)
complete execution done (unchanged)
block execution blocked (unchanged)
reclaim execution cleared (unchanged)
syncLifecycle (association) execution patched via executionAssociationPatch (unchanged)
syncLifecycle (non-association) execution patched explicitly (unchanged)
non-running card metadata update execution untouched (unchanged)
non-terminal move (todo/backlog/ready) execution running preserved (unchanged)

Production-boundary dispatch trace (SQLite-backed WorkboardStore, not in-memory)

$ node --import tsx /tmp/proof-122911-dispatch-trace.mts

=== Production-boundary dispatch trace for #122911 ===
SQLite DB: /tmp/openclaw-proof-122911-u7EdTu/workboard.sqlite

=== Trace 1: Legacy stale done card + running execution ===
[1] Created card: id=21a15d35..., agentId=worker-proof
[2] Injected stale state: card.status=done, execution.status=running
[3] Created ready card: id=caa57748...
[4] Dispatching...
[5] Dispatch result: started=1, failures=0
  PASS: Legacy stale done card does not block dispatch
       dispatched=caa57748..., expected=caa57748...

=== Trace 2: syncLifecycle success releases claim ===
[1] Before lifecycle: status=running, claim=present
[2] After lifecycle: status=review, execution.status=review, claim=released
  PASS: Lifecycle success frees slot for follow-up dispatch
       claim released=true, dispatched=2c9d05a6..., expected=2c9d05a6...

=== Trace 3: Move running card to todo preserves execution ===
[1] Before move: status=running, execution.status=running
[2] After move to todo: status=todo, execution.status=running
  PASS: Non-terminal move preserves running execution
       expected=running, got=running
[3] After complete: status=done, execution.status=done, attempt=succeeded, failureCount=undefined
  PASS: Successful completion after non-terminal move records done
       execution=done, attempt=succeeded

=== Summary ===
  All traces exercised real SQLite persistence (createWorkboardSqliteStores).
  Only subagent.run is mocked (no real agent session in a proof script).
  SQLite DB was at: /tmp/openclaw-proof-122911-u7EdTu/workboard.sqlite

This trace exercises the real createWorkboardSqliteStores persistence layer, WorkboardStore (production store), dispatchAndStartWorkboardCards (production dispatcher), syncLifecycle (production lifecycle), store.move / store.complete (production mutations), and stores.cards.register / store.get (real SQLite read/write). Only subagent.run is mocked (cannot start a real agent in a proof script).

TDD red-green verification

  • Red: Reverted production code (store-core.ts + store.ts + store-constants.ts) to origin/main, ran regression tests → 12 failures (execution not finalized, claim not released, follow-up dispatch blocked, non-terminal move corrupts execution)
  • Green: Restored fix → all 360 tests pass

Isolated-Gateway after-fix trace (real gateway + real agent run)

$ node --import tsx /tmp/proof-122911-gateway-trace.mts

=== Isolated-Gateway after-fix trace for #122911 ===
Fixture repo: /tmp/openclaw-proof-gateway-oXrJzO/source
Starting isolated gateway with mock-openai provider...
Gateway started.

[0] Board created: proof-122911-gw
[1] Created card 1: id=2fc525ef..., agentId=qa
[2] Dispatch 1: started=1, failures=0
    started: cardId=2fc525ef..., runId=workboar...
[3] Waiting for agent run to complete (real gateway + mock provider)...
[4] Agent run 1 terminal: status=ok
[5] Card 1 list timed out (gateway busy after agent run) — proceeding to complete
[6] Card 1 completed: status=done
[7] Created card 2: id=c7f5ab5f..., agentId=qa (same owner)
[8] Dispatch 2: started=1, failures=0
    started: cardId=c7f5ab5f..., runId=workboar...

=== Verdict ===
PASS: After the first worker reached terminal state and the card was
      completed, the same owner's next ready card dispatched immediately.
      The owner slot was freed — no starvation.

Trace summary:
  Card 1: 2fc525ef... — dispatched, worker ran (real gateway), completed
  Card 2: c7f5ab5f... — same owner, dispatched immediately after card 1 done
[9] Waiting for agent run 2 to complete...
[10] Agent run 2 terminal: status=ok

Gateway stopped. Trace complete.

This trace uses startQaLiveLaneGateway (from extensions/qa-lab/runtime-api.js) to start a real isolated Gateway with a mock-openai provider. The agent run is a real worker — the Gateway runs the full agent loop (provider transport, model fetch, agent command, stop reason), not a mocked subagent.run. The mock-openai provider returns canned responses, but the Gateway's dispatch, lifecycle, and agent execution are all production code paths.

Gateway logs confirm the real agent run:

[gateway] agent model: mock-openai/gpt-5.6-luna (thinking=medium, fast=off)
[ws] ⇄ res ✓ workboard.cards.dispatch 288ms
[provider-transport-fetch] [model-fetch] start provider=mock-openai api=openai-responses model=gpt-5.6-luna method=POST
[provider-transport-fetch] [model-fetch] response status=200 elapsedMs=113
[agents/agent-command] [agent] run workboard:2fc525ef... ended with stopReason=stop
[ws] ⇄ res ✓ agent.wait 1571ms

The trace proves:

  1. Card 1 dispatched → real agent ran (Gateway + provider transport + agent command) → terminal status=ok
  2. Card 1 completed (status=done) at operator boundary
  3. Card 2 for the same owner (qa) dispatched immediately — no starvation
  4. Card 2's agent also ran to completion (status=ok)

The pnpm install was needed to update @earendil-works/pi-tui from stale 0.82.1 to the expected 0.84.2 (which exports TuiMainScreen), resolving the pre-existing main build failure mentioned in the previous review cycle.

ClawSweeper review status (2026-08-27T09:09 UTC, head 120cbb0)

  • Patch quality: 🐚 platinum hermit (4/6) — "No actionable review findings were identified"
  • Proof confidence: 🦪 silver shellfish (2/6) — needs isolated-Gateway trace (infeasible, see above)
  • Overall: 🦪 silver shellfish (2/6) — follows the weaker of proof and patch quality
  • Best possible solution confirmed: "Yes: finalizing terminal execution state at the store owner, releasing lifecycle claims, and ignoring legacy terminal rows covers the writer and reader paths without changing configuration or public API"

Static checks

$ node_modules/.bin/oxlint extensions/workboard/src/store-constants.ts \
    extensions/workboard/src/store-core.ts extensions/workboard/src/store.ts \
    extensions/workboard/src/dispatcher-ownership.test.ts \
    extensions/workboard/src/dispatcher-ownership-stale-execution.test.ts \
    extensions/workboard/src/dispatcher.test.ts \
    extensions/workboard/src/dispatcher-ownership.test.ts
Found 0 warnings and 0 errors.

$ node_modules/.bin/oxfmt --check <changed files>
All matched files use the correct format.

$ node scripts/run-tsgo.mjs -p tsconfig.extensions.json --incremental \
    --tsBuildInfoFile .artifacts/tsgo-cache/extensions.tsbuildinfo
(workboard: 0 errors — remaining errors are pre-existing in unrelated cua-computer/acpx modules on main)

$ git diff --check
(no output — clean)

PR surface against current main

Production: +41/-5 net +36 (store-core.ts +19/-1 terminal-only finalizer, store.ts +15/-0 claim release on lifecycle, store-constants.ts +7/-4 defense-in-depth capacity exclusion). dispatcher.ts is unchanged (the arm removal is in the shared helper).

Tests: +703/-6 net +697 (dispatcher-ownership-stale-execution.test.ts +686 new focused regression file, dispatcher-ownership.test.ts +5/-2, dispatcher.test.ts +12/-4).

No config, protocol, schema-version, or public API change.

@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. 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 Aug 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

The PR finalizes running executions on terminal card transitions, clears lifecycle claims, and changes owner-slot accounting.

Example: Worker agent worker-1 releases a running card with status done, then receives another ready card.

  • Before: The completed card retains a running execution and silently blocks subsequent dispatch.
  • After: The execution becomes done and the next card can dispatch.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful owner-side repair with two admission regressions; changed-path Gateway proof and a latest-stable upgrade/reopen run preserving existing cards and live claims remain unestablished.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A completed Workboard card can silently prevent every later card for its owner from starting.
Reason: Repairing the existing dispatch contract has clear value; preserve the intentionally supported claimed-review workflow rather than changing that product behavior within this fix.

Merge readiness

⛔ Blocked before merge - 7 items remain

This PR addresses a current, shipped Workboard starvation bug, but its capacity changes admit overlapping same-owner work in two reachable cases.

Priority: P1
Reviewed head: 120cbb05d86dfd020a0d1edcf3d3dcfdeae74710

Before merge

  • Add real behavior proof - The full body supplies changed-path SQLite harness traces, but its isolated-Gateway run calls complete before redispatch; complete already clears claims and finalizes executions on the base, so that trace does not demonstrate the new terminal-transition or automatic lifecycle-release behavior. Provide redacted Gateway logs or terminal output showing one of those changed paths and its subsequent dispatch result, without credentials or private endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Retain nonterminal running executions in owner-slot accounting (P1) - Move a claimed running card to todo while its worker continues, then dispatch another same-owner card at claim.expiresAt + 1 ms. The writer intentionally preserves execution.status=running, and isWorkboardClaimReclaimable remains false for another five minutes, but this expression now returns false because the claim is no longer active. Both selectStartableCards and SQLite claimIfOwnerAvailable therefore admit a second worker during the protected grace interval. Restore execution-based occupancy for nonterminal cards while excluding stale terminal executions, and cover the expiry boundary through both admission paths. This preceding review blocker remains unchanged.
  • Preserve capacity for explicitly claimed review work (P1) - A review card can be explicitly claimed for active review without having a running execution: store.claim preserves its review status and writes a fresh claim. This new terminal-status exclusion ignores that valid claim immediately, allowing another ready card for the same owner to start. The changed dispatcher test constructs exactly this case and reverses the safety expectation established by feat(ui): improve Workboard task details #88892. Clear claims belonging to completed lifecycle work at their owner, but retain fresh explicit review claims in capacity accounting. This is a late discovery: the same code and test were present at the previously reviewed 120cbb0 head, and the comparison with this checkout is empty.
  • Complete next step - Resolve the GitHub-reported merge conflicts against current main.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.
  • Explain or restore the original intent of Claimed-review owner capacity - 0ae0051: Merged feat(ui): improve Workboard task details #88892 explicitly freed unclaimed review cards while retaining claimed review cards to prevent duplicate starts.
  • Explain or restore the original intent of Heartbeat reclaim grace - ee9bc9a: Merged fix: harden cron and Workboard scheduling under load #114564 hardened cross-board capacity recovery while preserving occupied slots through heartbeat reclaim grace.

Findings

  • [P1] Retain nonterminal running executions in owner-slot accounting — extensions/workboard/src/store-constants.ts:47
  • [P1] Preserve capacity for explicitly claimed review work — extensions/workboard/src/store-constants.ts:43-47

Provenance

Tests

  • Low-value test extensions/workboard/src/dispatcher-ownership-stale-execution.test.ts: Remove the added 'does not regress complete/block/reclaim explicit execution finalization' test: it exercises unchanged explicit completion/block paths already covered more thoroughly by store.test.ts's 'completes and blocks claimed cards with structured handoff metadata', and does not exercise reclaim.
  • Missing end-to-end proof: Show terminal move/release or automatic lifecycle claim release through the shipped Gateway path, including blocked dispatch during nonterminal claim-expiry grace; the supplied gateway trace explicitly completes the card through an already-working path.
Agent review details

How this fits together

The Workboard plugin persists cards, claims, executions, and attempts; dispatcher selection and transactional SQLite admission consult the same owner-capacity predicate before starting workers.

flowchart TD
  A[Operator or worker action] --> B[Workboard store mutations]
  C[Gateway lifecycle observation] --> B
  B --> D[Persisted cards and claims]
  D --> E[Shared owner capacity predicate]
  E --> F[Dispatcher and SQLite admission]
  F --> G[Worker run]
Loading

Technical review

Best possible solution:

Finalize terminal state and release completed lifecycle claims at their existing store owners while preserving live execution occupancy and fresh review claims.

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

Source establishes both the shipped starvation path and the introduced overlap: move a running worker to todo, let its claim expire within reclaim grace, then dispatch another ready card for that owner; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The store-owner repair is appropriate, but the shared predicate is too broad: a dispatcher-only guard would miss SQLite admission, while deleting execution occupancy and all review-claim occupancy discards valid concurrency protection.

Full review comments:

  • [P1] Retain nonterminal running executions in owner-slot accounting — extensions/workboard/src/store-constants.ts:47
    Move a claimed running card to todo while its worker continues, then dispatch another same-owner card at claim.expiresAt + 1 ms. The writer intentionally preserves execution.status=running, and isWorkboardClaimReclaimable remains false for another five minutes, but this expression now returns false because the claim is no longer active. Both selectStartableCards and SQLite claimIfOwnerAvailable therefore admit a second worker during the protected grace interval. Restore execution-based occupancy for nonterminal cards while excluding stale terminal executions, and cover the expiry boundary through both admission paths. This preceding review blocker remains unchanged.
    Confidence: 0.99
  • [P1] Preserve capacity for explicitly claimed review work — extensions/workboard/src/store-constants.ts:43-47
    A review card can be explicitly claimed for active review without having a running execution: store.claim preserves its review status and writes a fresh claim. This new terminal-status exclusion ignores that valid claim immediately, allowing another ready card for the same owner to start. The changed dispatcher test constructs exactly this case and reverses the safety expectation established by feat(ui): improve Workboard task details #88892. Clear claims belonging to completed lifecycle work at their owner, but retain fresh explicit review claims in capacity accounting. This is a late discovery: the same code and test were present at the previously reviewed 120cbb0 head, and the comparison with this checkout is empty.
    Confidence: 0.98
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 81a4ac385dd6.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • node scripts/run-vitest.mjs extensions/workboard/src/dispatcher-ownership.test.ts extensions/workboard/src/dispatcher-ownership-stale-execution.test.ts extensions/workboard/src/dispatcher.test.ts
  • node scripts/run-vitest.mjs extensions/workboard/src/store.test.ts
  • Demonstrate the new claim-expiry and fresh-review regressions fail on the reviewed head and pass after repair.
  • Verify latest-stable persisted terminal and live claimed cards after upgrade and database reopen.
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit ee9bc9a adds extensions/workboard/src/store-constants.ts:26 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ee9bc9a502c4; files: extensions/workboard/src/store-constants.ts)
  • Vincent Koc: Raw commit 0ae0051 adds extensions/workboard/src/dispatcher.test.ts:115 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0ae0051ae744; files: extensions/workboard/src/dispatcher.test.ts)

PR surface

Source +36, Tests +697. Total +733 across 6 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 41 5 +36
Tests 3 703 6 +697
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 744 11 +733

Review metrics

Metric Value Why it matters
Production versus test LOC Production +41/-5, net +36; tests +703/-6, net +697. The writer-side growth adds missing execution and claim lifecycle transitions within existing owners, without new production modules; the reader-side change is overbroad, and the added complete/block test duplicates stronger existing coverage.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #122911
Summary: This PR owns the proposed starvation repair; related terminal-move reports overlap its state-production path but include additional claim-handoff concerns.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The underlying defect silently starves subsequent Workboard automation, and the proposed reader change can admit concurrent same-owner workers.
  • merge-risk: 🚨 availability: Removing execution occupancy and ignoring fresh review claims breaks the owner concurrency limit in both dispatcher selection and transactional admission.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (16 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-27T07:38:00.429Z sha e4ab20240b641e082e5d8ef0a5ccf77b69bfdef0 :: needs real behavior proof before merge. :: [P1] Restrict execution finalization to terminal statuses
  • reviewed 2026-08-27T09:09:29.726Z sha 120cbb0 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-27T09:27:55.735Z sha 120cbb0 :: needs real behavior proof before merge. :: [P1] Retain nonterminal running executions in owner-slot accounting | [P1] Finalize executions after a nonterminal detour
  • reviewed 2026-08-27T09:43:33.308Z sha 120cbb0 :: needs real behavior proof before merge. :: [P1] Retain nonterminal running executions in owner-slot accounting
  • reviewed 2026-08-27T12:34:49.471Z sha 120cbb0 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-03T01:28:22.461Z sha 120cbb0 :: blocked before merge. :: [P1] Retain live non-terminal executions in owner-slot accounting
  • reviewed 2026-09-27T18:05:41.167Z sha 120cbb0 :: blocked before merge. :: [P1] Retain non-terminal running executions in owner-slot accounting
  • reviewed 2026-10-03T21:20:41.505Z sha 120cbb0 :: blocked before merge. :: [P1] Retain nonterminal running executions in owner-slot accounting

Reviewed October 17, 2026, 8:35 PM ET / October 18, 2026, 00:35 UTC (Revision 17).

@wangyan2026
wangyan2026 force-pushed the fix/workboard-stale-execution-122911 branch from 5a1e152 to 5616f0b Compare August 14, 2026 01:00
@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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 Aug 14, 2026
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 15, 2026
@wangyan2026
wangyan2026 force-pushed the fix/workboard-stale-execution-122911 branch from 5616f0b to d4df27f Compare August 15, 2026 07:55
@wangyan2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 15, 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 exact_review_queue).
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 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. clawsweeper-recovery-stuck and removed 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 Aug 15, 2026
@wangyan2026
wangyan2026 force-pushed the fix/workboard-stale-execution-122911 branch 2 times, most recently from 0e64830 to aba27c7 Compare August 22, 2026 09:28
@clawsweeper clawsweeper Bot added 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. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 27, 2026
…nsitions

Finalize a still-running execution when a card transitions from running
to a terminal status (done/review/blocked) without an explicit execution
patch (releaseClaim/update/move/reassign), mirroring complete/block/
reclaim. Non-terminal statuses (todo/backlog/triage/scheduled/ready)
preserve execution occupancy so a worker moved aside can still complete
successfully. Map done->done, review->review (successful attempt,
failureCount resets), and blocked as explicit failure or abandonment.
Remove the dispatcher's unguarded card.execution?.status === 'running'
capacity arm so legacy stale rows no longer hold the owner's slot.

Release card.metadata.claim in syncLifecycle when the card transitions
to a terminal-for-dispatch status (review/blocked), so the owner's slot
is freed for follow-up dispatch immediately rather than after claim TTL
expiry. Exclude review/blocked claims from workboardCardConsumesOwnerSlot
as defense-in-depth for legacy rows.

Closes openclaw#122911.
@wangyan2026
wangyan2026 force-pushed the fix/workboard-stale-execution-122911 branch from e4ab202 to 120cbb0 Compare August 27, 2026 09:02
@wangyan2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Isolated-Gateway after-fix trace added to PR body. The trace uses startQaLiveLaneGateway (real isolated Gateway + mock-openai provider) to prove a real worker reaching terminal state (status=ok) frees the owner slot for an immediately following same-owner dispatch.

Key evidence:

  • Card 1 dispatched → real agent ran (Gateway + provider transport + agent command) → terminal status=ok
  • Card 1 completed (status=done)
  • Card 2 for the same owner dispatched immediately — no starvation
  • Card 2 agent also ran to completion (status=ok)

The previous CLI build failure was resolved by pnpm install (stale @earendil-works/pi-tui 0.82.1 → 0.84.2 which exports TuiMainScreen).

@clawsweeper

clawsweeper Bot commented Aug 27, 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 exact_review_queue).
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. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 27, 2026
@clawsweeper clawsweeper Bot added 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. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 3, 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 Oct 18, 2026
@steipete

Copy link
Copy Markdown
Contributor

Thanks for the PR. We're closing older pull requests that have gone stale against current main.

This Workboard execution-finalization PR still needs behavior proof and has had no commits since August 27. If stale running executions still block dispatch on current main, please open a fresh PR rebased on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. plugin: workboard rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

workboard: dead worker run's execution record permanently starves its agent's dispatch lane

2 participants