Skip to content

fix(workers): restore exec in node and cloud workers - #175196

Merged
steipete merged 1 commit into
mainfrom
steipete/cs-workerbundle-1017
Oct 17, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/cs-workerbundle-1017

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #169095

What Problem This Solves

Fixes: node and cloud worker exec calls fail with a missing session-transcript.worker.mjs module before returning their workspace permission result.

User Impact

Worker exec reaches the admitted permission policy without trying to open Gateway-owned session storage. No configuration change or migration is required.

Why This Change Was Made

The shared exec path introduced an asynchronous session-capability lookup in cbc53ac (#169622). The worker passes a synthetic worker:<id> key, which has no Gateway session lineage. When 6d10c08 (#174918) correctly stopped swallowing capability-read errors, this misplaced lookup surfaced as a missing worker module. #174574 only changed the SQL inventory and did not introduce runtime behavior.

Carry the known worker execution classification through the existing exec defaults, alongside its prepared store environment. Gateway callers keep their existing lookup and error propagation. The transcript worker stays Gateway-only; adding it to the archive would conceal the ownership leak. This adds five production lines and no new runtime owner. The regression exercises the placement-tool boundary through actual execution from a relocated sealed archive; the cloud worker security documentation records the database boundary.

Evidence

  • Original failure: PR #175147, run 39006014902, job 117318756358, October 17, 2026, node-worker-launch-wire.e2e.test.ts:441. The permission-phase exec result contains the missing module error.
  • Pre-fix source boundary probe: the real placement exec attempts to launch the Gateway transcript worker; rejecting that launch reproduces the failure (44.02 s wall).
  • Bundle contents before/after: the sealed build entry list (tsdown.config.ts:995) and archive inventory (src/shared/worker-bundle-hash.ts:14) deliberately omit session-transcript.worker.mjs. The new relocated-archive regression requires the intended approval denial with that file absent; no Gateway transcript entry is added.
  • OPENCLAW_VITEST_RUNTIME=node pnpm test test/scripts/worker-deploy-build-plugin.test.ts --maxWorkers=1: 21 passed, 308.45 s wall; new relocated permission regression 13.154 s. This builds all sealed worker entries, verifies archive contents, and executes the relocated runtime. The build accounts for most of the file cost and proves a boundary that source-only tests cannot.
  • Post-fix source boundary probe: expected workspace approval denial with zero Gateway transcript workers launched (46.74 s wall).
  • Type-aware lint: core scope passed (142.89 s wall); root test scope passed (53.60 s wall).
  • pnpm run tsgo:core: passed (185.03 s wall).
  • pnpm exec oxfmt --check for all five changed files and git diff --check: passed.
  • Independent Codex autoreview through P2: scoped clean, no actionable findings.
  • Initial local attempts were invalidated by source edits during compiler capture. A discarded source-only fixture required a shared-state broker unavailable in the Vitest thread; the retained regression runs real Node archive execution and passes.
  • The launch-wire E2E is selected in PR CI by the changed src/worker/** inputs. It was not run locally on the loaded host. This PR addresses the missing-worker ownership regression, not the separate stale-session-version failure originally reported in [Bug]: node-worker-launch-wire e2e fails on main: transcript persistence rejected with SessionActorStaleVersionError #169095.

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T05:55:51.159208Z 0c44f59 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: S labels Oct 17, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c44f59c99

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// The Gateway secret store is not delegated to the worker's scratch state.
preparedStoreEnvironment: {},
// Synthetic worker keys have no lineage in the Gateway's session database.
preparedSubagentExecution: false,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Carry subagent status into worker exec

When a cloud-worker turn uses sessions_spawn, worker-session-tool-executor.ts dispatches the child as a worker-turn with agentRunTracking: "native_subagent", but the child's placement tools are created here. Hard-coding this prepared value to false therefore makes every exec from that placed child omit OPENCLAW_SUBAGENT_EXEC=1, so downstream CLI routing treats the child like a top-level turn instead of applying the subagent completion-path behavior. Prepare the actual classification on the Gateway and carry it through the worker launch rather than deriving it from the synthetic worker key.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@steipete
steipete merged commit 2f4fa26 into main Oct 17, 2026
143 of 145 checks passed
@steipete
steipete deleted the steipete/cs-workerbundle-1017 branch October 17, 2026 06:06
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
Since openclaw#169622 the exec tool lazily resolved subagent capabilities from the Gateway session database. Inside a node or cloud worker that reached the Gateway-only session-transcript worker thread, which the worker bundle correctly omits, so every worker exec failed with 'Cannot find module .../bundles/config/sessions/session-transcript.worker.mjs'. Worker placement tools now pass a prepared subagent-execution hint (like the prepared store environment), so worker exec never opens Gateway storage. A bundle regression test keeps Gateway-only workers out of worker tool paths.

Related: openclaw#169095
tideclaw-bot added a commit that referenced this pull request Nov 4, 2026
Adapt the owning exec-isolation fix from 2f4fa26 (#175196) to the release candidate. Retire the candidate-only transcript packaging workaround bac26ba while preserving the candidate's worker permission and authorization contracts.

Exercise the real relocated archive through placement exec: the expected approval denial must follow capability resolution without a Gateway transcript worker in the archive. Retain the SQLite authorization and quarantine assertions.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 321fff48cf4d428af4093bdb41dcb918ade9b9c3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation gateway Gateway runtime size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant