Repository navigation
fix(workers): restore exec in node and cloud workers - #175196
Conversation
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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, |
There was a problem hiding this comment.
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 👍 / 👎.
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
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)
Related: #169095
What Problem This Solves
Fixes: node and cloud worker
execcalls fail with a missingsession-transcript.worker.mjsmodule 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
node-worker-launch-wire.e2e.test.ts:441. The permission-phase exec result contains the missing module error.tsdown.config.ts:995) and archive inventory (src/shared/worker-bundle-hash.ts:14) deliberately omitsession-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.pnpm run tsgo:core: passed (185.03 s wall).pnpm exec oxfmt --checkfor all five changed files andgit diff --check: passed.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.