Skip to content

fix(worker): preserve cloud execution and recovery failures - #134200

Merged
roboclaw-bot merged 1 commit into
mainfrom
openclaw/cause-analysis-and-proposed-fixes
Aug 31, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
openclaw/cause-analysis-and-proposed-fixes

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #134199

What Problem This Solves

Fixes an issue where cloud-worker Codex turns could hide an approval timeout behind a generic denial, upload bytes that no longer matched the captured workspace manifest, discard the reason for a reconciliation rejection, and flatten execution plus recovery failures into one ambiguous terminal string.

Why This Change Was Made

The node now freezes changed file bytes into a bounded, private on-disk snapshot before opening the upload request, and the Gateway returns only an allowlisted validation reason. Approval outcomes are actionable and distinct, while terminal reporting preserves the execution error as primary and labels workspace recovery as secondary.

Upstream Codex remains transport-only here: environment_add forwards OpenClaw's exec-server URL in ../codex/codex-rs/app-server/src/request_processors/environment_processor.rs:16, and upsert_environment establishes that remote transport in ../codex/codex-rs/exec-server/src/environment.rs:457. OpenClaw therefore remains the approval and reconciliation owner.

The production delta is +391/-85 (net +306); tests are +294/-12 (net +282). Production growth is the immutable streaming snapshot owner plus a closed, redacted transfer-error contract; it avoids buffering large workspaces in memory and removes the mutable live-file upload path.

User Impact

Operators now see whether a cloud-node approval was denied or expired and what safe class of workspace validation failed. If execution and recovery both fail, the execution cause stays primary and the message explicitly warns that remote changes may not have been applied. Workspace files changed after capture no longer corrupt the upload payload.

Evidence

  • Pre-fix regression: mutating a changed file after manifest capture caused the uploaded digest to disagree with the manifest; the repaired path uploads the immutable captured bytes.
  • Pre-fix regression: denial, permanent approval, and expiry collapsed to one approval error; the repaired path produces distinct actionable outcomes.
  • Pre-fix regression: execution and reconciliation failures were flattened or lost; the repaired path preserves primary and secondary failure roles.
  • node scripts/run-vitest.mjs extensions/codex/src/node-exec-server.test.ts src/node-host/node-worker-transfer-client.test.ts src/gateway/worker-environments/node-workspace-transfer-service.test.ts src/gateway/worker-environments/node-workspace-upload-reader.test.ts src/gateway/worker-environments/worker-turn-launcher-failure-recovery.test.ts src/gateway/server-methods/chat.directive-tags.test.ts — 256 passed, 1 platform-specific skip.
  • node scripts/check-changed.mjs — passed all selected core, core-test, plugin, and plugin-test gates.
  • .agents/skills/autoreview/scripts/autoreview --mode uncommitted — scoped clean, correctness 0.97.
  • Rebase sanity on current main: 287 focused tests passed across worker transfer, terminal projection, channel recovery, Gateway kernel, and Codex.

Known proof gap: the original cloud worker was no longer resumable, so the exact historical run could not be replayed live. Exact-head CI and the repository landing Testbox gate remain required before merge.

Worked on by:

@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review August 31, 2026 14:51
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Aug 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 31, 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:

@roboclaw-bot
roboclaw-bot force-pushed the openclaw/cause-analysis-and-proposed-fixes branch from 2602754 to 69e7ee9 Compare August 31, 2026 14:58
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Aug 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 11:31 AM ET / 15:31 UTC.

ClawSweeper review

What this changes

This PR freezes changed cloud-worker files before upload, returns allowlisted workspace-validation reasons, distinguishes approval outcomes, and presents execution and recovery failures separately.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open: current main still has the reported worker failure paths, and this maintainer-labeled PR is the linked candidate repair. The introduced OpenClaw changes are coherent on inspection, but the claimed Codex transport boundary could not be directly checked because the required Codex source checkout is unavailable.

Priority: P1
Reviewed head: f4b6af2f4e71457286042b7e380f35e0665d270f
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The owner-boundary repair is coherent and regression-focused, with direct Codex-contract confirmation and exact-head runtime gates remaining before landing.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply; supplied focused test claims remain supplemental and do not replace the pending exact-head gates.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply; supplied focused test claims remain supplemental and do not replace the pending exact-head gates.
Evidence reviewed 6 items Current-main bug path: Current main collapses every non-one-time node approval outcome into the same denial result, so expiry and invalid permanent approval are not distinguishable.
Current-main recovery path: Current main rethrows only the execution message while retaining reconciliation failure only as an unlabelled cause.
Introduced snapshot owner: The PR opens changed files without following symlinks, verifies containment, identity, size, and digest, then streams the private snapshot rather than the mutable workspace path.
Findings None None.
Security None None.

How this fits together

A cloud worker runs an agent turn on a node, then reconciles changed workspace files back through the Gateway. The changed code captures the worker result, validates it at the Gateway, and projects an actionable terminal outcome to the chat caller.

flowchart LR
  A[Cloud worker turn] --> B[Node approval]
  B --> C[Workspace snapshot]
  C --> D[Gateway upload validation]
  D --> E[Workspace reconciliation]
  E --> F[Terminal error projection]
Loading

Decision needed

Question Recommendation
Should this maintainer-owned cloud-worker repair land after the Codex transport-boundary assertion is independently reconfirmed? Confirm boundary and land: A relevant owner verifies that Codex still only connects to the supplied exec-server URL, then lands after exact-head gates pass.

Why: The implementation fixes OpenClaw-owned paths, but the PR's scope argument includes an upstream Codex runtime claim that this review could not inspect directly.

Before merge

  • Resolve merge risk (P1) - The immutable snapshot adds a temporary disk copy before every changed-workspace upload, so a node with insufficient secure temporary storage can now fail before transmitting the result.
  • Resolve merge risk (P1) - The current review environment cannot independently confirm the PR's asserted Codex transport contract; exact-head CI and the repository Testbox gate are still pending.
  • Complete next step (P2) - This protected, maintainer-owned PR already owns the linked bug; it needs ordinary maintainer confirmation of the unavailable Codex contract and exact-head gates, not an automated replacement.
Agent review details

Security

None.

PR surface

Source +306, Tests +295. Total +601 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 9 391 85 +306
Tests 9 310 15 +295
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 18 701 100 +601

Review metrics

Metric Value Why it matters
Production versus test delta production +391/-85 (net +306); tests +310/-15 (net +295) The production growth introduces a private snapshot owner and validation contract; its temporary-storage and cleanup behavior merits merge-time verification.

Stored data model

Persistent data-model change detected: durable storage schema: src/gateway/worker-environments/node-workspace-transfer-service.ts, durable storage schema: src/gateway/worker-environments/node-workspace-upload-reader.ts, durable storage schema: src/gateway/worker-environments/workspace-result-finalize.ts, durable storage schema: src/worker/node-workspace-transfer-protocol.ts, serialized state: src/node-host/node-worker-transfer-client.ts, unknown-data-model-change: src/gateway/worker-environments/node-workspace-transfer-service.ts, and 2 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Prove the upgrade path (recommended)
    Verify a real cloud-worker upload on the exact head, including snapshot cleanup and the configured workspace-size boundary, before merge.
  2. Accept the storage tradeoff
    Land with the new temporary-storage requirement only after a maintainer explicitly accepts the possible failure on low-space worker nodes.

Technical review

Best possible solution:

Retain the immutable snapshot and closed error contract, then confirm the Codex transport boundary and exact-head worker behavior before landing.

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

No live reproduction was run in this read-only review, but the current-main owner paths and focused regression scenario make the reported behavior source-reproducible with high confidence.

Is this the best way to solve the issue?

Unclear: the OpenClaw repair is at the correct snapshot, validation, and terminal-projection owners, but the asserted Codex transport boundary remains unverified in this environment.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against c884d51b870b.

Labels

Label changes:

  • add merge-risk: 🚨 availability: The new pre-upload disk copy can prevent a worker result from being sent when secure temporary storage is exhausted.

Label justifications:

  • P1: The PR repairs deterministic cloud-worker failures that obscure why an execution and workspace recovery failed.
  • merge-risk: 🚨 compatibility: Existing cloud-worker deployments now require a successful private temporary-file snapshot before upload.
  • merge-risk: 🚨 availability: The new pre-upload disk copy can prevent a worker result from being sent when secure temporary storage is exhausted.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply; supplied focused test claims remain supplemental and do not replace the pending exact-head gates.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Independently inspect the Codex transport source cited by the PR and complete exact-head CI/Testbox validation.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-31T15:07:03.892Z sha 69e7ee9 :: needs maintainer review before merge. :: none

@roboclaw-bot
roboclaw-bot force-pushed the openclaw/cause-analysis-and-proposed-fixes branch from 69e7ee9 to f4b6af2 Compare August 31, 2026 15:24
@roboclaw-bot

roboclaw-bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Collaborator Author

Land-ready work completed; current rebased head is 1867b35593eaa446b5a01148abe6122b34d17f60:

  • Root cause: workspace manifests were captured before mutable live-file upload; approval outcomes and transfer validators were collapsed; terminal projection flattened independent execution and recovery failures.
  • Architectural owners: node-host snapshot creation, Gateway transfer validation, Codex plugin approval policy, and Gateway terminal projection.
  • Canonical fix: upload an immutable private on-disk snapshot, preserve only closed redacted reason codes, and retain execution as the primary failure with a typed reconciliation cause.
  • Removed path: the node no longer streams changed bytes directly from live workspace paths after manifest capture.
  • Production/test delta: production +391/-85 (net +306); tests +294/-12 (net +282).
  • Sibling coverage: denial/expiry/invalid approval, client/Gateway transfer boundaries, paired/cloud worker teardown, terminal chat projection, and current-main channel recovery fixtures.

Validation:

  • Focused worker/Codex/Gateway suite: 256 passed, 1 platform-specific skip.
  • Rebase sanity: 287 focused tests passed across worker transfer, terminal projection, channel recovery, Gateway kernel, and Codex.
  • node scripts/check-changed.mjs: passed all selected gates after the CI repairs.
  • Fresh autoreview: scoped clean, correctness 0.99.
  • CI breakages from the prior head were resolved: stale composite-error assertions remain covered here, while current main now contains the unrelated channel-fixture and Promise-executor repairs.
  • Exact-head CI run 33410690323: passed after one isolated oc-path CPU-budget outlier passed three strict local reproductions and its failed-job rerun.
  • CodeQL run 33410690542: passed all security categories after rerunning one cancelled job.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 134200: passed with gates_mode=hosted_exact_or_recent_parent; final rebase patch ID remained afa36762aa9f8daebef3c112694af548b0ca1fd7.

ClawSweeper rank-up move applied: direct sibling Codex source inspection confirms environment_add forwards the supplied exec-server URL in ../codex/codex-rs/app-server/src/request_processors/environment_processor.rs:16-27, and upsert_environment creates the remote WebSocket transport in ../codex/codex-rs/exec-server/src/environment.rs:457-477. No Codex protocol change is required.

Known proof gap: the original historical cloud run is not resumable, so it was not replayed live. Deterministic owner-boundary regressions, exact-head CI, CodeQL, and repository Testbox preparation are green.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 31, 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 the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Aug 31, 2026
@roboclaw-bot
roboclaw-bot force-pushed the openclaw/cause-analysis-and-proposed-fixes branch 2 times, most recently from b118744 to 94551a6 Compare August 31, 2026 15:49
Freeze uploaded workspace bytes before opening the transfer request, preserve safe validation reason codes, and keep execution failures primary when reconciliation also fails.

Co-authored-by: Takhoffman <[email protected]>

Worked on by:
- @Takhoffman
@roboclaw-bot
roboclaw-bot force-pushed the openclaw/cause-analysis-and-proposed-fixes branch from 94551a6 to 1867b35 Compare August 31, 2026 16:31
@roboclaw-bot
roboclaw-bot merged commit 20b2dac into main Aug 31, 2026
236 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/cause-analysis-and-proposed-fixes branch August 31, 2026 16:56
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 1, 2026
Freeze uploaded workspace bytes before opening the transfer request, preserve safe validation reason codes, and keep execution failures primary when reconciliation also fails.

Co-authored-by: Takhoffman <[email protected]>

Worked on by:
- @Takhoffman

Co-authored-by: roboclaw-bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cloud worker failures obscure approval and workspace recovery causes

1 participant