Repository navigation
fix(workers): cleanup failures lose their cause after a reply - #137828
Conversation
Keep captured output, usage, and delivery evidence when native CLI session continuity cannot be saved or remote computer cleanup fails. Record the failure at its owner, classify replacement results independently, and prevent another model attempt from repeating effects. Preserve typed frozen errors through cleanup, rejecting credential cleanup, and the canonical terminal outcome rather than reporting a false winning model. This is the result-finalization prerequisite split from #136049 (paired Mac cleanup and error preservation), related to #135944 (cleanup hides its cause). It does not include native input lifecycle changes or complete that issue. Validation: 565 selected tests passed; the final test-only cleanup was covered by 77 rerun cases. Completed changed-check component plan, production build, and fresh isolated Codex autoreview (P0 scoped-clean). Live proof follows on this exact source before landing. Production +104; tests +621; docs +2. The added production surface owns retained results and frozen-error no-replay evidence; terminal projection is simplified.
Drain computer and browser disposal before the worker's finishing ACK. Preserve primary and secondary cleanup causes rather than replacing them with terminal assistant text or a generic launcher error. Capture the applied finishing outcome under its exact operational owner, claim, credential identity, sequence and ACK predicate. Revalidate after publication listeners, consume once before reconciliation releases the owner, and discard retained state on closure or replacement. Keep credential cleanup rejecting and skill-artifact deletion advisory. This is the worker-outcome slice of #136049 (paired-computer cleanup and error preservation), related to #135944 (cleanup hides its native cause). Depends on #137821 (completed CLI actions replay when session saving fails). Native input/tool-lifetime changes remain separate. Validation: 347 tests across 14 integrated suites; actual worker-scoped changed gate; production build; fresh isolated Codex autoreview, P0 scoped-clean. The 35-file tested integration matches this publication tree exactly. Real worker/native failure-path proof is still required before landing. Worker-only delta: production +124, tests +592, docs +2. Tool disposal is net-neutral; new lines own exact acknowledged, one-use finishing evidence.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 8:26 AM ET / 12:26 UTC (Revision 10). ClawSweeper reviewWhat this changesWorker turns finish tool cleanup before acknowledgement, retain cleanup errors through workspace reconciliation, and prevent automatic model fallback from repeating completed actions. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main still loses acknowledged worker cleanup diagnostics. The reviewed patch has no actionable correctness findings, and the recorded production worker proof supports the repair. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw workers execute agent turns on remote machines and send transcripts and lifecycle acknowledgements to the Gateway. The Gateway reconciles workspace changes and decides whether failures permit another model attempt. flowchart TD
A[Remote agent turn] --> B[Saved assistant reply]
B --> C[Computer and browser cleanup]
C --> D[Gateway finishing acknowledgement]
D --> E[Current turn outcome]
E --> F[Workspace reconciliation]
F --> G[Report retained failure]
E --> H[Allow provider fallback or stop replay]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +135, Tests +792, Docs +2. Total +929 across 17 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep cleanup settlement and acknowledged failure retention with the existing turn owner, preserving provider-only fallback and saved transcript content. Do we have a high-confidence way to reproduce the issue? Yes: a saved assistant reply followed by cleanup failure reaches main's transcript-derived generic error path; the recorded baseline worker run also demonstrates duplicate effects. This review did not execute a current-main reproduction. Is this the best way to solve the issue? Yes: the patch extends the existing cleanup, claim, acknowledgement, and fallback owners without adding parallel state or a new protocol. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f1957d9ed690. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
Bind native input and private references to the exact execution UUID and original live Gateway route. Reuse the canonical invocation cancellation registry; fence admission, drain work, release only owned input and retire references before close completes. Wrong or stale closes cannot affect a successor, and closing an unacquired execution does not fabricate release. Make HTTP/RPC requests, CLI/MCP captures and Copilot attempts own the tools they construct through final cleanup. Remove TTL-driven executable tool recreation and unissued bearer/header authority. Retain cleanup across warm CLI transfer; construct Copilot through the existing placement-bound host surface. Keep returned output and cause diagnostics through the shared result-finalization prerequisite. Raw clients must reuse their execution UUID and close in finally. Gateway and Mac companion must be upgraded together for this ownership repair. No protocol version, schema, dependency, configuration or product timeout change is introduced. CUA ownership remains separate. Lifecycle-only split of #136049 (paired Mac cleanup and failure preservation), related to #135944 (cleanup hides its cause). Depends on #137821 (CLI actions replay after continuity failure); receipt compatibility is #137755 and acknowledged worker outcomes are #137828. Already-landed Talk, Android and sibling reroute changes are not repeated. Validation: 2277 targeted tests across 75 files plus five doctor-gate tests; 39 checks for the exact 78 non-Swift integrated paths; full package build; 107 Mac owner tests and 1629 shared tests in the isolated Mac VM, no skips; fresh isolated Codex autoreview, two complete chunks, P0 scoped-clean. All 98 integrated source files match the tested/reviewed input. Real signed companion/input proof remains pending; these are not live desktop claims. Lifecycle-only production +577, tests +2389, test support +358, tooling +24, docs +40, assertion ratchet -1. Growth supplies exact native-route and request/capture/attempt lifetime ownership; old parallel lifetime paths are removed rather than retained as compatibility shims.
Record replay prohibition at the failing tool-cleanup owner and carry that fact through the existing finishing replayInvalid field. Retain it with the exact acknowledged turn outcome, then mark the launcher's error before workspace reconciliation releases the owner. Provider-only failures keep their existing fallback behavior. A boundary regression through run entry, placement admission, finishing acknowledgement and outer model fallback reproduced a second synthetic effect after cleanup failure. The repaired path executes once and retains the original cause, including when workspace reconciliation succeeds. Proof: 125 owner and 285 sibling cases passed, with eight targeted legitimate-fallback controls and final fixture reruns. Changed checks, full build and fresh whole-worker-PR P0 autoreview passed. Synthetic boundary proof is not live native-input proof. No protocol/schema change. Follow-up to the acknowledged worker-outcome repair in #137828. Incremental LOC: production +20, tests +195, docs net zero.
|
@clawsweeper re-review Head The cleanup owner now records the stop, the existing finishing The updated body records the red-to-green evidence, 125 owner and 285 sibling cases, explicitly filtered fallback controls, final fixture reruns, passing changed checks/build, and a fresh whole-PR P0 autoreview. Cumulative delta is production +144, tests +787, docs +2; the follow-up accounts for +20 production and +195 tests. This remains a draft, not a landing request. The previous review's prerequisite/retargeting, exact-head CI, and isolated worker/native proof requirements remain open. Synthetic boundary tests do not replace the missing live input proof. The prerequisite's required npm advisory audit is still red after three CI attempts. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
41bc333 to
c001a35
Compare
Exact-head worker proof and native reviewCurrent head AWS Crabbox
198 focused worker-owner cases, the partition and model-catalog guards, 28 Copilot registry contracts, 6 thinking and 32 plugin-inspection cases pass. The source-blind validator joined raw run/claim/credential/sequence/ACK/process evidence and effect bytes for all three cells. 18 sanitized public artifacts plus the manifest were downloaded and hash-verified. Native Exact-head hosted CI passed on attempt 2, including required Native Two pre-submission tooling/transport failures are preserved: remote GitHub CLI 2.46 lacked Proof boundary: controlled model responses and browser-disposal fault seam; not native browser/computer-close implementation or live-provider-authentication proof. Baseline red remains 2 workers / 2 effects; all earlier evidence below is source-scoped. Earlier-head qualification and preserved regression evidenceLatest head and gatesCurrent head: Exact-candidate gates passed: 6 thinking cases and the entire unchanged 32-case plugin-inspection file (run). The prior config-observation failure is the intermittent issue instrumented by #148736, not claimed fixed by this PR; its original failure remains retained. Exact-head native proof passed on AWS Crabbox lease The proof uses actual separate Node workers, production launcher, WebSocket admission/ACK, inference proxy/transcript owners, outer fallback, and real exec file append. Provider responses and the existing disposal seam are controlled: not native browser/computer-close implementation proof. Source-blind validation independently joins run/claim/credential/sequence/ACK, process lifetime, and retained effect bytes. 19-file evidence manifest — all files and manifest downloaded and hash-verified; signed links expire after seven days, authoritative private raw evidence retained. Native exact-head review artifacts validate with zero findings. Prior independent review covers all16 unchanged worker files; the one-line auth fixture correction is separately red/green qualified. Fresh ClawSweeper review is running on this exact head. Remaining gates: hosted exact-head CI, native preparation, and pinned merge. No merge attempt yet. Earlier evidence below remains scoped to its named head. Earlier-head qualification and original regression evidenceCurrent-head qualificationHead Exact-head native run, AWS Crabbox lease
Actual separate Current-head focused owner tests: 198 passed. The previously failing shard boundary and model-catalog test pass with landed #148826 and #148831. Native review artifacts validate with zero source findings; the maintainer workflow permits retaining independent review for a byte-identical mechanical integration. Source-blind wire/process/ACK/effect validator · source identity · 18-file evidence manifest. Every published artifact and manifest was downloaded and byte-verified; credentials are removed from public projections. Signed artifact links expire after seven days; authoritative raw evidence remains privately retained. Command: Remaining gates: exact-head hosted CI and native preparation/merge. Current CI’s lint/typecheck failures are the unchanged main duplicate registry keys; canonical #148982 is actively owned by @vincentkoc (coordination and precise failed-UI evidence). #148933 closed unmerged; its repair landed via #148826. No gate is waived, and no merge has been attempted. Historical baseline and earlier-head proof (preserved; not current-head CI)Exact-head native red / green proofHead: 8ee1affb92ba68c45601df765e40ebf349621257. Original canonical ancestry and Peter Steinberger’s credit are preserved.
The repaired cleanup failure retains its cause and no-replay fact; the provider-only control still enters legitimate model fallback. Both tool cleanups settle before finishing. The existing claim owner retains only applied/ACKed evidence from the exact live run, claim, credential, and sequence, then consumes it before reconciliation releases custody. Runtime boundary: actual separate Node worker process using runWorkerCommand, production Gateway launcher, WebSocket admission/live ACK, inference proxy/transcript owners, outer model-fallback runner, and real exec file append. Model responses are controlled; browser disposal rejection is injected through the existing WorkerBrowserRuntime seam. Browser tooling is unused. This is native worker/transport proof, not native browser/computer close or input-lifetime implementation proof.
Production LOC: +178/−43 (net +135). Tests: +799/−8. Docs: +2. Growth adds single-use finishing evidence to the existing claim owner and transports the existing cleanup-owned replay stop. No new store, module, schema, protocol, configuration, or dependency. Provenance: the raw-parent diff for #121475, commit b5d5ec3, adds browser disposal after terminal handling. Author and merger: @steipete; committer: GitHub; automation trigger unknown. Replay was reproduced on the current baseline, not claimed reproduced at that historical commit. Committed-head aggregate checks passed: run_76e31e93f1db, including lint, schema/storage guards, import cycles and auth guards. Native proof command: crabbox run --provider aws --id cbx_16d1a13946e0 --no-sync --no-hydrate --script native-exact-head-green.sh; the script pins the full head and runs clean, browser-fault and provider-only cells through node --import ./scripts/tsx.mjs. Still pending: full exact-head CI, current ClawSweeper disposition, native review artifacts, required preparation, and head-pinned merge. Initial fixture failures and the old-head/uncommitted-history ratchet failure are preserved, not counted as product success. Hosted CI prerequisite statusNative exact-head review artifacts validated with zero source findings. Hosted CI tested against newer main and failed the unrelated core boundary guard because #148885/#148889 assigned secrets test roots twice. Canonical #148933 is the required repair; its hosted boundary check passed, and independent native red/green proof is recorded in this prerequisite evidence comment. No worker source change is indicated by this failure. Required exact-head CI, native preparation and merge remain pending; no gate is waived. |
…-recovery-integration-1125
|
Merged via squash.
|
…aw#137828) * fix(agents): preserve results when finalization fails Keep captured output, usage, and delivery evidence when native CLI session continuity cannot be saved or remote computer cleanup fails. Record the failure at its owner, classify replacement results independently, and prevent another model attempt from repeating effects. Preserve typed frozen errors through cleanup, rejecting credential cleanup, and the canonical terminal outcome rather than reporting a false winning model. This is the result-finalization prerequisite split from openclaw#136049 (paired Mac cleanup and error preservation), related to openclaw#135944 (cleanup hides its cause). It does not include native input lifecycle changes or complete that issue. Validation: 565 selected tests passed; the final test-only cleanup was covered by 77 rerun cases. Completed changed-check component plan, production build, and fresh isolated Codex autoreview (P0 scoped-clean). Live proof follows on this exact source before landing. Production +104; tests +621; docs +2. The added production surface owns retained results and frozen-error no-replay evidence; terminal projection is simplified. * fix(workers): retain acknowledged cleanup failures Drain computer and browser disposal before the worker's finishing ACK. Preserve primary and secondary cleanup causes rather than replacing them with terminal assistant text or a generic launcher error. Capture the applied finishing outcome under its exact operational owner, claim, credential identity, sequence and ACK predicate. Revalidate after publication listeners, consume once before reconciliation releases the owner, and discard retained state on closure or replacement. Keep credential cleanup rejecting and skill-artifact deletion advisory. This is the worker-outcome slice of openclaw#136049 (paired-computer cleanup and error preservation), related to openclaw#135944 (cleanup hides its native cause). Depends on openclaw#137821 (completed CLI actions replay when session saving fails). Native input/tool-lifetime changes remain separate. Validation: 347 tests across 14 integrated suites; actual worker-scoped changed gate; production build; fresh isolated Codex autoreview, P0 scoped-clean. The 35-file tested integration matches this publication tree exactly. Real worker/native failure-path proof is still required before landing. Worker-only delta: production +124, tests +592, docs +2. Tool disposal is net-neutral; new lines own exact acknowledged, one-use finishing evidence. * fix(workers): stop fallback after acknowledged cleanup failures Record replay prohibition at the failing tool-cleanup owner and carry that fact through the existing finishing replayInvalid field. Retain it with the exact acknowledged turn outcome, then mark the launcher's error before workspace reconciliation releases the owner. Provider-only failures keep their existing fallback behavior. A boundary regression through run entry, placement admission, finishing acknowledgement and outer model fallback reproduced a second synthetic effect after cleanup failure. The repaired path executes once and retains the original cause, including when workspace reconciliation succeeds. Proof: 125 owner and 285 sibling cases passed, with eight targeted legitimate-fallback controls and final fixture reruns. Changed checks, full build and fresh whole-worker-PR P0 autoreview passed. Synthetic boundary proof is not live native-input proof. No protocol/schema change. Follow-up to the acknowledged worker-outcome repair in openclaw#137828. Incremental LOC: production +20, tests +195, docs net zero. * test(agents): use runtime auth reader in thinking fixture --------- Co-authored-by: Jason (Json) <[email protected]>
What Problem This Solves
Worker cleanup failures could lose their cause after a saved reply and trigger model fallback that repeats an already-performed action. This fix preserves the acknowledged outcome and prevents that replay. This is the current-source port of Peter Steinberger’s canonical PR; original contributor ancestry is retained. The CLI-result prerequisite #137821 is already merged.
No schema, protocol, configuration, or dependency change. Current async RPC/live-event, transcript-admission, workspace, credential-rotation, and preview-disabled contracts are preserved.
User impact
An answer already saved in the transcript remains available. Cleanup failure is reported with its bounded, redacted cause instead of a generic worker failure. The turn is not automatically replayed on another model. Earlier input is not undone; inspect the desktop and workspace before manually retrying.
Scope
Related to #135944; split from #136049. This does not implement native close/input/tool lifetime, prompt policy, completion-delivery replay, or Mantis lifecycle changes.
Native proof
Actual separate Node worker process, production Gateway launcher, WebSocket admission/live ACK, inference proxy, transcript owners, outer model-fallback loop, and real exec file append. Model responses are controlled; browser disposal rejection is injected through the existing runtime seam. Browser tooling is not invoked. This is native worker/transport proof, not native browser/computer implementation proof.
Baseline: e83fa14, AWS Crabbox run https://crabbox.openclaw.ai/portal/runs/run_9e6fe8b232c2. Historical green: https://crabbox.openclaw.ai/portal/runs/run_5d0559e3f167 on 8ee1aff. Previous-head green: https://crabbox.openclaw.ai/portal/runs/run_7548220d66de on e7d4d8f.
Focused regression with candidate test overlay on unchanged baseline: seven failures, three passes, 65 deliberately filtered cases. The baseline was restored and verified clean afterward. Previous e7 native proof and 198 changed-owner cases passed. Historical source-equivalent adjacent tests, production/test typechecks, full build, independent P0–P2 review and aggregate checks are retained. Native review validates the unchanged worker patch. Current head
770dc2529473e50b10fa0d7c4077cbae30eba2b0integrates landed #148826/#148831/#149016/#149023/#149038. All17 worker/fixture files remain byte-identical to the previously qualified622 head. It also supplies the existing test auth store to the current runtime reader (one test-only line; six-case red/green). Its 6 thinking and 32 unchanged plugin-inspection tests pass; Prior622 worker proof (three runtime cells and198focused tests), artifact validation and native review passed. Fresh770 worker proof passed: three runtime cells,198focused tests, partition/model guards,28Copilot contracts,6thinking and32inspection cases; source-blind validation and18artifact plus manifest readbacks passed. Exact770 native review validates with zero findings. Exact770 hosted CI passed on attempt2 (including the required aggregate); native preparation passed without changing or pushing the head. Native merge completed as83c1767446cb101f239cbed430524e2934556ebe; GitHub MERGED state, main ancestry, Peter Steinberger’s author credit, and native non-force PR-worktree cleanup are verified. Original failed attempts and the one diagnosed-failure retry are preserved.Initial fixture failures and the uncommitted-history ratchet failure are retained in the evidence packet, not counted as product regression proof. Prior PR-body evidence is historical and has not been promoted to current-head proof.
Current proof and release-note context
Verified native proof, source hashes, artifacts, review and gate status.
Production +178/−43 (net +135); tests +800/−8; docs +2. Release impact: preserve actual worker cleanup failures and prevent automatic replay of already-performed actions. No release-owned changelog edit.