Skip to content

Independence 2: cua's own sandbox for node_repl cells; drop the Codex binary and app-server #115

Closed

Description

@SSFSKIM

Purpose

Child 2 of the independence composite. node_repl runs JavaScript cells under a sandbox that the vendor runtime obtains from the Codex CLI binary (CODEX_CLI_PATH, "the sandbox; no unsandboxed fallback" in src/runtime/launch.mjs), and with the browser surface the runtime can start codex app-server inside CODEX_HOME ($CUA_HOME/state/codex: config, sqlite state, computer-use directory, 443 endpoints). On 2026-10-13 six cua_repl runtimes were alive on the owner's Mac with no codex app-server process, so the app-server is not a standing dependency. A research pass (2026-10-13, report codex-dependency-research.md, to be attached as a comment) maps the exact argv, the seatbelt and Linux sandbox mechanisms and any app-server JSON-RPC methods against the open-source https://github.com/openai/codex at the installed version's revision.

Goal

cua provides node_repl's sandbox itself (its own seatbelt profile launcher on macOS; on Linux the open-source sandbox helper under its licence or cua's own), with the same or stricter policy the spec records for the disabled and scoped profiles, and nothing from CodexCLI.app is extracted or launched; the app-server is dropped when the research shows nothing essential uses it on the cua route, else the essential part is replaced. cua install no longer needs CodexCLI.app; CODEX_HOME disappears or becomes cua's own state directory.

Acceptance

Unit tests with doubles for the launcher; the native acceptance script's sandbox items (read-deny of the secret store, no network where denied) pass on macOS and the Linux VM; npm test, test:mods, plugin validate green; README's sandbox and CODEX_HOME text updated; Decision Log entry in the standalone design spec; plugin minor bump. No regression in cell start latency (measure before and after on the same Mac).

Open

Depends on the research report; design through brainstorming when it lands.

Activity

  1. added
    enhancement
    status:ready-for-architect
    priority:P1
    on Oct 13, 2026
  2. SSFSKIM commented on Oct 13, 2026

    @SSFSKIM
    OwnerAuthor

    Research landed 2026-10-13 (read-only, static; report kept in the session's job dir as codex-dependency-research.md; installed Codex CLI 0.159.2 matched to public tag rust-v0.159.2 = ff6aec96948b70d94983af2641a6b67c94faeff5). Findings that bind this ticket's design:

    1. Two separate dependencies, neither an agent engine. (a) node_repl's Rust supervisor spawns the persistent kernel and trusted worker through codex sandbox -c shell_environment_policy.inherit=all -c default_permissions=node_repl -c 'permissions.node_repl={filesystem={...},network={enabled=false}}' [--allow-unix-socket ..] -- node --experimental-vm-modules kernel.js|trusted-worker.js ... (SandboxConfig::build_command_spec). (b) It lazily spawns codex app-server --listen stdio:// (JSONL over stdio) only when an auth/config RPC is needed: initialize, getAuthStatus, config/read, configRequirements/read (and config/value/write, config/batchWrite as capabilities). No turn/start, no command/exec. Six live runtimes without an app-server is consistent with native-only use.
    2. macOS containment is a Codex-generated Seatbelt profile run by /usr/bin/sandbox-exec (public codex-rs/sandboxing/src/seatbelt*); Linux is codex-linux-sandbox over bubblewrap + namespaces + seccomp (legacy Landlock non-default). cua's scoped profile = whole-disk read, writes to the run dir and TMPDIR, no network; both children sandboxed alike.
    3. The browser service (not app-server) attempts Statsig init and an aura/identity fetch at setup through nodeRepl.fetch, gated by BROWSER_USE_DISABLE_AMBIENT_NETWORK (unset) rather than NODE_REPL_DISABLE_ANALYTICS; it also calls configRequirements/read for history/full-CDP/auto-review policy. So the app-server cannot simply be dropped while the vendor browser service stays: Own browser service: replace the vendor browser-service with cua's (no OpenAI policy or telemetry, no 3 s locator cap, writable evaluate); step 1 of independence #113 (own service) removes those call sites; this ticket then replaces only the sandbox launcher.
    4. Replacement shape: a cua-owned launcher honouring the recovered sandbox CLI contract (Seatbelt on macOS; a built codex-linux-sandbox or equivalent on Linux), a minimal app-server facade only if any retained path still needs config RPCs, and the login wrapper retired with Remove the ChatGPT extension route, the vendor browser service and the Codex login (ahead of #115) #79. Lowest-disruption first experiment: build the public CLI at the matched tag and use it as CODEX_CLI_PATH in a disposable home. Licences: public Codex Apache-2.0, bubblewrap LGPL v2; CodexCLI.app in ChatGPT.app is the proprietary distribution.
    5. Order consequence: Independence 2: cua's own sandbox for node_repl cells; drop the Codex binary and app-server #115 after Own browser service: replace the vendor browser-service with cua's (no OpenAI policy or telemetry, no 3 s locator cap, writable evaluate); step 1 of independence #113 (the own service removes the app-server's remaining callers). Open: a fresh-home trace to confirm which requests run login-free; conformance tests before substituting a public build or a facade.
  3. added
    status:in-design
    and removed
    status:ready-for-architect
    on Oct 17, 2026
  4. SSFSKIM commented on Oct 17, 2026

    @SSFSKIM
    OwnerAuthor

    [board] in-design: Owner approved starting #115 (2026-10-17). Route: replace the CodexCLI.app sandbox launcher with a cua-owned one built from the public original at the installed CLI's tag rust-v0.159.2 (ff6aec96). macOS: codex-rs/sandboxing seatbelt.rs and its .sbpl policies, profile generation ported to cua and run through /usr/bin/sandbox-exec. Linux: the codex-linux-sandbox crate built from that tag. The owner accepted the recommendation 'B, with a first experiment under A' (the public CLI built at the tag and dropped into the current binary's slot), with conformance against the current binary before any switch. Design through brainstorming next.

  5. SSFSKIM commented on Oct 17, 2026

    @SSFSKIM
    OwnerAuthor

    Owner ruling 2026-10-17: the ChatGPT extension route is removed now, ahead of this ticket (#79, rewritten). With it go the vendor browser service and cua login, the app-server's and the login's only callers, so this ticket drops CodexCLI.app whole: the sandbox launcher is the only piece left to replace.

  6. SSFSKIM commented on Oct 17, 2026

    @SSFSKIM
    OwnerAuthor

    Owner ruling 2026-10-17: with cua's own launcher the kernel and the trusted worker get separate profiles, and the kernel (model cells) is denied reading the secret store (the global and project tiers under ~/.config/claude-secrets), ~/.config/cua and $CUA_HOME/state; the trusted worker, which substitutes {{secret:KEY}}, keeps today's profile. Applies on both hosts: on the vendor host the launcher tells the two children apart by the script it is asked to run. This replaces README's "cua cannot deny the store to cells alone" and is the acceptance item "read-deny of the secret store".

  7. SSFSKIM commented on Oct 17, 2026

    @SSFSKIM
    OwnerAuthor

    Owner rulings 2026-10-17 (design round 2): (1) the Linux helper (codex-linux-sandbox built from upstream on GCE, static, x64 and arm64) ships as a GitHub release asset on SSFSKIM/cua, pinned in the repo by URL, SHA-256 and upstream commit; cua install fetches and verifies it into $CUA_HOME; system bwrap stays. (2) Linux computer sessions stop defaulting to no sandbox: the kernel (model cells) is confined like scoped (writes only to the run directory and TMPDIR, no network or sockets, the secret store denied) and only the trusted worker gets the network, so sky_linux reaches X11 and the session bus. (3) The Linux vendor host is retired: CUA_REPL_HOST=vendor is refused on Linux, the vendor host remains for macOS computer sessions until #117, and cua's compat launcher for it is macOS-only; this resolves #135. Live spike (mini, 2026-10-17): the macOS native helper runs $CODEX_CLI_PATH app-server --listen stdio:// (initialize, configRequirements/read, config/read) once per helper, and every native call fails with -10005 without it, so the compat launcher carries a minimal app-server answering those three.

  8. SSFSKIM commented on Oct 17, 2026

    @SSFSKIM
    OwnerAuthor

    Owner approved the design 2026-10-17 (draft converged with a doperpowers:critique debate, ten findings adopted). Forks: (1) the kernel is also denied other sessions' $CUA_HOME/run/ (own run directory stays writable; Linux mount order checked first). (2) If M0 shows the confined worker breaks sky_linux's app launch or screenshots on Linux computer sessions: first launch applications outside the sandbox through the supervisor (gio launch / systemd-run --user, as launch-services does with open on macOS); if that is not reachable, the worker on those sessions runs unconfined as today while the kernel stays confined. Routed to execspec: spec docs/doperpowers/specs/2026-10-17-own-sandbox-design.md, milestones M0 (oracles, facade replay, Linux probes, baselines), M1 (policy, deny list, seatbelt port, own host on macOS), M2 (compat executable; CodexCLI.app leaves the macOS pin), M3 (Linux helper via GitHub Actions with provenance, own host on Linux, confined default, Linux vendor host retired), M4 (#138, CODEX_HOME cleanup, docs, acceptance, latency).

  9. added
    status:in-progress
    and removed
    status:in-design
    on Oct 17, 2026
  10. 2 remaining items

  11. added 6 commits that reference this issue on Oct 17, 2026
  12. added a commit that references this issue on Oct 18, 2026
  13. removed
    status:in-progress
    on Oct 18, 2026
  14. SSFSKIM commented on Oct 18, 2026

    @SSFSKIM
    OwnerAuthor

    [board] done: All five milestones merged (#153, #156, #158, #160, #161); cua 0.15.0 on main (b68bee6). Final execution report #163. Residue: #157, #159, #162 and tech-debt-tracker.md. The mini's resident update and the leftovers prune wait for the owner.

  15. added 2 commits that reference this issue on Oct 18, 2026
  16. added a commit that references this issue on Nov 2, 2026
  17. added 2 commits that reference this issue on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpriority:P1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions