Repository navigation
fix(worker): preserve turn outcomes when skill cleanup fails - #136958
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 3, 2026, 12:42 AM ET / 04:42 UTC. ClawSweeper reviewWhat this changesThe PR puts materialized skill files in independent private temporary directories and logs deletion failures without replacing completed, failed, cancelled, or timed-out worker outcomes. Regression provenancePossible regression — probable (reviewed change; reproduction). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 3 items remain Keep this maintainer-owned, protected PR open for its normal landing path. The repair cleanly separates disposable skill artifacts from credential-bearing worker state and preserves outcomes on artifact deletion failure; no blocking correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherWorker turns materialize approved skill bundles before the embedded agent or paired-node Claude session runs. Those temporary files are cleaned up after the turn, while worker state holds lifecycle data and may hold a per-turn GitHub credential profile that must still be deleted strictly. flowchart LR
A[Prepared skill bundle] --> B[Private turn artifact directory]
B --> C[Embedded worker or Node Claude session]
C --> D[Committed turn outcome]
B --> E[Artifact cleanup]
E --> F[Bounded warning if deletion fails]
D --> G[Final worker result]
H[Credential-bearing worker state] --> I[Strict state cleanup]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +16, Tests +461, Docs +14. Total +491 across 9 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the isolated artifact-cleanup policy after exact-head CI and maintainer review, retaining direct rejecting cleanup for worker state and GitHub credential profiles. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence: the added composed-worker harness creates an actual POSIX EACCES after materialization and checks the final worker result, acknowledged finishing event, and strict credential-state deletion path. Is this the best way to solve the issue? Yes. Isolating disposable skill artifacts from credential-bearing worker state fixes the failure at the cleanup owner instead of weakening privileged state cleanup or adding a downstream outcome guard. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 529070704174. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Make temporary skill artifact deletion advisory across materializer, worker environment, and node skill-session cleanup. Warn on retained files while preserving completed results and original errors. Closes #136957
|
Land-ready review for fb761790e517b12f8b4618d2b2a439ae43ac35ca: exact-head CI 33715676324 completed successfully, and the required The latest ClawSweeper review has no correctness or security finding. Its three remaining conditions are addressed:
The repaired ownership boundary is physical separation: copied skill files live in a private turn-artifact directory outside worker state. Real EACCES cases prove denied skill deletion preserves the original result while credentials are removed, and denied credential deletion still rejects. The node CLI gets only the exact skill read root; Workshop configuration remains separate. No new wire result field, state store, retry, or timeout. Local proof, 220 passed across 12 files: node scripts/run-vitest.mjs src/worker/worker.fault-injection.test.ts src/skills/runtime/resources.test.ts src/node-host/claude-skill-session.test.tsnode scripts/run-vitest.mjs src/skills/library/service.test.ts src/worker/worker-command.runtime.test.ts src/worker/worker-runtime-environment.test.ts src/worker/worker.runtime.test.ts src/worker/embedded-agent-live.runtime.test.ts src/node-host/invoke-agent-cli-claude.test.ts src/node-host/worker-runtime.test.ts src/node-host/runtime.test.tsnode scripts/run-vitest.mjs src/gateway/node-claude-skill-runtime.test.ts --maxWorkers=1node scripts/check-changed.mjs -- docs/cli/worker.md src/infra/temp-artifact-cleanup.ts src/node-host/claude-skill-session.ts src/node-host/claude-skill-session.test.ts src/skills/library/service.test.ts src/skills/runtime/resources.ts src/skills/runtime/resources.test.ts src/worker/embedded-agent.runtime.ts src/worker/worker.fault-injection.test.ts src/worker/worker.runtime.tsScoped checks and Proceeding only through the repository-native hosted preparation and merge workflow. |
59242ea to
fb76179
Compare
|
Updated the repair to keep materialized skill inputs in an independent private turn-artifact directory. Worker state and GitHub credential deletion are unchanged from main and still reject on failure; node Workshop configuration stays outside the skill read root. This resolves the earlier cleanup-policy merge-risk item without weakening privileged owners, and reduces production growth from +23 to +16 lines. Six real EACCES integration cases failed before this isolation repair and now pass. The complete local evidence is 220 passing tests across 12 files, scoped checks, and a fresh clean isolated Codex autoreview of the full candidate at the default P0 threshold. The PR body contains exact commands and proof limitations. New exact-head CI must complete before native preparation and merge. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…w#136958) * fix(worker): preserve turn outcomes when skill cleanup fails Make temporary skill artifact deletion advisory across materializer, worker environment, and node skill-session cleanup. Warn on retained files while preserving completed results and original errors. Closes openclaw#136957 * fix(skills): isolate turn artifacts from worker credential state Keep disposable skill inputs in a private per-turn artifact directory while preserving rejecting worker-state and GitHub credential cleanup after openclaw#136583. Refs openclaw#136957.
Closes #136957
Additional instructions
This is a maintainer-owned upstream branch; maintainers can update it.
What Problem This Solves
Fixes an issue where users running worker turns with materialized skills could receive a failed result after their answer was committed and finishing was acknowledged when temporary skill-file deletion failed. Setup rollback could also lose its original cancellation or timeout error behind a secondary deletion error.
Why This Change Was Made
Copied skill inputs now own a private per-turn artifact directory, independent of worker state. Failed deletion is advisory: report a bounded/redacted warning and retained-directory guidance, then preserve the existing result or original error. The node CLI receives exactly that artifact directory as its additional read root; temporary Workshop configuration stays in a separate private directory allocated only when needed.
This isolation matters after #136583 introduced per-turn GitHub profiles inside worker state. The original version of this PR made enclosing state-directory deletion advisory; integration testing caught that this would weaken the new credential-bearing lifecycle. Worker state and GitHub credential cleanup are now byte-for-byte unchanged from the reviewed main baseline and still reject on deletion failure. A denied skill-file deletion cannot obstruct removal of credential-bearing state because the trees are independent.
Process draining, database/transport or MCP closure, authority revocation, privileged desktop cleanup, worker finishing/ACK, interruption precedence, and retry/fallback classification retain their existing behavior. No wire result field, configuration, dependency, store, retry, or timeout was added. The internal materializer directory result serves a real CLI read-permission caller; it is not a protocol change.
User Impact
Completed worker work remains completed when disposable skill-file cleanup is denied, and failed or interrupted work retains its original reason. Operators receive a warning identifying potentially retained skill files. Wait until the worker/session and its owned processes stop before manually checking permissions and removing the reported artifact directory. Integrity and resource-delivery validation still fail closed.
The maintainer explicitly selected advisory cleanup for these disposable skill inputs, not for credential state or privileged resources.
Evidence
The original reproduction used real filesystem
EACCESand showed a committed answer plus successful finishing ACK followed by failed worker status. Portable partial-write rollback cases showed the exact frozen primary error being replaced by deletion failure.After rebasing onto main
df4628e68f13dc10a159e7beabf32a14c454db42, six integration regressions failed before the isolation repair: four standalone/managed success, provider-failure and cancellation cases retained worker state when skill deletion was denied; two standalone/managed credential-deletion cases incorrectly resolved. All six now pass: skill deletion warns while credential-bearing state disappears, and denied credential deletion still rejects.These cases use the actual worker command, embedded loop, WebSocket/RPC owners, transcript store, finishing receiver/result fence, real materializer, actual GitHub-profile writer with synthetic credentials, and real POSIX deletion. Permissions remain blocked through command settlement. They also assert one provider execution and no extra inference or terminal replay. No production test seam was introduced.
220 tests passed across 12 files, in the following focused runs, with no skipped tests on the non-root macOS proof host:
Coverage includes exact frozen cancellation/timeout identity; private artifact and file modes; the exact node read root excluding Workshop config; independent artifact cleanup; actual synthetic CLI execution of supporting files; current-main GitHub identity binding and retained-process isolation; stale-transcript no-replay; background-process/finalizer ordering; desktop cleanup; and MCP close failures. POSIX permission cases explicitly skip Windows/root. There is no additional combined command-timeout/EACCES or typed transcript-error/EACCES case.
Targeted formatting, core/test types, typed lint, dead-export scans, import-cycle and applicable boundary guards passed through the scoped changed gate:
git diff --checkpassed. Fresh isolated Codex autoreview covered the complete candidate against the pinned main baseline and is clean at its default P0-only threshold. No full local build, live-model or UI run was performed: this repair is exercised at actual filesystem, command/RPC and synthetic CLI boundaries, without changing an external provider/API, package entrypoint or lazy boundary. Live-model/UI proof was outside the original task's authorization.Production LOC: +40/-24 (net +16). Tests: +470/-9 (net +461). Docs: +14. Growth supplies the shared bounded/redacted artifact-deletion boundary and exact internal read-root ownership, while removing nested staging and unnecessary Workshop-directory allocation. The ClawSweeper merge-risk item about broadening cleanup policy is addressed: the helper is used only for materialized skill inputs and temporary node Workshop configuration, never worker credential state or privileged cleanup.
Guidance is updated in the worker documentation. Original defect provenance was verified at
1842ab774cd60155803b55248aaf0417b6e2bbd1, with the implicated owners unchanged fromb394488146f52b5bc807855ebb64057d7d3c1d3f; the exact introducing commit and shipped-release reachability remain unverified. Generic node CLI prompt-file deletion and non-filesystem close-error precedence remain separate-policy follow-ups. The separate paired-node computer/provider repair is not included.