feat(work-graph): lifecycle bindings + stale truth#4569
Conversation
Bind durable tasks, workers, workflows, Fleet tasks, and Lanes to owner-reported Work Graph lifecycles while keeping ephemeral shells restart-stale. Register spawn intent before execution, preserve bounded byte receipts and typed cancellation outcomes, reconcile restored owners atomically, and re-anchor active operation identity after compaction without duplicating stale summaries. Keep owner state authoritative across task queue failures, workflow restart recovery, Fleet ledger compaction, Lane transitions, and session restore. Add deterministic lifecycle, restore, compaction, approval-provenance, and fail-closed regression coverage. Signed-off-by: Hunter B <hmbown@gmail.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Claude finished @Hmbown's task in 1m 32s —— View job Claude is reviewing this PR
|
Keep the Windows-only blocked-reader fixture aligned with BackgroundShell's durable lifecycle bookkeeping. This restores cross-platform test compilation without attaching the synthetic shell to a Work runtime. Signed-off-by: Hunter B <hmbown@gmail.com>
|
Claude finished @Hmbown's task in 8m 23s —— View job Review: lifecycle bindings + stale truthTodo list
Reviewed via three parallel deep-dives (work_graph core, tools/operation-intent, TUI surface + lane registry), then verified the highest-severity findings by hand. Correctness bugs
Everything else in the core lifecycle machinery checked out: owner-sequence regression handling, the stale-recovery-at-equal-seq case, the optimistic-concurrency check in Two minor edge cases, not confirmed bugs: Provider/model/route safety (EPIC #2608)No issues — this PR doesn't touch model/provider selection or routing; none of the changed files parse model strings or infer provider from prefixes or prompt text. Reuse/simplification
Test coverage
SecurityNothing to flag — no Solid PR overall: the fail-closed behaviors described in the summary are genuinely implemented and well-tested where they matter most (queue-write rollback, missing controller, sequence regression). The gaps are concentrated in the newer, more peripheral wiring (interactive shell receipts, cancel-outcome derivation, UI aggregate counts, and the workspace-owner reconciliation test gap). |
Return cancellation disposition from the TaskManager state transaction, preserve authoritative task and shell results when Work reconciliation fails, and only advance shell sequence state after a successful observation. Also restore strict-clippy hygiene for the touched WG4 paths. Signed-off-by: Hunter B <hmbown@gmail.com>
Treat spawn-intent operations as live in the Work surface aggregate so the header agrees with the row state. Cover mixed initializing, active, and ready operations with a focused regression. Signed-off-by: Hunter B <hmbown@gmail.com>
Let the raw-key paste-burst window expire before the post-cancel marker so the six-worker liveness scenario tests composer recovery rather than racing the paste heuristic. Signed-off-by: Hunter B <hmbown@gmail.com>
|
Claude finished @Hmbown's task in 1m 33s —— View job Re-review: latest push (4 new commits since the previous review)Todo list
New commits:
The remaining two commits are narrowly-scoped test fixes: No new correctness issues surfaced in this diff. The Two items from my original review remain unaddressed but were not marked as blocking, and neither was touched by this push, so they still stand as open recommendations if the author wants to fold them in:
Note: I wasn't able to run |
|
Exact-head repair receipt for 555117e: all six Claude correctness findings are addressed. Task cancellation disposition is atomic; successful task/shell outcomes survive Work reconciliation failures with explicit warnings; interactive byte receipts use ShellResult lengths; shell sequences advance only after successful observation; Initializing rows count as running; and the macOS six-worker PTY miss was classified as a rapid-key paste-window race and hardened. Local gates: cargo fmt check; diff check; strict locked workspace/all-target/all-feature clippy under Rust 1.97; locked TUI 7,482 passed, 0 failed, 3 ignored; release PTY 5 passed, 0 failed, 1 heavy benchmark ignored; the six-worker test also passed five consecutive pre-fix reproductions; delta and 1.05 GB full-tree gitleaks scans found no leaks. Both inline threads have fix-specific replies and are resolved. Awaiting exact-head CI and review; no publication action taken. |
Give model tools, periodic TUI refresh, and engine restore one exhaustive TaskStatus, sequence, and timestamp adapter. Cover every status and the terminal-to-started-to-created timestamp precedence to prevent lifecycle drift. Signed-off-by: Hunter B <hmbown@gmail.com>
|
Claude finished @Hmbown's task in 1m 13s —— View job Re-review: commit
|
|
Follow-up exact head 976f955 closes the remaining lifecycle-drift recommendation from review: model tools, periodic TUI refresh, and engine restore now share one exhaustive TaskStatus/sequence/timestamp owner adapter. Added tests cover all five statuses plus terminal-to-started-to-created timestamp precedence. Existing App tests already exercise target-workspace Fleet restore and prove sequence-regression failure leaves prior Work state intact, so no redundant restore test was added. Refreshed local gates: strict locked workspace/all-target/all-feature clippy; locked TUI 7,484 passed, 0 failed, 3 ignored; release PTY 5 passed, 0 failed, 1 ignored; fmt/diff and one-commit gitleaks clean. Awaiting fresh exact-head CI/review; no publication action taken. |

Summary
Verification
cargo fmt --all -- --checkcargo test -p codewhale-tui --bin codewhale-tui --locked(7,480 passed, 3 ignored)cargo test -p codewhale-lane --locked(17 passed)cargo test -p codewhale-tui --test release_runtime_qa --locked(5 passed, 1 heavy benchmark ignored)cargo test -p codewhale-tui --test integration_mock_llm --locked(42 passed)gitleaks dir --no-banner --redact --exit-code 1 .gitleaks protect --staged --no-banner --redact --exit-code 1Known local linker diagnostic: macOS reports the existing oversized
__eh_framecompact-unwind warning for the TUI test binary; all commands exit successfully.No tag, release, registry publication, deploy, or branch deletion is included.