Skip to content

feat: run Codex sessions on approved paired devices - #127202

Merged
steipete merged 9 commits into
mainfrom
steipete/codex-node-exec-server-carrier
Aug 21, 2026
Merged

steipete merged 9 commits into
mainfrom
steipete/codex-node-exec-server-carrier

Conversation

@steipete

@steipete steipete commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor
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.v1 command 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 exposes environment/add but no environment removal. Local, SSH, supervision, and native-subagent clients retain their existing sharing semantics.

Native /btw questions 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:

OpenClaw runtime disables the zero-slot paired device

With Codex, the same zero-slot device is selectable, while a device lacking the effectively allowed exec-server command is disabled:

Codex enables the zero-slot device and disables the denied-command device

Fresh direct AWS paired-device proof

  • Frozen, clean tested head: 8075cc181c8c4505e1188424227f3c586ea0a0b6.
  • Provider: fresh direct AWS Crabbox in eu-west-1, public network, no Tailscale, no IAM instance profile, no hydration, CI-only environment forwarding; IMDSv2 IAM credentials returned 404.
  • Auditable successful exact-head build and real paired-node execution: https://crabbox.openclaw.ai/portal/runs/run_7f009de1cf14.
  • Actual isolated Gateway, paired headless node, Codex plugin, Gateway-local app-server, and pinned @openai/[email protected] exec-server; inference responses use a deterministic mock provider and are not represented as live model inference.
  • Observed missing/denied command rejection before provisioning, approval, or child creation; explicit critical-risk approval; real process execution, stdin/output, filesystem mutation and reconciliation, capability discovery, streamed credential-free HTTP, credential-canary absence, terminal disconnect cleanup, and a fresh attempt after the same paired identity reconnects; no OpenClaw worker child.
  • Exact-owner deterministic regressions prove the zero-worker-slot Codex/OpenClaw distinction, incompatible-profile source preservation, and offline local-claim force fencing. The real node fixture cannot honestly force workerRuns.available=0 without 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.
  • The fresh AWS lease is stopped and zero owned active resources are independently verified.

Local and owner-boundary validation

  • Failing-before/fixed-after owner regressions cover profile mismatch/source preservation; exact local and worker claim CAS, stale copies, and force abandon; zero-slot Codex vs. OpenClaw; declared-but-denied, missing, allowed, disconnected, and stale commands; direct dispatch and last-moment pre-provision revalidation; both Control UI pickers; exact 64 MiB response plus following notification and 64 MiB + 1 rejection; concurrent lease/socket ownership; repeated/overlapping isolated app-server attempts; placement-unbound /btw; and bearer, OAuth-style, cookie, API-key, mixed-case, repeated, ambiguous, and safe HTTP headers.
  • Focused Gateway owner matrix: 24 test files / 386 passing tests. Final Codex relay credential/lifecycle owner: 67 passing tests; paired-device side-question owner: 69 passing tests. Generic node-duplex framing: 62 passing tests. Exact local/worker turn-claim closure: 56 passing tests. Control UI unit matrix: 90 passing tests plus real Chromium screenshot-backed end-to-end picker proof.
  • Real Gateway startup integration and Codex relay security rerun on the exact repair commit: 5 files / 61 passing tests; production core/plugin types and corresponding core/plugin test types pass.
  • Full changed gate passes production and test types, complete core/plugin/scripts and Swift lint, changed suites, docs, format, assertion/coercion/schema/dependency guards, SDK boundaries, macOS CI test shards, and zero runtime import cycles. Generated Gateway protocol TypeScript/Swift/Kotlin contracts are unchanged; SQLite remains schema v9.
  • Full build: 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.
  • Full fresh branch Codex autoreview against 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.
  • Branch delta relative to the frozen merge base: production +2,449/-354 (net +2,095, 76 files), tests/test-support +5,377/-424 (net +4,953, 45 files), docs +217/-30 (net +187, 7 files), generated Swift protocol projection +16 (1 file). Production growth supplies the new Codex-owned node command/stdio bridge and relay plus explicit eligibility, exact lifecycle/claim fencing, bounded transport, and credential ownership; shared node transport and existing local/SSH owners are reused.
  • Named pre-existing follow-up: in-place node capability reapproval rotates the pairing generation and correctly retires its generation-bound runner inventory, but the already-connected node is not asked to republish. The real E2E establishes a fresh node handshake after capability approval; production reconnect/protocol behavior is intentionally unchanged in this PR.
  • Exact-head ClawSweeper review disposition: the reported empty-workdir P1 is not introduced or modified by this PR. git diff origin/main...HEAD -- src/agents/bash-tools.exec-workdir.ts src/agents/bash-tools.exec-workdir.test.ts is empty, and both PR-head file blobs exactly match their merge-base blobs. The empty-workdir repair was added independently to main in 6132c6f6cba00866d62e3ecb9234213bde55da74 after this branch forked. An ordinary three-way merge retains that newer main change 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 tag rust-v0.148.0, commit 3ba0f711642a888aec92a611a3f3b2211157ff89. 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-254 and codex-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, and codex-rs/exec-server/src/environment.rs:84-86,462-480: app-server environment/add inserts 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-826 and codex-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-73 and codex-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-61 and codex-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.

@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime commands Command implementations agents Agent runtime and tooling extensions: codex plugin: file-transfer size: XL maintainer Maintainer-authored PR labels Aug 21, 2026
@steipete
steipete marked this pull request as ready for review August 21, 2026 13:47
@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head fresh AWS paired-device proof

Tested commit: 2d0a69b271369a5c07840cbe8f9a1c3dbd572d02

Provider: direct AWS Crabbox in eu-west-1 on fresh public-network lease
cbx_2be35f35a8b0 with no Tailscale, no IAM instance profile, no hydration,
and only CI forwarded. The instance's IMDSv2 IAM credential endpoint returned
404. Run: https://crabbox.openclaw.ai/portal/runs/run_593bf8d43f00

The clean frozen checkout installed its pinned Node/pnpm dependencies, completed
the full OpenClaw build (including 61 plugins and all 146 public plugin SDK
subpaths), and passed the actual managed @openai/[email protected] binary's direct
node-command contract tests before exercising a real isolated Gateway, real
paired headless node, actual Codex app-server, and actual stdio exec-server.
Only model-inference content was provided by a deterministic mock; model
inference was not live.

Observed, through the actual owner boundaries:

  • Denied critical-risk approval launched no node child; explicit allow-once
    launched exactly one approved Codex exec-server.
  • Real remote process execution, stdin/output, filesystem mutation,
    capability discovery, and streamed HTTP succeeded.
  • The remote filesystem mutation reconciled into the managed worktree.
  • Provider, forge, cloud, and runtime-injection credential canaries did not
    reach the node process or nested process/start environment.
  • Disconnect during execution visibly terminated the old attempt, reaped the
    child process, and did not resume it.
  • The same paired identity reconnected and a separate fresh approved attempt
    succeeded; no OpenClaw worker child was launched.
  • SSH remote-exec ownership remains independently covered by the focused
    existing placement/sandbox suite.
  • The AWS lease was stopped and the provider reported zero owned active
    resources afterward.

Security boundary: the node command requires explicit Gateway allowlisting and
canonical high-risk approval, but approval grants the node operating-system
account's existing process/filesystem permissions; the managed worktree is not
an OS-level filesystem sandbox. Disconnect/reconnect resume is deliberately not
implemented in this slice.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 21, 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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 21, 2026
@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 3:32 PM ET / 19:32 UTC.

ClawSweeper review

What this changes

This 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 readiness

⚠️ Needs maintainer review before merge - 5 items remain

Keep 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
Reviewed head: 8075cc181c8c4505e1188424227f3c586ea0a0b6
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The submitted real-run evidence is strong, but independent upstream-contract review is still needed for the cross-machine execution boundary.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR body provides a linked exact-head paired-node run with observed process, filesystem, HTTP, disconnect, cleanup, and reconnect outcomes; local inability to open the artifact does not negate contributor proof.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR body provides a linked exact-head paired-node run with observed process, filesystem, HTTP, disconnect, cleanup, and reconnect outcomes; local inability to open the artifact does not negate contributor proof.
Evidence reviewed 6 items Current main lacks the requested capability: Current main declares Codex remote execution but has no paired-device requirement; the PR head adds the explicit node command and zero-worker-slot requirement.
Placement owner revalidates authorization: The branch resolves command allowlist eligibility and reruns it after workspace preparation before durable provisioning.
Node command is bound to managed workspace authority: The new duplex command requires an exact session, environment, owner epoch, and managed workspace before starting the child process.
Findings None None.
Security Needs attention Verify the pinned exec-server contract: The relay launches codex exec-server --listen stdio and enforces an assumed framing limit; the exact upstream 0.148.0 source was unavailable locally, so this contract must be checked before merge.

How this fits together

The 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]
Loading

Decision needed

Question Recommendation
Should the new Codex paired-device exec-server boundary, including explicit command allowlisting and one-time critical approval, be accepted after direct review of the pinned upstream contract? Complete the upstream contract audit: Inspect the exact @openai/codex 0.148.0 exec-server source and retain the PR if its transport, environment, and shutdown assumptions match.

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

  • Resolve security concern: Verify the pinned exec-server contract - The relay launches codex exec-server --listen stdio and enforces an assumed framing limit; the exact upstream 0.148.0 source was unavailable locally, so this contract must be checked before merge.
  • Resolve merge risk (P1) - The execution relay assumes the pinned Codex 0.148.0 exec-server framing and lifecycle contract, which could not be directly audited because the required sibling source is unavailable.
  • Resolve merge risk (P1) - This new paired-device execution path requires an explicit high-risk command allowlist and per-attempt approval; maintainers should confirm that this operator contract is the intended permanent boundary.
  • Complete next step (P2) - A maintainer must complete the required exact-version Codex contract audit and accept the new security boundary; this is not a safe automated repair task.

Findings

  • [medium] Verify the pinned exec-server contract — extensions/codex/src/node-exec-server.runtime.ts:193
Agent review details

Security

Needs 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

Metric Value Why it matters
Production versus test delta production +2,449/-354; tests and test support +5,377/-424; docs +217/-30 The reported feature scope spans plugin, Gateway, node host, protocol, UI, and owner-boundary regression coverage.
New operator authorization path 1 explicit node command: codex.exec-server.stdio.v1 Existing operators must deliberately allow this high-risk paired-device command before the new capability is selectable.

Stored data model

Persistent data-model change detected: database schema: packages/gateway-protocol/src/schema/agents-models-skills.test.ts, database schema: packages/gateway-protocol/src/schema/environments.test.ts, durable storage schema: src/gateway/worker-environments/reclaimed-placement-redispatch.test.ts, durable storage schema: src/gateway/worker-environments/reclaimed-placement-redispatch.ts, durable storage schema: src/gateway/worker-environments/service-contract.ts, durable storage schema: src/gateway/worker-environments/service-validation.ts, and 14 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Audit the pinned upstream contract before merge (recommended)
    Verify the exact Codex 0.148.0 exec-server framing, environment registration, and shutdown behavior against its source before accepting this relay.
  2. Pause for boundary ownership review
    Do not merge until an owner accepts the paired-device process and credential boundary as the intended product contract.

Technical review

Best 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.

Labels

Label justifications:

  • P1: This changes an agent execution workflow across Gateway and paired-device boundaries.
  • merge-risk: 🚨 compatibility: Codex placement selection and paired-node eligibility gain a new operator-configured execution mode.
  • merge-risk: 🚨 security-boundary: The PR introduces a Gateway-to-device process relay and filters credential-bearing HTTP before it crosses that boundary.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (linked_artifact): The PR body provides a linked exact-head paired-node run with observed process, filesystem, HTTP, disconnect, cleanup, and reconnect outcomes; local inability to open the artifact does not negate contributor proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides a linked exact-head paired-node run with observed process, filesystem, HTTP, disconnect, cleanup, and reconnect outcomes; local inability to open the artifact does not negate contributor proof.

Evidence

Security concerns:

  • [medium] Verify the pinned exec-server contract — extensions/codex/src/node-exec-server.runtime.ts:193
    The relay launches codex exec-server --listen stdio and enforces an assumed framing limit; the exact upstream 0.148.0 source was unavailable locally, so this contract must be checked before merge.
    Confidence: 0.92

What I checked:

Likely related people:

  • pash-openai: Current-main history shows the latest substantive Codex harness change immediately preceding this feature branch. (role: recent Codex harness contributor; confidence: medium; commits: 264cc9940529; files: extensions/codex/harness.ts)

Rank-up moves

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

  • Provide or perform a direct source audit of the exact @openai/codex 0.148.0 exec-server contract before merge.

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 (8 earlier review cycles)
  • reviewed 2026-08-21T13:55:31.614Z sha 2d0a69b :: found issues before merge. :: [P1] Restore empty-workdir normalization | [P2] Preserve structured error causes | [P2] Preserve Cron trigger alignment
  • reviewed 2026-08-21T14:40:03.443Z sha 2d0a69b :: found issues before merge. :: [P1] Restore empty-workdir normalization | [P2] Preserve structured disconnect causes | [P2] Retain Cron condition activity
  • reviewed 2026-08-21T17:06:15.678Z sha 1c3e135 :: needs changes before merge. :: [P1] Restore exact-empty workdir normalization
  • reviewed 2026-08-21T17:19:42.098Z sha 89cf6d8 :: found issues before merge. :: [P1] Restore exact-empty workdir normalization
  • reviewed 2026-08-21T17:37:37.806Z sha 1022619 :: found issues before merge. :: [P1] Restore exact-empty workdir normalization | [P1] Bind the exec-server policy to a live placement claim
  • reviewed 2026-08-21T17:55:31.485Z sha 5ecf0f4 :: found issues before merge. :: [P1] Treat exact-empty workdir as omitted
  • reviewed 2026-08-21T18:56:07.620Z sha 8075cc1 :: found issues before merge. :: [P1] Treat exact-empty workdir as omitted
  • reviewed 2026-08-21T19:21:18.848Z sha 8075cc1 :: needs changes before merge. :: [P1] Treat exact-empty workdir as omitted

@clawsweeper clawsweeper Bot added proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 21, 2026
@steipete
steipete requested a review from a team as a code owner August 21, 2026 16:46
@clawsweeper clawsweeper Bot removed the rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. label Aug 21, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 21, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 21, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head paired-device ownership and live-proof update for 8075cc181c8c4505e1188424227f3c586ea0a0b6.

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 /btw rejection, and fail-closed credential filtering across HTTP headers/URLs/structured bodies and process-environment connection URLs. Ordinary streamed/plaintext HTTP remains supported.

Fresh direct AWS proof: https://crabbox.openclaw.ai/portal/runs/run_7f009de1cf14

  • Fresh public AWS instance, no Tailscale, no attached IAM role, no hydration, CI-only forwarded environment; independent IMDSv2 IAM credentials response: 404.
  • Exact full head verified from the clean public-repository merge base plus a locally generated Git bundle before installing or executing branch code.
  • Pinned Node 24.15.0 and pnpm 11.15.1; clean frozen-lockfile install across all workspace packages; full OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build.
  • Real Gateway, real paired node, real pinned @openai/[email protected] app/exec servers, actual process/stdin/fs/capability/credential-free streamed HTTP, approval, workspace reconciliation, terminal disconnect, same-identity reconnect as a fresh attempt, and zero OpenClaw worker children. Model inference uses a deterministic mock provider.
  • Missing/denied node command rejects before provisioning, approval, or child creation; credential canaries stay absent; the owned lease is stopped and zero active resources are independently verified.
  • Zero-slot Codex vs. capacity-gated OpenClaw, incompatible-profile source preservation, offline local-claim forced abandonment, stale claims, nested/encoded/header/body/process-URL credentials, 64 MiB delivery boundaries, overlapping leases, and client retirement are proven in deterministic exact-owner regressions. Forcing zero available worker slots on the real node would require a new production-only configuration seam, and constructing the offline active-claim race live would require an unsafe timing hook; those two cases are not misrepresented as live observations.
  • Focused Gateway owner matrix: 24 files / 386 tests; final relay credential/lifecycle owner: 67 tests; paired-device side-question owner: 69 tests; generic node-duplex: 62 tests; local/worker turn-claim closure: 56 tests; UI: 90 unit tests plus real Chromium screenshot-backed checks.
  • Exact-head GitHub CI: https://github.com/openclaw/openclaw/actions/runs/32515199802.
  • Full two-pass Codex branch autoreview through P1: zero accepted/actionable findings; TruffleHog clean.
  • Branch LOC vs merge base: production +2,449/-354, tests/test support +5,377/-424, docs +217/-30, generated Swift +16. No protocol-version change, SQLite schema bump, dependency change, or SSH/reconnect compatibility path.
  • Named pre-existing follow-up: in-place node capability reapproval rotates pairing generation and retires its generation-bound runner inventory without asking the live node to republish; a fresh real-node handshake restores enrollment. This unrelated production reconnect behavior is intentionally unchanged.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 21, 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 proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 21, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Disposition for the exact-head ClawSweeper empty-workdir P1: not accepted; the reported files are completely outside this PR's diff and the existing main fix is preserved by a normal merge.

