Skip to content

Own sandbox M2: cua's compat executable for the macOS vendor host; CodexCLI.app leaves the darwin pin (#115) - #158

Merged
SSFSKIM merged 26 commits into
mainfrom
feat/115-own-sandbox-m2
Oct 18, 2026
Merged

SSFSKIM merged 26 commits into
mainfrom
feat/115-own-sandbox-m2

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Part of #115: M2 of the own-sandbox spec (docs/doperpowers/specs/2026-10-17-own-sandbox-design.md). On macOS the vendor host (node_repl, which still serves computer sessions until #117) now launches its kernel and trusted worker through bin/cua-codex-compat, cua's compat executable, under cua's own seatbelt profiles. The native helper's app-server policy read is answered from M0's audited capture. CodexCLI.app leaves the darwin pin, and no process named codex runs on macOS.

What changed

  • bin/cua-codex-compat and src/sandbox/codex-compat.mjs:
    • sandbox accepts exactly node_repl's recovered template and refuses everything else (exit 1, with a sentence).
    • The role comes from the script's basename; anything unknown gets the kernel profile.
    • It reads the session's settings from $CUA_HOME/state/compat/<sessionId>.{json,node}, located by TMPDIR and CODEX_HOME. It refuses on a mismatch, or on a missing or malformed file.
    • It then execves /usr/bin/sandbox-exec.
  • src/sandbox/app-server.mjs and app-server-responses.json: answers initialize, configRequirements/read and config/read. Any other method gets -32601. It ignores notifications and exits on EOF.
  • src/sandbox/compat-settings.mjs: writes and reads the settings files. One computation happens in buildLaunch; the files are 0600 in a 0700 directory, under the denied state/, and are removed with the run directory and at idle stop.
  • src/runtime/launch.mjs: for the vendor host, CODEX_CLI_PATH is the compat and CUA_COMPAT_NODE is set. A preflight refuses a launch whose CODEX_CLI_PATH is not an executable file. bin/ joins the trusted paths.
  • The darwin pin: CodexCLI.app leaves it (components, layout, signing), and the release id is kept. An existing install keeps the native helper at the same on-disk path, so no new screen-capture prompt appears. The unused CodexCLI.app in existing trees is left for M4 to remove, under the conditions in the spec.
  • doctor gains a sandbox.launcher row. Doctor and install verification no longer check CodexCLI.app, including in a tree where it was deleted by hand.
  • Harness:
    • the kernel-exit-status parity allowance is retired (both hosts' kernels are Node);
    • a helper is the run's own by its session TMPDIR;
    • teardown counts a helper stopped only once its pid is verified gone;
    • own-sandbox --host vendor and accept-native items 12 and 13;
    • m2-mini.sh.

Validation Evidence

  • At fada7ee, under lockf /tmp/macbook-e2e.lock: HOME=$(mktemp -d) npm test gives 2705 pass, 0 fail, 169 skipped. npm run test:mods passes. claude plugin validate . passes, with the known CLAUDE.md warning.
  • Mini evidence, under docs/evidence/2026-10-17-own-sandbox/m2/. The code under test is 249a2a9; its src/, bin/, extension/ and package.json equal the head's. Every run is gated under the mini rules.
    • Env probe (475881a). Under scoped and default, the kernel and worker sandbox calls carry TMPDIR and CODEX_HOME exactly as buildLaunch set them. Under disabled, node_repl never calls the launcher.
    • Helper check (475881a). The approved native helper writes nothing under the session TMPDIR, so sessionTmp stays run/<id>/tmp.
    • Headless. own-sandbox on the own host 76/76; doctor ok; the compat's tests 26/26 on the vendor's Node 24.21.0. On that Node a failed process.execve aborts (exit 134) instead of throwing; this is recorded as a deviation and still fails closed.
    • own-sandbox on the vendor host (acceptance 2–5, script directory included): 86/86.
    • repl-parity, own host against vendor host, both under cua's sandbox: vendor 479/479, cua 479/479. diff --expected is ok, with 0 undeclared differences. Run inside a CI-opt runner hold.
    • accept-native at 6de47ae (TextEdit sitting, owner present, synthetic key only): items 11 (76/76), 12 (86/86), 13 (18/18, the compat route: listApps, Finder getApp and getAXState through the compat app-server), 4 and 5 PASS. CI-opt released the hold at 07:15:54Z, before the sitting ended at 07:19:05Z. No MAWS job ran in that interval.
    • The other accept-native items against main (94366c1) and M1 (f8019bf).

Unresolved Review Findings

  • scripts/native-baseline/prepare.mjs:100-103 (envValues()): ps -E can't separate an embedded NAME= from the next environment entry, so a foreign helper whose TMPDIR is literally <our session temp> OTHER=value would match the ownership witness. Left as is: only a same-uid process could construct that value, and such a process can already signal ours. Logged in tech-debt-tracker.md with its fix: KERN_PROCARGS2, or a second witness.

PR review

reviewer-high on the whole diff confirmed the product side against real sandbox-exec. Two harness P2s (an unreadable ownership counted as proven teardown; TMPDIR matching split on spaces) were fixed in 664d085.

Residue

…child's sandbox call carries TMPDIR and CODEX_HOME as buildLaunch set them; m2-mini.sh env-probe runs it per mode on the mini
…box/codex-compat.mjs): the recovered sandbox template only, role by script basename, the session's compat settings located from TMPDIR and CODEX_HOME, and the recorded app-server answers; not yet wired
…ds what appears under the session temp and what the run's own helper holds open there; m2-mini.sh helper-tmp runs it on the mini
…xecutable (CODEX_CLI_PATH, CUA_COMPAT_NODE, the session's compat settings written with the run directory and removed with it), the vendor-host launcher preflight, bin/ trusted; CodexCLI.app leaves the darwin pin with the release id kept; doctor's sandbox.launcher
…ode); helpers are the run's by their session temp, not CODEX_CLI_PATH; experiment.mjs runs slot-less through the launch's own launcher and judges the cell against the launch's session temp; own-sandbox --host vendor, accept-native items 12 and 13 (the compat route); m2-mini.sh headless, parity and accept
…nch's real session temp under a fixture home (no symlinked writable root); the compat executable's path is resolved at use, not at load; compat-route cancels the experiment cooperatively with a bounded teardown and keeps its evidence unless the teardown is proven
…ly once its pid is verified gone; SIGKILL after a bounded wait only for a pid whose ownership is re-proven; compat-route's teardown needs every helper verified gone
…dor host keeps top-level bindings across cells) and its report is the last text that parses as JSON
… and default, kernel and worker sandbox calls carry TMPDIR and CODEX_HOME exactly as buildLaunch set them; under disabled node_repl never calls the launcher
… approved helper writes and holds open nothing under the session temp across six read-only calls and a screenshot; no prompt
…n cua's host 76/76, doctor ok, the compat's tests 26/26 on the vendor's Node 24.21.0, process.execve aborts there (SIGABRT, exit 134); own-sandbox on the vendor host fails: its second cell's const redeclaration draws the vendor's warning text, which the harness parses as the report
… 479 and cua 479 complete, diff ok with no undeclared difference; Chrome pid 36513, 1 tab before and after
…tting at 6de47ae (items 11, 12, 13 PASS), the vendor-host own-sandbox rerun 86/86, and the M2 README
…se 07:15:54Z to 07:19:05Z, no MAWS run then; items 1-3 and 6-10 compared with main and M1)
…e prepared parity clone, as mini-rules' ACCEPT_REMOTE does (prepare refuses elsewhere)
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-18T07:27:42.162655Z 533a933 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

…is carried into the teardown as unclassified, never signalled, and keeps compat-route's teardown unproven; ps -E environment values are read whole, spaces included (a cua home under Application Support)
@SSFSKIM
SSFSKIM merged commit 7e6976d into main Oct 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant