Repository navigation
feat: cloud workers for the codex runtime (remote-exec placements) - #123743
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 14, 2026, 7:19 PM ET / 23:19 UTC. ClawSweeper reviewWhat this changesAdds a remote-exec cloud placement mode so Codex sessions retain their app server on the Gateway while tool execution uses a leased SSH worker. Merge readinessKeep open: the previous P2 remains unresolved because a generic cloud-placement capability is implemented through local casts rather than the public harness contract; exact-head Codex security review is also blocked by unavailable source. Priority: P2 Review scores
Verification
How this fits togetherCloud-worker placement provisions and synchronizes a managed workspace on an ephemeral machine. This change lets a Codex harness use that machine as an SSH-backed sandbox while Gateway-owned session state and authentication remain local. flowchart LR
A[Session dispatch] --> B[Harness capability]
B --> C[Cloud placement mode]
C --> D[Leased worker workspace]
D --> E[SSH sandbox execution]
E --> F[Gateway session and auth]
Decision needed
Why: The PR body and core resolver make the capability generic, while the author intentionally deferred the public Plugin SDK contract decision. Before merge
Findings
Agent review detailsSecurityNeeds attention: The PR changes a credential and remote-execution boundary, but direct verification of the exact Codex environment contract is unavailable here. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Add one optional generic cloud-placement capability to the shared AgentHarness contract, document and type-test it, regenerate the SDK baseline, and remove the Codex/core casts before merging. Do we have a high-confidence way to reproduce the issue? Not applicable to a feature request; the PR body supplies live after-fix evidence, but the exact head and attached media could not be independently fetched in this environment. Is this the best way to solve the issue? No: the proposed local type intersections are not the best solution because core reads the capability generically through the public harness registration boundary. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0fdf3ae36ca2. 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 (5 earlier review cycles)
|
7e3f596 to
d732afe
Compare
d732afe to
32d118f
Compare
32d118f to
c0178ab
Compare
|
ClawSweeper follow-up on the latest review and
The red-main merge-tree repair is documented in the PR body: the maintenance cadence assertions were consolidated without losing startup/minute/hour coverage, clearing the max-lines gate with a net 12-line test reduction. |
c0178ab to
29f489c
Compare
Crabbox lease keys default to ~/Library/Application Support/... on macOS; unquoted IdentityFile/UserKnownHostsFile/CertificateFile arguments tokenize on the space and fail as 'extra arguments'. Found via live remote-exec cloud-worker proof.
29f489c to
ffcc68f
Compare
|
ClawSweeper exact-head disposition for
The only exact-head follow-up commit is the CI declaration-cache invalidation for the state migration type contract; it does not change either product decision above. Exact-head CI is running now, and landing will wait for its final result. |
|
Merged via squash.
|
…penclaw#123743) * feat(gateway): add remote-exec cloud placements * feat(codex): run cloud turns through remote exec * fix(sandbox): quote ssh_config path directives containing whitespace Crabbox lease keys default to ~/Library/Application Support/... on macOS; unquoted IdentityFile/UserKnownHostsFile/CertificateFile arguments tokenize on the space and fail as 'extra arguments'. Found via live remote-exec cloud-worker proof. * test: consolidate gateway maintenance schedule coverage * fix(ci): invalidate plugin sdk declarations on state changes
What Problem This Solves
Cloud workers were hard-gated to the OpenClaw runtime:
sessions.dispatchrejected any otherruntime and the Control UI greyed the Cloud target with "Cloud workers require the OpenClaw
runtime; codex is selected." Operators using the Codex harness could not run sessions on
throwaway cloud machines at all.
Why This Change Was Made
The Codex app-server cannot use the worker-turn split (its agent loop, inference, and auth live
inside the Codex binary), but it does not need to: the codex plugin already routes native
exec/fs/http through the sandbox exec-server backed by a pluggable sandbox backend. This PR adds
a second placement execution mode,
remote-exec, that reuses the entire existing provisioningpipeline (crabbox lease, bundle bootstrap, pinned SSH, managed-worktree sync) and runs codex
turns on the Gateway with a placement-owned SSH sandbox context pointed at the leased box.
Architecture:
isWorkerPlacementSessionRuntimeSupported(hardcodedopenclaw) isreplaced by a runtime→execution-mode resolver.
openclaw→worker-turn(unchanged); aharness may declare
cloudPlacement: { mode: "remote-exec" }(codex does); everything elsestays refused with a generic message. The fact rides
GatewayAgentRuntime.cloudPlacementSupported(additive protocol field) so the UI gates on the advertised capability instead of a hardcoded id.
worker_session_placementsgains nullableexecution_modeand a revised claim CHECK so active/draining placements admitenvironment/epoch-fenced local claims only for
remote-exec; worker claims stay exclusiveto worker-turn. NULL reads as worker-turn; v7→v8 migration + downgrade-reader proof included.
fenced claim, then reuses the existing workspace quiescence + reconciliation before claim
release. Worker-turn behavior is untouched.
(pinned host key, per-lease key) into SSH sandbox settings with a preprovisioned-workdir mode
(adopts the synced remote worktree exactly; never uploads its own copy). Sandbox runtime ids
include environmentId + ownerEpoch + placementGeneration to fence stale exec-server reuse.
hard, actionable error); credential env vars are scrubbed unconditionally at the exec-server
process/startboundary (verified upstream: Codex's default ShellEnvironmentPolicy inheritsthe full parent env with secret-name excludes disabled — codex-rs/protocol/src/config_types.rs).
environment/addcarries only an id + loopback URL; no auth material can reach the box.IdentityFileunquoted; crabbox leasekeys live under "Application Support" (space) → "extra arguments" parse failure. Path
directives are now quoted (pre-existing latent bug in the SSH sandbox backend).
User Impact
Codex-runtime sessions can dispatch to cloud workers. The Codex app-server and all its auth
(ChatGPT subscription or API key) stay on the Gateway host; only shell/file/network work
executes on the leased box, and the box holds zero credential material. The Cloud picker enables
for codex models; unsupported runtimes keep a generic explanatory tooltip. Worker-turn (OpenClaw
runtime) behavior, config surface, and defaults are unchanged; no new config keys.
Release-note context: feat(gateway/codex): cloud workers now support the Codex harness via a
remote-exec placement mode — Codex auth stays on the Gateway, execution happens on the leased box.
Evidence
OPENCLAW_STATE_DIR, dev gateway :19310):proof-repo ⎇ crisp-krill;on-box output
hostname=ip-172-31-40-100,uname= Ubuntu-awskernel, DMI board vendorAmazon EC2, usercrabbox; file edit reconciled back into the Gateway's managed worktree.openai:manual [openai/api_key]profile; fresh dispatch, on-box turn (hostname=ip-172-31-32-42, usercrabbox), and+proof-api-key-modereconciled back into the managed worktree (screenshots + video below).~/.codex, no codex binary, zerocodex/openai/api_key env vars on the box.
active | remote-exec | localclaim(impossible under schema v7's CHECK).
box teardown surfaces as a failed placement with recorded reason
("cloud worker disappeared: environment state destroyed") — visible outcome, no silent path.
regression-tested (
ssh.test.tsquoting case fails pre-fix).claims, worker-turn launcher, placement sandbox, sessions.dispatch matrix, codex
exec-server/attempt-startup/auth-bridge, UI cloud-target — 221 tests green.
node scripts/check-changed.mjsgreen across all lanes;pnpm buildclean(no INEFFECTIVE_DYNAMIC_IMPORT);
pnpm ui:i18n:baselineclean; plugin-sdk API baselineregenerated via
pnpm plugin-sdk:api:gen(delta attributable solely to the additiveGatewayAgentRuntimefield).mainadded device-pair setup maintenance coverage that pushedserver-maintenance.test.tsover the max-lines ratchet. This PR consolidates that cadence assertion into the existing maintenance-schedule test, preserving startup/minute/hour behavior while removing 12 test lines. A stale skills CLI helper reported by the same run was already removed by a latermaincommit absorbed during rebase.workspace-finalization owner), tests +~800.
UI evidence:
BEFORE: Cloud target disabled for codex runtime (shipped behavior, per issue screenshot).
AFTER (live rig):
https://github.com/user-attachments/assets/b508a696-fb18-49f9-aeef-90d513adf3a7