The branch merge base is efbcb57569abb684b43c481058f76b1f9ec63f5e; its current head is 8075cc181c8c4505e1188424227f3c586ea0a0b6. Direct evidence:

git diff origin/main...HEAD -- src/agents/bash-tools.exec-workdir.ts src/agents/bash-tools.exec-workdir.test.ts
# empty

git log efbcb57569abb684b43c481058f76b1f9ec63f5e..HEAD -- src/agents/bash-tools.exec-workdir.ts src/agents/bash-tools.exec-workdir.test.ts
# empty

src/agents/bash-tools.exec-workdir.ts
  merge-base blob: 2d10671b36b9c41daea549d237d135df042eea15
  PR-head blob:    2d10671b36b9c41daea549d237d135df042eea15
  current-main:    156491b5853d11d73f52df7f75441438d56e5f6d

src/agents/bash-tools.exec-workdir.test.ts
  merge-base blob: 54615f6f707e2f3ab2fdfdcb5fc931e86860f826
  PR-head blob:    54615f6f707e2f3ab2fdfdcb5fc931e86860f826
  current-main:    aeef606b37f83584f0bac56fd9f6e6beeb1bbf5c

current-main-only commit:
6132c6f6cba00866d62e3ecb9234213bde55da74 fix: exec treats empty workdir from models as omitted (#126509)

Because the branch side equals the merge base for both files, the normal three-way merge takes the changed main versions, including the exact-empty handling and its tests. The branch does not delete, overwrite, or regress them. Copying that unrelated later main fix onto this branch or rebasing solely because main advanced would manufacture unnecessary churn and invalidate already-green exact-head CI and fresh AWS proof.

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 rust-v0.148.0 / 3ba0f711642a888aec92a611a3f3b2211157ff89; the inspected upstream file/line references and real binary proof are listed under Personally verified upstream Codex contracts.

@clawsweeper re-review

@clawsweeper

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

@steipete

Copy link
Copy Markdown
Contributor Author

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; @openai/[email protected] resolves to immutable tag rust-v0.148.0 at 3ba0f711642a888aec92a611a3f3b2211157ff89.

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.

@steipete
steipete merged commit 1353ce0 into main Aug 21, 2026
442 of 444 checks passed
@steipete
steipete deleted the steipete/codex-node-exec-server-carrier branch August 21, 2026 19:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 22, 2026
* 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
obviyus added a commit that referenced this pull request Oct 10, 2026
## 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

![Before: opaque missing command explanation](https://github.com/user-attachments/assets/93c2cdbf-88b3-4357-9442-375f2223f494)

### After

![After: model harness and node-side recovery explanation](https://github.com/user-attachments/assets/ae4e0419-bb46-4401-b801-4acecc32d115)

## 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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…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

![Before: opaque missing command explanation](https://github.com/user-attachments/assets/93c2cdbf-88b3-4357-9442-375f2223f494)

### After

![After: model harness and node-side recovery explanation](https://github.com/user-attachments/assets/ae4e0419-bb46-4401-b801-4acecc32d115)

## 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui commands Command implementations docs Improvements or additions to documentation extensions: codex gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. plugin: file-transfer proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant