Skip to content

fix(sdk): probe the Codex sandbox before starting a billed scan - #1084

Merged
mldangelo-oai merged 2 commits into
openai:mainfrom
stanleys12:osc/probe-the-codex-sandbox-before-starting-4f3f
Sep 30, 2026
Merged

mldangelo-oai merged 2 commits into
openai:mainfrom
stanleys12:osc/probe-the-codex-sandbox-before-starting-4f3f

Conversation

@stanleys12

@stanleys12 stanleys12 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Report Unix sandbox startup failures during runtime preparation, before plugin bootstrap or a billed Codex thread starts. The error includes Codex's diagnostic output and points to the existing Linux sandbox setup guidance.

Changes

  • Run the selected absolute Codex executable with --version inside codex sandbox, using the scan's environment and Codex home, a ten-second timeout, and caller cancellation.
  • Export SandboxUnavailableError and stop runtime preparation when the probe fails.
  • Cover the resolved executable, paths with spaces, environment forwarding, cancellation, startup errors, and failure before plugin bootstrap. Keep mocked SDK tests independent of the host sandbox.
  • Verify executable selection, isolated Codex homes, config paths, and worker permissions at the child-process boundary for fresh and resumed Deep Scan discovery and reducer workers.

Testing

  • Sandbox preflight and CLI/SDK concurrency tests: 7 passed, 1 Windows-only test skipped.
  • Full SDK suites, native builds, installed-package checks, containers, MCP app tests, and required platform checks passed on the final commit in node-ci.
  • Local fixed-seed suite: 3,212 passed, 51 skipped, 36 failed. Two mocked sandbox failures were fixed and passed focused reruns; the other failures concern local fixture permissions and Git discovery. CI passed on the final commit.
  • pnpm run types and pnpm run format: passed.
  • Deep Scan executor tests: passed.
  • Ruff 0.16.8 lint and format checks: passed.
  • pnpm --dir sdk/typescript run build:ci: passed.
  • Plugin source compatibility check and its nine tests: passed.

Risk and rollout

Adds one local process check before scan startup on Unix, with no model request or new CLI options. The probe uses the already selected Codex executable and preserves scan settings. Windows keeps its existing startup behavior. Cross-platform CI passed on the final commit.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

Runtime preparation now runs `codex sandbox -- true` with the Codex
command and CODEX_HOME the scan will use. When the sandbox backend cannot
start, every shell command the scan agent issues fails, no draft
artifacts are written, and the scan still runs to completion before the
seal check reports a missing contract. The probe costs a few
milliseconds and turns that into an immediate SandboxUnavailableError
carrying what Codex reported, the command to reproduce it, and a pointer
to the AppArmor profile that Linux hosts and containers restricting
unprivileged user namespaces need.

The probe is skipped on Windows, where there is no separate sandbox
backend that can fail to start.

Co-Authored-By: Claude Opus 5 <[email protected]>

@mldangelo-oai mldangelo-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding this preflight. Catching a sandbox startup failure before spending model time is a useful improvement. I’ve reviewed the updated probe and regression coverage, including cancellation and fresh and resumed Deep Scan workers. The final commit passes the required Linux, macOS, and Windows checks. Looks good to merge.

@mldangelo-oai
mldangelo-oai merged commit 3371d2e into openai:main Sep 30, 2026
50 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 30, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants