Repository navigation
feat: run Codex sessions on approved paired devices - #127202
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Exact-head fresh AWS paired-device proofTested commit: Provider: direct AWS Crabbox in The clean frozen checkout installed its pinned Node/pnpm dependencies, completed Observed, through the actual owner boundaries:
Security boundary: the node command requires explicit Gateway allowlisting and @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 3:32 PM ET / 19:32 UTC. ClawSweeper reviewWhat this changesThis PR lets Codex sessions use an approved paired device for native execution, adding Gateway placement rules, a node exec-server relay, UI eligibility feedback, documentation, and coverage. Merge readinessKeep open for explicit maintainer review: current main does not yet provide Codex paired-device placement, while direct verification of the pinned Codex exec-server contract is unavailable in this read-only environment. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway selects an eligible paired node, retains model authentication and session ownership, and opens an approved duplex command for Codex native operations. The node runs the managed Codex exec-server and returns its JSON-RPC traffic through the Gateway-owned relay. flowchart LR
A[Codex session] --> B[Gateway placement]
B --> C[Node eligibility and approval]
C --> D[Paired-device command]
D --> E[Codex exec-server]
E --> F[Native process and filesystem work]
E --> G[Gateway session result]
Decision needed
Why: The branch implements a new cross-machine process and credential boundary, and the required exact upstream Codex source was unavailable to this reviewer. Before merge
Findings
Agent review detailsSecurityNeeds attention: No discrete source defect was established, but direct inspection of the upstream protocol and lifecycle contract remains required for this new execution boundary. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the generic runtime-owned placement requirement, then complete a direct audit of the exact Codex 0.148.0 source before accepting the paired-device security and lifecycle contract. Do we have a high-confidence way to reproduce the issue? Not applicable — this is a new capability, not a report of broken existing behavior; the PR supplies a linked real paired-node run as after-fix evidence. Is this the best way to solve the issue? Unclear — the generic placement ownership is coherent in the inspected source, but the exact upstream Codex contract needed to judge the relay could not be directly inspected. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0b8596607208. LabelsLabel justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
|
Exact-head paired-device ownership and live-proof update for The repaired architecture now keeps execution-mode compatibility, runtime-owned device requirements, effective node-command authority, and final pre-provision revalidation at the Gateway placement owner; moves reject incompatible destinations before draining the source. Reconciliation fences the precise persisted local/worker turn claim. Codex transport has separate bounded message/delivery limits, per-lease socket cleanup, one-shot paired-node app-server ownership, placement-unbound Fresh direct AWS proof: https://crabbox.openclaw.ai/portal/runs/run_7f009de1cf14
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Disposition for the exact-head ClawSweeper empty-workdir P1: not accepted; the reported files are completely outside this PR's diff and the existing The branch merge base is Because the branch side equals the merge base for both files, the normal three-way merge takes the changed The review's other rank-up note also has direct evidence in the PR body: the acting maintainer personally inspected the exact pinned sibling Codex source at @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
The remaining ClawSweeper owner-review note is an independent reviewer-environment limitation, not an outstanding source-code finding. I personally rechecked the exact pinned upstream checkout; Direct upstream owner evidence:
The latest exact-head review now reports zero source-code findings and correctly withdrew the unrelated empty-workdir false positive. Its remaining human-owner/security classification reflects the intentional new paired-device execution boundary and the review worker's inability to fetch the public upstream repository; the PR remains open for that maintainer decision and will not be landed by this task. |
|
Merged via squash.
|
* feat(codex): execute paired-device sessions over node carrier * fix(node-host): preserve approved invocation session identity * fix(codex): observe paired-node execution leases before handshake * fix: fence paired-device placement and Codex execution owners * fix: satisfy paired-device placement CI ownership guards * fix(codex): reject credentialed paired-node URL parameters * fix(codex): fence nested remote HTTP session credentials * fix(codex): scrub node process URLs and preserve plaintext HTTP * test(codex): republish node inventory after capability approval
## What Problem This Solves Fixes: the New Session device picker explains a missing Codex harness as an opaque node-command failure when an OpenAI model cannot run on a paired laptop. ## User Impact The reason now explains the model/harness/device relationship first, then gives the node-side install, enable, restart, and approval steps. Users can also choose a model using the OpenClaw harness. It says **unavailable**, rather than incorrectly claiming every disabled or denied plugin is uninstalled. There is no automatic installation, silent harness substitution, or change to node/Gateway approval policy. ## Why This Change Was Made Codex is an official external plugin, not part of the stock npm node package. A source checkout can also contain the plugin without enabling it on the node. The existing node-local plugin loader already declares `codex.exec-server.stdio.v1` only when the plugin is present and enabled; the new integration coverage preserves missing, explicitly disabled, explicitly denied, and enabled cases. No second capability or availability owner is needed. The shared required-command authority owns the explanation used by both device discovery and placement. Pending pairing approval and Gateway policy denial keep their existing, distinct remedies. Provenance: - [#88451](#88451) introduced the unified OpenAI implicit Codex default (`4c33aaa86c1`); [#104685](#104685) moved effective-route policy into the provider (`1b1cebfe421`). Both were located with `git log -S`. - [#127202](#127202) introduced the approved paired-device exec-server command (`1353ce0995c`). - [`d111676bcbf`](d111676) deliberately excluded Codex from the root npm package. This PR preserves that distribution decision. - Inspected upstream Codex `codex-rs/cli/src/exec_server_command.rs` at `c248f6d48b97eb4a2aa56147a0b11b7d763278b9`: stdio execution is native; remote registration/auth is a separate branch. OpenClaw's plugin owns the pinned binary; the ordinary node does not need a separate Codex login to advertise the command. No overlap with Pash/Sarah changes in the changed files. ## Evidence - Regression through the real `environments.list` handler: the new harness explanation assertion fails on `e40606fdea9` with the old command-first message (1 failed / 5 passed), and passes after the fix. - Focused checks: 33 tests passed across the real node plugin-loader integration, node-command policy, and environment-command authority suites. The node integration loads the actual Codex plugin, not a replacement registration fixture. - Rebased cleanly onto `f3af0db8fce`, including main's repair for the earlier duplicate-import failure. Full CI is green on `bb4428fc20492b523f42d812987261c74d27c138`: 57 passed, 54 skipped, no failures or pending checks; [CI gate](https://github.com/openclaw/openclaw/actions/runs/38089723977/job/114324791021). - Before the rebase, formatting, focused lint, core typecheck, and all core-test typecheck groups passed. The broad local changed-file gate stopped at repository-wide dead-export findings outside this patch; final verification is the green rebased CI run. - Actual Control UI before/after captures with deterministic Gateway fixtures, inspected on macOS arm64. The device stays disabled in both images; the improvement is the truthful explanation and recovery choices. The after fixture obtains its message from the production authority function. These are visual reproduction captures, not a live-model execution claim. ### Before  ### After  ## Bounded cost No new imports, network calls, binary downloads, processes, polling, state, configuration, or protocol fields. The existing missing-command branch returns a different string. Production code: +4/-1 lines; tests: +50 lines; documentation: +16 lines. ## Merge danger Two-way door: reverting restores the old explanation. The blast radius is the explanation for an undeclared command owned by the Codex plugin; eligibility, explicit disable/deny decisions, runtime choice, and execution remain unchanged. Co-authored-by: Ayaan Zaidi <[email protected]>
…68641) ## What Problem This Solves Fixes: the New Session device picker explains a missing Codex harness as an opaque node-command failure when an OpenAI model cannot run on a paired laptop. ## User Impact The reason now explains the model/harness/device relationship first, then gives the node-side install, enable, restart, and approval steps. Users can also choose a model using the OpenClaw harness. It says **unavailable**, rather than incorrectly claiming every disabled or denied plugin is uninstalled. There is no automatic installation, silent harness substitution, or change to node/Gateway approval policy. ## Why This Change Was Made Codex is an official external plugin, not part of the stock npm node package. A source checkout can also contain the plugin without enabling it on the node. The existing node-local plugin loader already declares `codex.exec-server.stdio.v1` only when the plugin is present and enabled; the new integration coverage preserves missing, explicitly disabled, explicitly denied, and enabled cases. No second capability or availability owner is needed. The shared required-command authority owns the explanation used by both device discovery and placement. Pending pairing approval and Gateway policy denial keep their existing, distinct remedies. Provenance: - [openclaw#88451](openclaw#88451) introduced the unified OpenAI implicit Codex default (`d56b73b6126`); [openclaw#104685](openclaw#104685) moved effective-route policy into the provider (`e00b05b5f3c`). Both were located with `git log -S`. - [openclaw#127202](openclaw#127202) introduced the approved paired-device exec-server command (`a3a58230b7f`). - [`47375e78b00`](openclaw@47375e7) deliberately excluded Codex from the root npm package. This PR preserves that distribution decision. - Inspected upstream Codex `codex-rs/cli/src/exec_server_command.rs` at `c248f6d48b97eb4a2aa56147a0b11b7d763278b9`: stdio execution is native; remote registration/auth is a separate branch. OpenClaw's plugin owns the pinned binary; the ordinary node does not need a separate Codex login to advertise the command. No overlap with Pash/Sarah changes in the changed files. ## Evidence - Regression through the real `environments.list` handler: the new harness explanation assertion fails on `d1abe907cb7` with the old command-first message (1 failed / 5 passed), and passes after the fix. - Focused checks: 33 tests passed across the real node plugin-loader integration, node-command policy, and environment-command authority suites. The node integration loads the actual Codex plugin, not a replacement registration fixture. - Rebased cleanly onto `bf08a7bc8c4`, including main's repair for the earlier duplicate-import failure. Full CI is green on `bb4428fc20492b523f42d812987261c74d27c138`: 57 passed, 54 skipped, no failures or pending checks; [CI gate](https://github.com/openclaw/openclaw/actions/runs/38089723977/job/114324791021). - Before the rebase, formatting, focused lint, core typecheck, and all core-test typecheck groups passed. The broad local changed-file gate stopped at repository-wide dead-export findings outside this patch; final verification is the green rebased CI run. - Actual Control UI before/after captures with deterministic Gateway fixtures, inspected on macOS arm64. The device stays disabled in both images; the improvement is the truthful explanation and recovery choices. The after fixture obtains its message from the production authority function. These are visual reproduction captures, not a live-model execution claim. ### Before  ### After  ## Bounded cost No new imports, network calls, binary downloads, processes, polling, state, configuration, or protocol fields. The existing missing-command branch returns a different string. Production code: +4/-1 lines; tests: +50 lines; documentation: +16 lines. ## Merge danger Two-way door: reverting restores the old explanation. The blast radius is the explanation for an undeclared command owned by the Codex plugin; eligibility, explicit disable/deny decisions, runtime choice, and execution remain unchanged. Co-authored-by: Ayaan Zaidi <[email protected]>
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.
What Problem This Solves
Codex sessions previously rejected paired-device placement even when a healthy paired OpenClaw node was available. Operators could not retain model authentication and inference on the Gateway while running a Codex task's real process, filesystem, capability-discovery, and credential-free HTTP sandbox operations on their own explicitly approved device.
The initial carrier also had eight connected owner-boundary defects: profile-incompatible moves could drain their still-active source; forced abandonment could not fence a local remote-exec turn claim; eligibility confused worker capacity, declared capabilities, and effective command authority; a legal maximum-size response could starve its following notification; one relay lease outlived its release; successive fresh environments accumulated in a shared upstream app-server; unbound native side questions could race placement operations; and authenticated HTTP headers could cross the Gateway-to-device trust boundary.
Why This Change Was Made
The Codex plugin now declares a generic runtime-owned paired-device requirement: its explicitly allowed
codex.exec-server.stdio.v1command is required, but direct stdio execution consumes no OpenClaw worker slot. Built-in OpenClaw turns require a slot and no plugin command. The Gateway projects declared capabilities separately from sorted, bounded, effectively invocable commands, evaluates one shared placement decision in New Session, Move Session, direct dispatch, and destination resolution, and revalidates the authoritative live node immediately before provisioning.Profile execution-mode compatibility is checked before any move barrier, durable intent, drain, or source teardown. Reconciliation fences the exact persisted local-or-worker turn claim, including the worker-only owner epoch, while retaining exact source/environment/generation and pending-result/tool-state guards. Device transport availability no longer pretends that every runtime consumes worker capacity.
The explicitly approved node command starts the existing pinned Codex binary directly as
codex exec-server --listen stdio. Generic framing now distinguishes the upstream 64 MiB per-message ceiling from the separately bounded outstanding-delivery envelope; each execution lease owns and closes only its own node channel and loopback socket. Each paired-node attempt uses an isolated app-server lifetime because upstream 0.148.0 exposesenvironment/addbut no environment removal. Local, SSH, supervision, and native-subagent clients retain their existing sharing semantics.Native
/btwquestions fail closed for paired-node placements before any client, environment, approval, or node channel is opened; local and SSH side questions are unchanged. At the Gateway relay boundary, credential-bearing or ambiguous HTTP headers, URLs, and structured bodies are rejected before any node frame is sent, with actionable guidance to run authenticated HTTP on the Gateway or use an intentionally credential-free endpoint; credentialed connection URLs are also removed from process environment maps. Non-sensitive headers, streamed HTTP, ordinary plaintext bodies, redirects, and reverse requests remain intact.Execution remains bound to the exact live node, session, environment, owner epoch, placement generation, and canonical node-managed workspace. Canonical critical-risk allow-once approval remains mandatory. No new Gateway method, worker child, SSH fallback, protocol-version bump, SQLite schema bump, dependency, automatic reconnect/resume, cloud-credential transfer, or hosted-runner activation is introduced.
An approved command runs with the node operating-system account's permissions. The managed-workspace binding is an execution-ownership boundary, not an operating-system filesystem sandbox.
User Impact
New Session and Move Session now make the actual placement rules visible: an enabled Codex device remains eligible at zero worker slots, an OpenClaw worker turn does not, and declared commands without effective Gateway approval are disabled with actionable enablement guidance. Incompatible profile moves preserve the active source unchanged; explicit abandonment can immediately recover an offline Codex placement without waiting for an unreachable node acknowledgement.
Node disconnection, cancellation, command exit, Gateway shutdown, or plugin retirement visibly terminates and cleans up only the correct attempt. Credentialed remote HTTP is intentionally refused instead of silently stripping authentication.
Evidence
Control UI
With the built-in OpenClaw runtime, the zero-slot paired device is disabled while a device with available worker capacity remains selectable:
With Codex, the same zero-slot device is selectable, while a device lacking the effectively allowed exec-server command is disabled:
Fresh direct AWS paired-device proof
8075cc181c8c4505e1188424227f3c586ea0a0b6.eu-west-1, public network, no Tailscale, no IAM instance profile, no hydration, CI-only environment forwarding; IMDSv2 IAM credentials returned404.@openai/[email protected]exec-server; inference responses use a deterministic mock provider and are not represented as live model inference.workerRuns.available=0without introducing a production-only configuration seam, and manufacturing the offline active-claim release race on a live node would require an unsafe timing/injection hook; those two live variants are therefore reported as owner-regression proof, not fabricated remote observations.Local and owner-boundary validation
/btw; and bearer, OAuth-style, cookie, API-key, mixed-case, repeated, ambiguous, and safe HTTP headers.OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build. Exact-head real paired-device E2E:OPENCLAW_E2E_VERBOSE=1 OPENCLAW_E2E_USE_PREBUILT_DIST=1 pnpm test test/e2e/qa-lab/runtime/codex-node-exec-server.e2e.test.ts.origin/main, through P1, reports no accepted/actionable findings; secret scanning is clean. Both intermediate branch-owned CI failures were reproduced, repaired, re-reviewed, and covered before pushing this exact head.git diff origin/main...HEAD -- src/agents/bash-tools.exec-workdir.ts src/agents/bash-tools.exec-workdir.test.tsis empty, and both PR-head file blobs exactly match their merge-base blobs. The empty-workdir repair was added independently tomainin6132c6f6cba00866d62e3ecb9234213bde55da74after this branch forked. An ordinary three-way merge retains that newermainchange because this branch never touched either file; cherry-picking or rebasing solely to silence a head-versus-main false positive would add unrelated work and is intentionally not done.Personally verified upstream Codex contracts
The npm provenance for
@openai/[email protected]resolves to immutable tagrust-v0.148.0, commit3ba0f711642a888aec92a611a3f3b2211157ff89. That exact sibling source was inspected directly, and the managed binary is exercised in contract/full-stack tests:codex-rs/exec-server/src/server/transport.rs:63-67,84-109,131-157: single-connection direct stdio transport, no worker child, terminal shutdown, no detached-session resumption.codex-rs/exec-server/src/connection.rs:33-36,237-246,276-324,366,617: newline-delimited JSON-RPC, bounded channels, and the exact upstream 64 MiB per-message ceiling.codex-rs/exec-server-protocol/src/protocol.rs:19-56,74-105,211-254andcodex-rs/exec-server-protocol/src/rpc.rs:52-80,235-265: initialize, process/filesystem/environment/capability/HTTP methods, bounded HTTP chunks, and bidirectional JSON-RPC envelopes.codex-rs/app-server-protocol/src/protocol/common.rs:1101-1106,codex-rs/app-server/src/request_processors/environment_processor.rs:15-27, andcodex-rs/exec-server/src/environment.rs:84-86,462-480: app-serverenvironment/addinserts into its global environment map without a corresponding remove operation; isolated paired-node client retirement is therefore mandatory.codex-rs/exec-server/src/local_file_system.rs:809-826andcodex-rs/exec-server/src/server/file_system_handler.rs:122-149: unsandboxed requests use the node account's ordinary filesystem access.codex-rs/exec-server/src/network_policy_decisions.rs:15-20,26-73andcodex-rs/exec-server/src/local_process.rs:224-236,291-373,477-658: reverse policy decisions and connection-owned process lifecycle.codex-rs/exec-server/src/client_recovery.rs:56-61andcodex-rs/exec-server/src/server/session_registry.rs:18-20,133,196: websocket recovery windows deliberately unused by this disconnect-terminal stdio slice.codex-rs/core/src/environment_selection.rs:214-292: upstream environment selection and connection identity ownership.