Skip to content

fix(codex): expose sandbox shell tools for ssh backends - #83667

Merged
steipete merged 1 commit into
mainfrom
codex/sandbox-exec-routing-v2
May 19, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/sandbox-exec-routing-v2

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Fixes #80322.

Summary:

Verification:

Behavior addressed: Codex app-server sessions using OpenClaw SSH sandbox routing can now reach an OpenClaw-provided shell without shadowing Codex native shell.

Real environment tested: AWS Crabbox cbx_7582df12c8d0 with Docker-hosted SSH target, env-backed live OPENAI_API_KEY, Codex app-server runtime, model openai/gpt-5.5.

Exact steps or command run after this patch: Created an isolated OpenClaw config with agents.defaults.sandbox.backend="ssh", tools.exec.host="sandbox", codexDynamicToolsLoading="direct", and an env-backed openai-codex auth profile, then ran node dist/entry.js agent --local --agent main --model openai/gpt-5.5 --message "Use ... sandbox_exec ... cat /home/sandbox/remote-only.txt ..." --thinking off --json.

Evidence after fix: The model replied OPENCLAW_SANDBOX_EXEC_SSH_OK_1779118303-25670; the test found a Codex app-server binding file and 8 session artifact hits containing sandbox_exec or the marker.

Observed result after fix: The live Codex agent used the sandbox-routed OpenClaw dynamic tool path to read a marker that existed only inside the SSH target container, and the run exited 0.

What was not tested: Full suite and a separate live Docker-backend negative run; Docker/no-sandbox behavior is covered by focused regression tests.

@clawsweeper

clawsweeper Bot commented May 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • 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.

Summary
The PR adds namespaced sandbox_exec and sandbox_process Codex app-server dynamic tools for enabled non-Docker OpenClaw sandbox backends, plus focused regression tests and changelog text.

Reproducibility: yes. by source inspection: current main filters exec and process out before Codex app-server dynamic tools are sent, while OpenClaw exec is the path wired to sandbox backend execution. I did not independently rerun the pre-fix SSH sandbox session.

PR rating
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Summary: Strong real-environment proof and focused tests back a small, well-scoped fix with no blocking review findings.

What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

PR egg
✨ Hatched: ✨ glimmer Clockwork Diff Drake

        .--^^^^--.           
     .-'  o    o  '-.        
    /       \__/      \      
   |    /\  ____  /\   |     
   |   /  \/____\/  \  |     
    \  \_.------._/  /       
     '._  `----'  _.'        
        '-.____.-'           
       _/|_|  |_|\_          
      /__|      |__\         
       `-----------'         
.*~~~~~~~~~~~~~~~~~~~*.      

Rarity: ✨ glimmer.
Trait: watches the merge queue.
Share on X: post this hatch
Copy: My PR egg hatched a ✨ glimmer Clockwork Diff Drake in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • How to hatch it: reach status: 👀 ready for maintainer look or status: 🚀 automerge armed; that usually means sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

Real behavior proof
Sufficient (live_output): The PR body includes after-fix AWS Crabbox live output for a Codex SSH sandbox run that read a remote-only marker via sandbox_exec, plus Testbox check/build run IDs.

Risk before merge
Why this matters: - The PR intentionally exposes a shell-capable OpenClaw dynamic tool path to Codex app-server for non-Docker sandboxes, so maintainers should treat the included SSH sandbox proof and negative-path tests as security-boundary evidence before merge.

Maintainer options:

  1. Land With Sandbox Proof (recommended)
    Accept the PR's AWS Crabbox SSH sandbox E2E, focused regression tests, and Testbox build/check runs as sufficient evidence for the guarded shell-boundary change.
  2. Ask For One More Negative Runtime Run
    If maintainers want live negative-path proof, request a Docker or no-sandbox Codex app-server run showing sandbox_exec is absent outside non-Docker sandbox backends.

Next step before merge
No ClawSweeper repair job is needed because the PR is already a focused implementation and this review found no actionable patch defect.

Security
Cleared: The shell-exposure path is security-sensitive, but the reviewed diff gates it to enabled non-Docker sandbox backends, respects opt-out excludes, and does not add dependency, secret, or supply-chain changes.

Review details

Best possible solution:

Land the focused namespaced sandbox-shell bridge if maintainers accept the recorded SSH sandbox proof and the guarded non-Docker exposure model.

Do we have a high-confidence way to reproduce the issue?

Yes by source inspection: current main filters exec and process out before Codex app-server dynamic tools are sent, while OpenClaw exec is the path wired to sandbox backend execution. I did not independently rerun the pre-fix SSH sandbox session.

Is this the best way to solve the issue?

Yes. The patch avoids restoring the broad retired compatibility profile and instead adds explicit namespaced shell tools only for enabled non-Docker sandbox backends while preserving Codex-native workspace tools.

Label justifications:

  • P1: This fixes a beta-blocking Codex app-server regression where SSH-backed sandbox agents can execute shell commands in the wrong environment.
  • merge-risk: 🚨 security-boundary: The diff changes when Codex app-server can see an OpenClaw shell tool, which is a sandbox and command-execution boundary.

What I checked:

  • Current main strips OpenClaw shell tools from Codex dynamic tools: Current main excludes exec and process in the Codex app-server dynamic-tool profile and applies that filter before allowlist handling, which matches the linked issue's reported broken path. (extensions/codex/src/app-server/dynamic-tool-profile.ts:3, 4af590a5f88e)
  • OpenClaw exec is the sandbox-backend-aware shell path: The OpenClaw tool builder passes sandbox backend buildExecSpec and finalizeExec into the exec tool, so hiding that tool removes the SSH backend-aware execution path from Codex app-server sessions. (src/agents/pi-tools.ts:762, 4af590a5f88e)
  • Patch gates the new shell tools to non-Docker sandbox routing: The branch adds sandbox shell aliases only when a sandbox is enabled, the backend is not Docker, and the configured dynamic-tool excludes do not opt out of exec/process or the new namespaced names. (extensions/codex/src/app-server/run-attempt.ts:3195, f27b4de7bebf)
  • Patch preserves runtime allowlist aliases: The branch updates allowlist handling so exec admits sandbox_exec and both exec or process can admit sandbox_process, matching the PR's stated compatibility behavior. (extensions/codex/src/app-server/run-attempt.ts:3277, f27b4de7bebf)
  • Focused regression coverage is present in the PR diff: The branch adds tests for exposing sandbox shell tools on SSH, not exposing them for Docker or disabled sandbox contexts, honoring excludes, and rewriting yielded follow-up guidance to sandbox_process. (extensions/codex/src/app-server/run-attempt.test.ts:674, f27b4de7bebf)
  • Regression provenance points to the dynamic-tools profile removal: The linked regression tracks the merged PR that removed codexDynamicToolsProfile and made Codex app-server always omit OpenClaw workspace/edit/patch/exec/process/plan tools; local history shows that merge commit as b79de62b3c48. (extensions/codex/src/app-server/dynamic-tool-profile.ts:3, b79de62b3c48)

Likely related people:

  • steipete: Prior merged work introduced the Codex-native workspace tool boundary, and this PR updates the same Codex app-server run-attempt path. (role: native-first Codex tool boundary author and current PR author with prior merged history; confidence: high; commits: 42aaf0c98a7c, f27b4de7bebf; files: extensions/codex/src/app-server/run-attempt.ts, docs/plugins/codex-harness.md)
  • kevinslin: Authored the merged dynamic-tools profile removal that the linked issue identifies as the regression source. (role: recent area contributor; confidence: high; commits: b79de62b3c48; files: extensions/codex/src/app-server/dynamic-tool-profile.ts, extensions/codex/src/app-server/config.ts, extensions/codex/doctor-contract-api.ts)
  • vincentkoc: Recent merged work touched remote approval and exec routing surfaces that are relevant to validating sandbox-backed shell behavior. (role: adjacent exec and sandbox routing contributor; confidence: medium; commits: 2d53ffdec1da; files: src/agents/pi-tools.ts, src/agents/bash-tools.exec-host-gateway.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 4af590a5f88e.

@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: f27b4de7be

ℹ️ 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".

Comment on lines +3253 to +3256
normalized === "exec" ||
normalized === "sandbox_exec" ||
normalized === "process" ||
normalized === "sandbox_process"

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 Keep sandbox_exec available when only process is excluded

isSandboxShellDynamicToolExcluded treats any exclusion of process/sandbox_process as a reason to suppress both sandbox shell tools, so a config like codexDynamicToolsExclude: ["process"] unintentionally removes sandbox_exec too. This is broader than the documented “omit these tool names” behavior and breaks the common case where operators want foreground shell access but no process-session management; for non-Docker backends that means no sandbox shell path is exposed at all.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels May 18, 2026
@steipete
steipete merged commit b4fdd14 into main May 19, 2026
199 of 208 checks passed
@steipete
steipete deleted the codex/sandbox-exec-routing-v2 branch May 19, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex maintainer Maintainer-authored PR proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Beta blocker: codex - SSH-backed sandbox routing lost; app-server unconditionally strips exec/process from OpenClaw dynamic tools (#80048 regression)

1 participant