Repository navigation
fix(workers): preserve disappeared-worker failures across restarts - #121122
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
220d428 to
67f6287
Compare
|
Codex review: found issues before merge. Reviewed August 10, 2026, 2:57 AM ET / 06:57 UTC. ClawSweeper reviewWhat this changesThe PR makes cloud-worker terminal diagnostics durable per session across Gateway restarts, projects them through session APIs, and shows the selected session’s failure in the Control UI. Merge readinessKeep open: two prior lifecycle blockers remain. An already accepted workspace result is still converted into a durable worker failure for failed/orphaned/missing environments, and an oversized finishing error can prevent the fence that the new recovery flow relies on. Priority: P2 Review scores
Verification
How this fits togetherCloud workers send lifecycle and workspace-result fences to the Gateway. The Gateway persists a session placement, reconciles it after restart, then projects the resulting state to session APIs and the selected Control UI chat. flowchart LR
A[Cloud worker] --> B[Lifecycle finishing fence]
B --> C[Gateway placement store]
C --> D[Restart reconciliation]
D --> E[Session API projection]
E --> F[Control UI selected chat]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +301, Tests +990, Docs 0, Generated +2, Other +51. Total +1344 across 46 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use one accepted-result completion rule for every proven terminal-loss state, bound finishing-fence errors before RPC emission, and add restart regressions for failed, orphaned, and missing environments. Do we have a high-confidence way to reproduce the issue? Yes, from source: an accepted pending result with a failed, orphaned, or missing environment reaches the failure transition, and an oversized finishing error is rejected before its required fence is emitted. Is this the best way to solve the issue? No. Durable placement ownership is the right boundary, but accepted final results must be reclaimed across every terminal-loss state and the fence must be bounded at its producer. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6b365fa5d3c9. LabelsLabel 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
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
06cde66 to
35147d4
Compare
c49abd2 to
0fabe35
Compare
eec6af4 to
15b962c
Compare
15b962c to
89c8f2d
Compare
89c8f2d to
5a9d481
Compare
5a9d481 to
09a5584
Compare
940e4ca to
11d1fb0
Compare
Keeps the Control UI startup JS bundle inside its 317 KiB gzip budget (the helper + type-only import tipped it by 16 bytes).
Recovers the last gzip byte of the Control UI startup budget (324609 B vs the 324608 B limit).
11d1fb0 to
ce52a7e
Compare
|
Merged via squash.
|
…penclaw#121122) * fix(workers): persist placement terminal failures * fix(workers): refresh placement protocol clients * refactor(workers): isolate error formatting * fix: integrate cloud terminal state with current main * chore(plugin-sdk): refresh API baseline * refactor(ui): inline one-use cloud terminal-reason banner helper Keeps the Control UI startup JS bundle inside its 317 KiB gzip budget (the helper + type-only import tipped it by 16 bytes). * refactor(ui): trim terminal-reason lookup to type-erased optional access Recovers the last gzip byte of the Control UI startup budget (324609 B vs the 324608 B limit).
What Problem This Solves
Fixes an issue where a cloud worker could disappear while a session result was being reconciled, leaving the session looking clean or losing the diagnostic across a Gateway restart. In the worst ordering, a pending workspace result and its failure record were updated separately, and sessions sharing one worker environment could surface the wrong session's recovery error.
Why This Change Was Made
The placement row is now the durable owner of per-session terminal facts.
terminal_reasonandterminal_at_msare additive final columns onworker_session_placements; terminal transitions, pending-result removal, claim release, and recovery diagnostics commit in one synchronous state transaction. Unexpected destroyed, unknown, missing, failed, or orphaned worker evidence records a boundedcloud worker disappeared: ...failure, while clean operator reclaim keeps a null reason.The worker still sends a non-terminal finishing fence before workspace reconciliation. The normal outer fallback cycle remains the sole owner of run-level terminal normalization; this removes the prior in-memory finalization path and environment-scoped session diagnostics. No table or schema-version bump is introduced.
Production LOC: +435/-134 (net +301) | Tests/QA: +1120/-78 | Docs/generated: +50/-50. The production growth establishes the durable owner boundary, atomic failure transaction, and generated Swift protocol follow-through.
User Impact
Operators now see an accurate cloud-worker failure in the affected session and selected Control UI chat, including after Gateway replacement. A disappeared worker is never presented as a clean reclaim, retained workspace results stay fenced for recovery, and one session's terminal reason cannot leak to another session that references the same environment.
Evidence
pnpm check:changedon Blacksmith Testbox: all-project types, core/extensions/scripts lint, schema, DB, metadata, and import-cycle guards passed. Run: https://github.com/openclaw/openclaw/actions/runs/31320267085qa-channel+mock-openai+static-sshmock-provider child Gateway, three Gateway replacements, distinct reasons for two sessions sharing one environment. Testbox verdict:{ "status": "pass", "providerMode": "mock-openai", "channel": "qa-channel", "workerProvider": "static-ssh", "gatewayReplacementCount": 3, "disappearance": { "sessionId": "ephemeral-session-a", "terminalReason": "cloud worker disappeared: Worker provider no longer recognizes lease", "durableAcrossRestarts": true }, "isolation": { "sharedEnvironmentId": "qa-static-worker-loss", "otherSessionId": "ephemeral-session-b", "otherTerminalReason": "independent session failure", "reasonsDistinct": true }, "environment": { "state": "orphaned", "error": "Worker provider no longer recognizes lease" } }