Skip to content

#115 M4: explicit Codex CLI prune, #138 switch off, docs, 0.15.0 - #161

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

SSFSKIM merged 31 commits into
mainfrom
feat/115-own-sandbox-m4

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Ticket #115, milestone M4, the last milestone, of docs/doperpowers/specs/2026-10-17-own-sandbox-design.md ("M4 — #138, CODEX_HOME, documentation, final acceptance and release"). The spec's Outcomes & Retrospective is written.

Closes #115
Closes #135

#135: the Linux vendor host, which failed open, is retired (M3). Cua's own host on Linux fails closed: acceptance 9, and the parity's no-unsandboxed-fallback case.

What changes

  • cua install --prune-leftovers. An explicit command that removes the Codex CLI's leftovers. A plain install removes nothing; it prints one line naming the leftovers and the command. The prune removes:
    • CodexCLI.app from installed darwin trees;
    • the codex file from pre-M3 Linux trees;
    • the old Codex CLI files in cua's own CODEX_HOME ($CUA_HOME/state/codex), never an environment CODEX_HOME.
  • The prune's conditions.
    • Exact names only, inside $CUA_HOME/runtimes/<release>/, only when the pin no longer lists the component, and never while a session runs.
    • A stale sweep runs first. Each removal renames the component to a tombstone between two session checks, and tombstones are detected later.
    • Symlinks are never followed. A skipped link, an unreadable path or an unreadable install.json is reported, never read as clean.
    • Removal is not automatic, because of version skew: an older cua sharing the home may still launch CodexCLI.app. The README and release notes say to update every cua sharing the home first.
  • Session sweep guard (src/runtime/run-dir.mjs). For every caller, the sweep refuses to delete under a run/, state/, state/compat/ or kernel/ that is a symlink. This closes an exposure that predates M4. Serve and the agent log the refusal and carry on.
  • Vendor node_repl on macOS hangs about 1 in 8 on the first local-time conversion under the sandbox (ICU tz lookup blocks on launchd) #138. The notification_center grant sits behind a switch that is off. tz-probe gains deny and allow modes. Vendor node_repl on macOS hangs about 1 in 8 on the first local-time conversion under the sandbox (ICU tz lookup blocks on launchd) #138 stays open as not reproduced.
  • Harness. compare --same-host tolerates a memoryBytes difference under 0.1% and nothing else. native-baseline and accept-native send super+n, typing, super+w and super+q only while TextEdit is the frontmost app (scripts/accept/key-guard.mjs), pending Native key events may reach the frontmost app instead of the bound app (Chrome window closed twice after helper typing runs) #162.
  • Docs and version.
    • README.
    • Release notes for 0.15.0 in docs/evidence/2026-10-17-own-sandbox/m4/README.md.
    • Dated Decision Log entries in the standalone and own-repl-host specs.
    • Plugin 0.15.0.

Validation Evidence

Everything is in docs/evidence/2026-10-17-own-sandbox/m4/.

Gates:

  • HOME=$(mktemp -d) CUA_NODE=/opt/homebrew/bin/node npm test gives 2867 pass, 0 fail at 9173dbf. 7c1ffef adds one comment; native-baseline gives 109/109.
  • npm run test:mods gives 133/133.
  • claude plugin validate . passes. Its one warning, about the root CLAUDE.md, predates this work.
  • CI is green.

Mini group A (headless) at 7b87873, item 10 at a920e2f.

  • Item 1: a fresh install places no CodexCLI.app. No process is named codex. The kernel is Node, under the supervisor on the own host and under the compat on the vendor host.
  • Items 2-5: own-sandbox gives 76/76 on the own host and 86/86 on the vendor host.
  • Item 8:
    • golden fixtures 18/18;
    • fingerprints all ok;
    • the switch-off profiles are byte-identical to M2's.
  • Item 9: fail-closed suites 153/153, compat preflight 6/6.
  • Item 10: in a fresh scratch home:
    • a plain install removes nothing; --prune-leftovers frees 229 MB, and doctor goes from warn to pass;
    • node_repl's files, the environment CODEX_HOME and the helper's inode are untouched;
    • a live session defers the removal;
    • a linked state/codex/tmp is reported, not followed.

Mini group B (CI-opt hold) at 8782604.

GCE (cua-gce, arm64) at 7b87873:

  • Item 1: no codex; 883 ps samples saw no process named codex.

  • Items 2-5: own-sandbox gives 82/82 in all three modes.

  • Item 7: linux-native passes, and the vendor host is refused with its sentence.

  • Item 10: run on a pre-M3 tree, the prune takes it from 452.6 MB to 205.1 MB.

  • Item 11: Linux latency gives verdict: PASS, accepted by ruling.

    Row M0 pooled M4 pooled Limit
    cold.miss 666.5 ms 735.1 ms 1166.5 ms
    cold.hit 773.6 ms 825.8 ms 1273.6 ms
  • Item 12: Linux parity rests on M3's full run at bf7739f (493 cases). M4 changes no Linux launch code.

Owner sitting (group C): skipped by ruling. M4 does not touch the macOS computer route, M2's sitting proved typing and approvals, and group B re-proves the route read-only.

Item 13 (#138): no sittings, by ruling. M0 measured 0 hangs without the line, so no measurement can decide it.

Unresolved Review Findings

None. Every finding from the task reviews and reviewer-high was fixed. The plugin-validator warning about the root CLAUDE.md predates this work and was dismissed as baseline.

Residue

  • Native key events may reach the frontmost app instead of the bound app (Chrome window closed twice after helper typing runs) #162, key routing. Native helper keys may reach the frontmost app rather than the bound one. Its investigation decides whether the harness guard can be dropped.
  • The macOS vendor host's ~60 ms cached first cell. Pre-rendering the per-session profile in buildLaunch would make cua-codex-compat an sh check plus exec. It is in tech-debt-tracker.md and was never measured: the timing could not run inside the hold.
  • The mini-rules frontmost regex. It matches bundleID="…" only, while lsappinfo on newer macOS prints "CFBundleIdentifier"="…". The new key guard parses both, and the gate does not. A mini gate stopping with "no bundle id" would come from this.
  • watch.mjs writes to a hardcoded M1 sitting log. Group B's readings landed there and were moved by hand. The log path should follow the run.

…uth.json, installation_id, sqlite files, caches, plugins, skills, log, tmp/arg0 and browser/sessions, and the unused CodexCLI.app (or Linux codex) in installed trees whose pin no longer lists it while no session runs; links never followed; doctor's runtime.leftovers row names them until then
…t, off (it ships off: #138 has not reproduced); tz-probe renders cua's kernel and worker profiles without the line and with it, and its codex launcher needs --codex now that cua installs no Codex CLI
… under a claimed session, cua's compat executable as CODEX_CLI_PATH) instead of the CodexCLI.app cua no longer installs; its socket-allowance variant and the probe lib's drifted copy of the launch go; surface.mjs's secrets note and sandbox.mjs's header say what cua's sandbox now denies
…the compat executable, the macOS nesting refusal, os_log, #138's switch off), the Linux helper and its scoped computer default, the vendor host retired on Linux, CODEX_HOME for the macOS vendor host only, install's cleanup and runtime.leftovers; comments on Linux X access
…, and their sandbox text points to the own-sandbox spec
…eftovers (an older cua sharing the home may still launch CodexCLI.app, which run records cannot see); a plain install removes nothing and says how to prune; doctor names the command; the environment's CODEX_HOME is never touched (pinned with a planted directory)
…update every cua sharing the home first, then cua install --prune-leftovers; a plain install removes nothing
…e sweep and a session's release refuse a run/, state/, state/compat/ or kernel/ that is not a real directory (pre-dates M4); the prune refuses then, re-checks for sessions right before each release's CLI goes and again after renaming it aside to a tombstone (renamed back if one appeared), and reports any unreadable directory instead of reading it as clean, which doctor's row warns about
… kernel TMPDIR stated; the prune's re-check, its residual race and its link refusal; the sweep's link refusal
…, and finds the tombstones a failed or interrupted prune leaves: doctor names them, and the next prune removes them without the session conditions
…unconfined after a failed launch (#135), so updating every cua sharing the home first is a precondition
…owser/, runtimes/, a release directory, a linked CodexCLI.app) are still never followed but now reported as not inspected, by doctor (warn), the prune (failed) and a plain install; M4's acceptance recipe follows the approved groups (A headless, B in a CI-opt hold, C skipped), with no live typing
…, not its errno (ENOTEMPTY on GitHub's macOS runner)
… own-sandbox 82/82, linux-native PASS with the vendor host refused, the prune live with and without a session record, and the own host's cold rows against M0 (slower than M0's run-to-run spread; reported, not judged)
… the baseline as the same hardware (MemTotal moves by KiB between boots); the M4 Linux cold rows re-compared on the retained runs (PASS), the latency ruling recorded, a release-notes line and a tech-debt line for the first-cell cost
…and accept-native's TextEdit typing and close cells run only while TextEdit is the frontmost application, else nothing is sent, key_skipped_not_frontmost is recorded with the frontmost bundle id and the run fails (scripts/accept/key-guard.mjs, one shared helper); release notes: the macOS vendor host's ~60 ms first cell; tech debt: pre-render the compat's seatbelt profile
…hecks, then dispatches with no pause between (pausing() exposes pauseWait and dispatch; sendToPausedSession); the scratch document's super+n path is its own guarded cell; a task's new document and its typing are separate cells, each checked right before it is sent
…d cells count; a comment where task.total counts its rows
…CLI, doctor rows pass), own-sandbox on both hosts (76/76, 86/86), oracles ok, golden 18/18, the switch-off profiles identical to M2's, the fail-closed suites 153/153 and 6/6 (the store's directory name redacted)
…sh scratch homes (plain install removes nothing; --prune-leftovers removes the names and CodexCLI.app, 229 MB freed, keepers and the environment CODEX_HOME untouched, the helper's inode unchanged; a live session defers the CLI; a linked state/codex/tmp is reported, not followed)
…cy PASS on both configurations (the vendor cold.hit row +60 ms, beyond M0's spread and inside the limit, accepted on three runs; the extra runs and the compat timing not run), parity PASS (479/479, 0 undeclared differences), accept-native without TextEdit (11 to 13 PASS; only item 5 differs from M2, by design); the ssfs closure and HID-idle notes; the mini results written up
@SSFSKIM
SSFSKIM marked this pull request as ready for review October 18, 2026 16:42
@SSFSKIM
SSFSKIM merged commit b68bee6 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

1 participant