Direct-CLI probe report (Astra)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+478
−0
docs/superpowers/specs/2026-11-03-direct-cli-probe.md+478 −0
CI passed — run details
diff --git a/docs/superpowers/specs/2026-11-03-direct-cli-probe.md b/docs/superpowers/specs/2026-11-03-direct-cli-probe.md| new file mode 100644 |
| index 00000000..315c4ea7 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/2026-11-03-direct-cli-probe.md |
| @@ -0,0 +1,478 @@ |
| +# Direct provider CLI probe for Equipo |
| + |
| +Tested on docs-t1 on 2026-11-03 with Claude Code 2.1.312 and Codex CLI 0.165.0. Direct execution supplies useful controls, but this probe does **not** justify replacing the production Paseo adapter yet. Account selection, tools, permissions and targeted read denial worked. Full configuration attestation, recoverable event accounting and escape-resistant containment still need work. |
| + |
| +This is controller evidence for the runner design, not a change to the runner or its live-gate rules. Read alongside design section 6.9, the 2026-11-01 Paseo probe and `amadan discuss show oficina/equipo 3`. Discussion 3 now records a dedicated runner OS user, an Amadan description-readback change in progress, and supervised trial mode. This probe does not supersede those decisions. |
| + |
| +Exactly eight prompted runs were used, including two rejected Claude requests. No helper agents or reviewers ran. Read-only app-server requests, command-execution controls and local process tests did not send model prompts. Prompts used Haiku 4.5 or GPT-6-Luna. No commits, pushes, sign-ins, application-code changes or Paseo operations were performed. |
| + |
| +One constraint was violated by a CLI side effect: `codex exec --ignore-user-config` added a trust entry to the user config. The probe removed only its own entry and restored the file to its original SHA-256. Both monitored settings files match their original hashes. Provider session indexes and other runtime bookkeeping are separate from these settings. This behavior matters for a production runner. |
| + |
| +Paths and identities used below: |
| + |
| +```sh |
| +P=/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0 |
| +W="$P/repo" |
| +CH=/home/paulca/.paseo/zerosub/homes/claude-2b21c7944303 |
| +CXH=/home/paulca/.codex |
| +C=a60ed016-112e-4dfe-bb26-86734a1fc429 |
| +E=01a1a045-5a36-7aa0-a555-ce66213015ef |
| +A=01a1a045-a71d-72f3-8dac-ad04b3a7ae69 |
| +``` |
| + |
| +The workspace was an uncommitted throwaway Git repository. `inside.txt` contained `equipo-inside-readable`; `$P/outside/sentinel.txt` contained `equipo-outside-nonsecret`. Neither held credentials. Scratch, scripts and captured streams were on disk under `$TMPDIR`. Appendix A retains the actual launch commands and prompts after scratch cleanup. Stdout and stderr were captured separately. |
| + |
| +| Run | Invocation | Outcome | |
| +| --- | --- | --- | |
| +| 1 | Claude, default home | Weekly-limit error; no account failover | |
| +| 2 | Claude, explicitly selected `claude-4f309ff29169` home | Weekly-limit error; no account failover | |
| +| 3 | Claude, explicitly selected `$CH` | MCP call, approved/denied writes, answered question, detached sleep | |
| +| 4 | Codex exec | Read-denial test; MCP rejected under `approval_policy=never` | |
| +| 5 | Claude resume `$C` | Same session; native and shell read-denial tests | |
| +| 6 | Codex app-server | Approved/denied permission responses; denial cancelled the command batch | |
| +| 7 | Codex exec resume `$E` | Same session; MCP succeeded after read-only tool annotations | |
| +| 8 | Codex app-server resume `$A` | Structured question answered by steering; approved detached sleep | |
| + |
| +## 1. Structured events and session continuation |
| + |
| +**Claude: yes for the observed lifecycle and tool events; partly for all errors.** `-p --verbose --output-format stream-json` emitted valid JSON on every stdout line in all four launches: 4, 4, 35 and 16 lines. Observed types were `system`, `rate_limit_event`, `assistant`, `user` and `result`. Tool calls appeared in assistant content; tool results appeared in user content. There was a stable `session_id`. `--resume "$C"` continued the successful session. |
| + |
| +```json |
| +{"type":"system","subtype":"init","session_id":"a60ed016-112e-4dfe-bb26-86734a1fc429","model":"claude-haiku-4-5","permissionMode":"default","claude_code_version":"2.1.312"} |
| +{"type":"assistant","message":{"content":[{"type":"tool_use","name":"Write","input":{"file_path":".../repo/hello.txt","content":"hi"}}]}} |
| +{"type":"result","is_error":false,"terminal_reason":"completed","session_id":"a60ed016-112e-4dfe-bb26-86734a1fc429"} |
| +``` |
| + |
| +The first two processes exited 1 with `api_error_status:429`, `api_error:"usage_limit_reached"`, `terminal_reason:"api_error"` and `is_error:true`. Their result `subtype` was still `success`. A runner must inspect the error fields and process status, not that subtype alone. Launch/systemd diagnostics are plain stderr. Not every pre-initialization failure is a JSON event. |
| + |
| +**Codex exec: partly.** All 7 first-run and 6 resumed-run stdout lines were JSON. Start, assistant text, MCP lifecycle and completion appeared. The session ID was unchanged on `exec resume`. However, this model used `functions.exec` to call the shell, and exec's JSON stream omitted that custom-tool call and its output. They existed in the rollout file. Do not promise complete tool visibility from exec JSON alone. |
| + |
| +```json |
| +{"type":"thread.started","thread_id":"01a1a045-5a36-7aa0-a555-ce66213015ef"} |
| +{"type":"turn.started"} |
| +{"type":"item.started","item":{"type":"mcp_tool_call","server":"probe","tool":"probe_ping"}} |
| +{"type":"turn.completed","usage":{"input_tokens":66891,"cached_input_tokens":46720,"output_tokens":307}} |
| +``` |
| + |
| +**Codex app-server: yes for the tested live operations; partly for complete replay.** JSON-RPC over `--listen stdio://` supplied `thread/started`, `turn/started`, `item/started`, `item/completed`, text deltas, permission requests and `turn/completed`. Initialize returned the version-bearing `userAgent` and `codexHome`. Thread start/resume returned IDs, model and effective permission fields. The client answered server requests by their IDs. Stderr still carried plain diagnostics. The first invalid launch with global `--ignore-user-config` failed before initialization: that flag is accepted by exec, not app-server. |
| + |
| +Commands: Appendix A's `claude1c`, `claude2`, `codex1`, `codex2`, `app1` and `app2`; Appendix B's initialize/start/resume messages. The official headless and app-server descriptions are at [https://code.claude.com/docs/en/headless](https://code.claude.com/docs/en/headless) and [https://learn.chatgpt.com/docs/app-server](https://learn.chatgpt.com/docs/app-server). The findings above are from the installed binaries. |
| + |
| +## 2. Usage and model |
| + |
| +**Claude: yes, with mixed counter semantics.** Result `usage` and `model_usage_since_last_result` described the current prompted run. `modelUsage` and `total_cost_usd` accumulated across resume. Assistant messages named the resolved `claude-haiku-4-5-20251001` model. Several streamed assistant records shared a message ID and usage fields; summing every assistant record would double-count. |
| + |
| +```text |
| + input cache read cache creation output cost USD |
| +run 3 result usage 50 71992 15595 1580 |
| +run 5 result usage 18 33674 3095 600 |
| +run 5 modelUsage 68 105666 18690 2180 |
| +run 3 total_cost_usd 0.0463392 |
| +run 5 total_cost_usd 0.0589146 |
| +run 5 model_usage_since_last_result costUSD 0.0125754 |
| +``` |
| + |
| +**Codex: partly without runner accounting.** Exec's `turn.completed.usage` was cumulative across resume, despite the event name. It did not include the model. The model was available in app-server thread responses and persisted turn context. Input totals include cached input; cached input is a subset, not an extra amount to add. |
| + |
| +```text |
| + input cached input output |
| +exec first completion 66891 46720 307 |
| +exec resumed completion 101139 80384 361 |
| +second-turn difference 34248 33664 54 |
| +``` |
| + |
| +App-server `thread/tokenUsage/updated` had `total` and `last`. `last` described the last model request, not the whole multi-request user turn. At the two completed turns, totals were respectively input/output `32824/437` and `135028/894`. The second turn's difference was `102204/457`; its final `last` was only `17388/25`. Retain the previous durable totals per thread and derive increments. Interrupted-turn accounting, resets and compaction were not validated. |
| + |
| +Evidence commands: parse the final `result` or `turn.completed` lines from Appendix A's captured streams; for app-server filter `method == "thread/tokenUsage/updated"`. These are observed counters, not a billing reconciliation. |
| + |
| +## 3. Account binding |
| + |
| +**Claude: yes for explicit home selection and observed identity; partly for a no-failover contract. Codex: yes for explicit home and observed account; partly for a no-failover contract.** No sign-in was performed and no credentials were printed or copied. |
| + |
| +The existing registry supplied candidate home paths only. Fresh status commands confirmed all six Claude homes were signed in. The registry's quota timestamps explained the first two failures; those timestamps were not treated as fresh quota checks. |
| + |
| +```sh |
| +CLAUDE_CONFIG_DIR="$CH" CLAUDE_SECURESTORAGE_CONFIG_DIR="$CH" claude auth status --json |
| +CODEX_HOME="$CXH" codex login status |
| +# Through the initialized, explicitly homed app-server: |
| +{"id":2,"method":"account/read","params":{"refreshToken":false}} |
| +``` |
| + |
| +Trimmed output for the successful account selections: |
| + |
| +```json |
| +{"configDirectory":"/home/paulca/.paseo/zerosub/homes/claude-2b21c7944303","loggedIn":true,"authMethod":"claude.ai","email":"paul@rslw.com","subscriptionType":"max"} |
| +{"account":{"type":"chatgpt","email":"paul@tito.io","planType":"promax"},"workspaceRouting":{"backendOrigin":"https://chatgpt.com","accountRoutingOverride":"NO_CONSTRAINT"}} |
| +``` |
| + |
| +`codex login status` printed `Logged in using ChatGPT`; account/read supplied the identity. Claude init reported `apiKeySource:"none"`; it did not independently attest the OAuth account email on every turn. Status was checked against the selected home; simultaneous replacement of credentials in that home was not tested. |
| + |
| +| Existing Claude config home | Fresh status | |
| +| --- | --- | |
| +| `/home/paulca/.claude` | Signed in | |
| +| `/home/paulca/.paseo/zerosub/homes/claude-4f309ff29169` | Signed in | |
| +| `/home/paulca/.paseo/zerosub/homes/claude-047fd573ccc9` | Signed in | |
| +| `/home/paulca/.paseo/zerosub/homes/claude-37fe90ef3f56` | Signed in | |
| +| `/home/paulca/.paseo/zerosub/homes/claude-2b21c7944303` | Signed in; used successfully | |
| +| `/home/paulca/.paseo/zerosub/homes/claude-0abf6a6453ee` | Signed in | |
| + |
| +The registered Codex account used `/home/paulca/.codex`. No second Codex account was tested. A second account needs its own official CLI sign-in and writable credential home, selected explicitly at launch. Existing Claude homes already provide different identities, although their project-history directories are symlinked to shared storage. |
| + |
| +Both exhausted Claude homes failed in place. The harness explicitly changed homes between attempts; that was not CLI failover. No model fallback option was supplied. Direct launch bypasses ZeroSub account reassignment, but this test does not establish an immutable provider guarantee under every authentication failure. The runner must sanitize inherited routing/key variables, verify identity before prompting, control changes to the chosen home and fail closed on identity changes. The probe removed inherited `CLAUDE*`, `ANTHROPIC*`, `CODEX*`, `OPENAI*` and `PASEO*` variables before setting explicit homes. |
| + |
| +## 4. Tools per run |
| + |
| +**Claude: yes. Codex: yes.** The same tiny stdio Model Context Protocol (MCP) server ran from `$P/mcp.py`. Claude used `--strict-mcp-config --mcp-config "$P/mcp.json"`. Codex used per-invocation `-c mcp_servers.probe.command=...` and `.args=...`. No MCP server was installed into user config. App-server explicitly disabled the inherited `linear` MCP entry. |
| + |
| +```json |
| +{"mcpServers":{"probe":{"command":"python3","args":["/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/mcp.py"]}}} |
| +``` |
| + |
| +Claude's server-call log recorded `{"name":"probe_ping","arguments":{},"response":"equipo-mcp-ok"}`. Codex's first MCP attempt failed with `MCP tool call requires approval, but approval policy is never`. Adding `readOnlyHint:true`, `destructiveHint:false`, `idempotentHint:true` and `openWorldHint:false` to this genuinely read-only tool allowed the resumed run to call it: |
| + |
| +```json |
| +{"type":"item.completed","item":{"type":"mcp_tool_call","server":"probe","tool":"probe_ping","result":{"content":[{"type":"text","text":"equipo-mcp-ok"}]},"error":null,"status":"completed"}} |
| +``` |
| + |
| +Annotations affect permission behavior; they are not an isolation boundary. An arbitrary stdio MCP process has its own OS access. The runner must confine its tool server and authorize operations independently. Appendix C contains the server source, including the permission handler. |
| + |
| +## 5. Questions and permissions |
| + |
| +**Claude: yes.** `--permission-mode manual --permission-prompt-tool mcp__probe__permission` invoked our MCP handler. Init reported the internal name `default` for the selected manual mode. The handler approved `hello.txt`, denied `denied.txt`, and supplied an answer to `AskUserQuestion`. Host verification found `hello.txt == "hi"` and no `denied.txt`. |
| + |
| +```json |
| +{"tool_name":"Write","input":{"file_path":".../hello.txt","content":"hi"}} |
| +{"behavior":"allow","updatedInput":{"file_path":".../hello.txt","content":"hi"}} |
| +{"tool_name":"Write","input":{"file_path":".../denied.txt","content":"no"}} |
| +{"behavior":"deny","message":"Probe denial: do not retry."} |
| +{"tool_name":"AskUserQuestion","input":{"questions":[{"question":"Which word?","options":[{"label":"hi"},{"label":"bye"}]}]}} |
| +{"behavior":"allow","updatedInput":{"questions":["original question objects retained"],"answers":{"Which word?":"hi"}}} |
| +``` |
| + |
| +The result's `permission_denials` retained the denied Write. An allowed detached-sleep command executed. A separately requested plain foreground `sleep 600` was refused by the tool harness before our permission handler; that did not undo the detached process. `--permission-prompt-tool` is documented but absent from this binary's ordinary help output. Reference: [https://code.claude.com/docs/en/cli-reference](https://code.claude.com/docs/en/cli-reference). |
| + |
| +**Codex exec: partly; app-server: yes for tested approval and question paths.** Exec used `approval_policy="never"`, which denied the initially unannotated MCP tool without an interactive prompt. Exec supplied no bidirectional approval channel in this test. |
| + |
| +App-server used `approvalPolicy:"on-request"` and `approvalsReviewer:"user"`. It sent `item/commandExecution/requestApproval` with a request ID and the proposed command. The program sent these responses: |
| + |
| +```json |
| +{"id":0,"result":{"decision":"accept"}} |
| +{"id":1,"result":{"decision":"decline"}} |
| +``` |
| + |
| +The first turn grouped commands inside one code-mode call; denying the second cancelled that batch, and even `approved.txt` was absent. An approval response is not proof of an effect. In the next turn, the separately approved `setsid sleep` command produced `item/completed` with `exitCode:0` and the PID file existed. The denied file remained absent. No persistent execpolicy amendment was accepted. |
| + |
| +The question arrived as an asynchronous structured message, not the older `item/tool/requestUserInput` RPC: |
| + |
| +```json |
| +{"method":"item/completed","params":{"item":{"type":"agentMessage","delivery":"async","questions":[{"title":"Greeting","options":["hi","bye"]}]}}} |
| +``` |
| + |
| +The client answered the same active turn with the following request. For this temporary stdio harness, a second local process wrote this JSON into **our own** app-server's stdin pipe at `/proc/1404614/fd/0`; a production client would use its existing writer. |
| + |
| +```json |
| +{"id":900,"method":"turn/steer","params":{"threadId":"01a1a045-a71d-72f3-8dac-ad04b3a7ae69","expectedTurnId":"01a1a046-57ff-7770-970a-91a517cfe94e","input":[{"type":"text","text":"hi. Now perform the two already requested containment commands in order."}]}} |
| +``` |
| + |
| +The agent then performed the requested commands. The local schema also defines `item/tool/requestUserInput` answers, but that older path was not exercised. Support the actual emitted question representation for the pinned model/version. |
| + |
| +## 6. Read isolation |
| + |
| +**Claude: yes for shell and native Read with the combined policy tested.** The resumed launch passed these settings, with user/project/local settings excluded by `--setting-sources ''`: |
| + |
| +```json |
| +{"disableAllHooks":true,"enabledPlugins":{},"sandbox":{"enabled":true,"failIfUnavailable":true,"allowUnsandboxedCommands":false,"autoAllowBashIfSandboxed":true,"filesystem":{"denyRead":["/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/outside"]}},"permissions":{"deny":["Read(//home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/outside/**)"],"allow":["Read","Bash","mcp__probe__probe_ping"]}} |
| +``` |
| + |
| +The agent called native Read on each file, then Bash with `cat "$W/inside.txt"; cat "$P/outside/sentinel.txt"`. |
| + |
| +```text |
| +Read inside.txt: equipo-inside-readable |
| +Read sentinel.txt: File is in a directory that is denied by your permission settings. |
| +Bash exit 1: |
| + equipo-inside-readable |
| + cat: .../outside/sentinel.txt: No such file or directory |
| +Host control after both runs: equipo-outside-nonsecret |
| +``` |
| + |
| +The native denial came from `permissions.deny`. This does not establish that `sandbox.filesystem.denyRead` alone protects native Read. The shell denial came from the combined sandbox/permission policy. `failIfUnavailable` was supplied; a missing-sandbox-dependency startup test was not performed. Setting semantics: [https://code.claude.com/docs/en/settings-reference](https://code.claude.com/docs/en/settings-reference) and [https://code.claude.com/docs/en/sandboxing](https://code.claude.com/docs/en/sandboxing). |
| + |
| +**Codex: yes for shell; native text-read coverage unproven because no such tool was exposed.** The exec launch used `--ignore-user-config --ignore-rules`, no legacy `--sandbox`, and these overrides: |
| + |
| +```sh |
| +-c 'approval_policy="never"' \ |
| +-c 'default_permissions="probe"' \ |
| +-c 'permissions.probe.filesystem={":root"="read","/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo"="write","/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/outside"="deny"}' \ |
| +-c 'permissions.probe.network.enabled=false' |
| +``` |
| + |
| +The persisted custom-tool output, not merely the assistant's summary, contained: |
| + |
| +```text |
| +$ cat "$W/inside.txt" && cat "$P/outside/sentinel.txt" |
| +equipo-inside-readable |
| +cat: .../outside/sentinel.txt: Permission denied |
| +``` |
| + |
| +This is a targeted deny test, not a workspace-only allowlist: `:root="read"` still allows other paths. No native text reader was available in the tested Codex toolset. The image reader and MCP-based reads were not tested against this policy. The named profile bypasses Paseo's current inability to pass these settings, but full deployed-policy certification remains necessary. Permission profiles are beta and legacy sandbox settings can override them; see [https://learn.chatgpt.com/docs/permissions](https://learn.chatgpt.com/docs/permissions). |
| + |
| +## 7. Containment |
| + |
| +**Both: partly. A user scope accounts for ordinary children but is not an escape-resistant boundary under this shared UID.** Every prompted launch used a transient `equipo-probe-...-hpha7.scope` with `KillMode=control-group`. |
| + |
| +Claude launched `setsid sleep 600 </dev/null >/dev/null 2>&1 & echo $! > claude-child.pid`. The stored PID was 1363405; `setsid` forked and the surviving host process was 1363406. After Claude exited, its scope remained active and contained that sleep: |
| + |
| +```sh |
| +systemctl --user show equipo-probe-claude1c-hpha7.scope -p ActiveState -p ControlGroup |
| +# Python snapshot: read each cgroup.procs under the returned ControlGroup |
| +# and resolve each listed PID through /proc/<pid>/comm. |
| +systemctl --user stop equipo-probe-claude1c-hpha7.scope |
| +``` |
| + |
| +```text |
| +ActiveState=active |
| +ControlGroup=/user.slice/user-1001.slice/user@1001.service/app.slice/equipo-probe-claude1c-hpha7.scope |
| +1363406 sleep |
| +After stop: cgroup absent; PID absent |
| +``` |
| + |
| +Codex's agent also launched the detached sleep (PID file 1432788), then started a foreground Python sleep. Its turn completed while that tool session was running. The harness's `finally` stopped the scope before the external snapshot. Consequently the agent-run snapshot does **not** prove complete live membership. An empty `ControlGroup` caused one read-only collection attempt to scan the cgroup root; that invalid collection was discarded and used for no conclusion or signalling. All kill/stop commands named only our exact scopes. |
| + |
| +A separate, non-model app-server control then held the same detached command open long enough to enumerate all members. This is supplementary process evidence, not another agent run or a mid-turn crash test: |
| + |
| +```json |
| +{"id":90,"method":"command/exec","params":{"command":["/bin/bash","-lc","setsid sleep 600 </dev/null >/dev/null 2>&1 & echo $! > /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo/codex-replay2-child.pid; sleep 600"],"cwd":"/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo","sandboxPolicy":{"type":"dangerFullAccess"},"timeoutMs":600000}} |
| +``` |
| + |
| +```text |
| +scope equipo-probe-contain2-hpha7.scope, recursive cgroup.procs snapshot: |
| +1451696 codex |
| +1451771 sleep |
| +1451777 sleep |
| +$ systemctl --user kill --signal=KILL equipo-probe-contain2-hpha7.scope |
| +$ systemctl --user stop equipo-probe-contain2-hpha7.scope |
| +cgroup absent; both sleep PIDs gone; CLI briefly a zombie, then reaped |
| +``` |
| + |
| +The original short `command/exec` control reaped its child before enumeration; the held-command control above is the valid snapshot. No control enabled bypass mode for an isolation-test agent. |
| + |
| +For the escape test, two additional scopes belonged solely to this probe. A Python process inside the source scope executed: |
| + |
| +```python |
| +pathlib.Path(destination_cgroup + "/cgroup.procs").write_text(str(os.getpid())) |
| +``` |
| + |
| +```text |
| +PID 1431824 |
| +before: .../equipo-probe-escape2-hpha7.scope |
| +write: succeeded |
| +after: .../equipo-probe-destination2-hpha7.scope |
| +stop source: unit no longer loaded; escaped process still alive |
| +stop destination: process terminated (brief zombie, subsequently absent) |
| +``` |
| + |
| +The source scope vanished after its sole process migrated. Its emptiness therefore could not certify termination. The test moved only our own PID into our own scope. It did not access other sessions' scopes. Dedicated runner ownership is still needed to avoid shared-user ambiguity; stronger containment also requires preventing cgroup migration and user-service spawning by agent tools, including access to user-systemd sockets. A user scope alone is insufficient even on a dedicated account if those escape routes remain available. |
| + |
| +## 8. Version and effective configuration |
| + |
| +**Version: yes for both. Effective config: Claude partly; Codex partly, with substantially better readback.** |
| + |
| +```text |
| +$ claude --version |
| +2.1.312 (Claude Code) |
| +$ codex --version |
| +codex-cli 0.165.0 |
| +``` |
| + |
| +Claude init returned `claude_code_version`, model, MCP connection state and `permissionMode`. It did not return the full merged sandbox/read policy. We controlled supplied settings and excluded ordinary setting sources; managed settings remain a possible input. The help also warns that invalid settings can be silently ignored in print mode. Hashing only the supplied JSON is therefore not an attestation of the effective policy. |
| + |
| +Codex app-server readback: |
| + |
| +```json |
| +{"id":3,"method":"config/read","params":{"cwd":"/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo","includeLayers":true}} |
| +``` |
| + |
| +The result contained `config`, `layers` and `origins`, including `sessionFlags` origin hashes for model and approval policy, a user-config layer and `/etc/codex/config.toml`. Thread start/resume separately returned: |
| + |
| +```json |
| +{"model":"gpt-6-luna","modelProvider":"openai","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"readOnly","networkAccess":false},"activePermissionProfile":null,"runtimeWorkspaceRoots":[".../repo"]} |
| +``` |
| + |
| +This readback describes the app-server runs, **not** the exec run's named deny profile. The exec profile was verified by the denied operation and explicit overrides, not by a matching full app-server profile readback. Collect thread-level overrides as well as server config; they are not interchangeable. |
| + |
| +The installed standalone Codex package contained no README. `codex app-server generate-json-schema --experimental --out "$P/schema"` supplied the protocol schema used by the harness. Ordinary CLI help and official pages supplemented it. No binary update was performed. |
| + |
| +The trust-entry side effect was identified by comparing app-server's earlier user-config layer with the later file: only `[projects."$W"]` with `trust_level = "trusted"` had been added. Removing that exact block restored the original hash. `~/.claude/settings.json` also matched its baseline. A production service should use a runner-owned writable configuration home and measure all mutable inputs. |
| + |
| +## 9. Recovery and persisted events |
| + |
| +**Both: partly. Completed-session resume was demonstrated; mid-turn runner-crash recovery was not.** The intended foreground sleeps did not leave a model turn open: Claude refused one, and Codex yielded a tool session then completed its turn. The eight-run ceiling prevented a fresh prompted crash test. Do not classify this as a successful mid-turn recovery test. |
| + |
| +Claude's new process resumed `$C` with `--resume`, retaining conversation and cumulative usage. Its logical transcript path under `$CH/projects/` resolved through an existing symlink to: |
| + |
| +```text |
| +/home/paulca/.claude/projects/-home-paulca--cache-tmp-equipo-direct-probe-hpha7-x0-repo/a60ed016-112e-4dfe-bb26-86734a1fc429.jsonl |
| +``` |
| + |
| +It contained user/assistant/tool records, 21 assistant records with usage and `cost-state` records. It contained **zero** stdout `result` records. The launch-specific completion envelope is not a durable replay stream merely because the conversation can resume. Model messages and tool results were recoverable locally; reconstructing exact completion/usage semantics from those records was not validated. |
| + |
| +Codex persisted exec and app-server sessions at: |
| + |
| +```text |
| +$CODEX_HOME/sessions/2026/11/03/rollout-2026-11-03T07-17-42-01a1a045-5a36-7aa0-a555-ce66213015ef.jsonl |
| +$CODEX_HOME/sessions/2026/11/03/rollout-2026-11-03T07-18-01-01a1a045-a71d-72f3-8dac-ad04b3a7ae69.jsonl |
| +``` |
| + |
| +The exec rollout contained the missing custom shell output and numbered records. The app-server rollout contained eight `token_count` events and two `task_complete` events; those records did not have the exec file's ordinal field. Do not assume a single durable sequence format across these entry points. |
| + |
| +After stopping and starting the app-server, these requests worked without sending another model prompt: |
| + |
| +```json |
| +{"id":2,"method":"thread/read","params":{"threadId":"01a1a045-a71d-72f3-8dac-ad04b3a7ae69","includeTurns":true}} |
| +{"id":3,"method":"thread/resume","params":{"threadId":"01a1a045-a71d-72f3-8dac-ad04b3a7ae69","model":"gpt-6-luna","cwd":"/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo","approvalPolicy":"on-request","sandbox":"read-only"}} |
| +``` |
| + |
| +Both returned two turns marked `completed`. The second included user/agent messages and a sleep item, but omitted command-execution details observed live. Neither returned token-usage fields in the thread object. This legacy-history test does not establish that the newer paginated history mode solves the omission. Raw rollout parsing recovered more evidence, but is a version-sensitive implementation dependency. |
| + |
| +If only a runner client restarts, whether a CLI survives depends on how it was launched and how stdin/stdout are owned. In this probe the harness deliberately stopped its scopes on exit. A production runner needs an independent supervisor, durable capture before forwarding events, stable deduplication identities, and explicit reconciliation of unknown or interrupted turns. Do not redispatch merely because a completion event was lost. |
| + |
| +## The six discussion gaps, plus Codex reads |
| + |
| +| Discussion 3 gap | Direct result | What remains | |
| +| --- | --- | --- | |
| +| 1. Bind an account, observe it, prevent failover | **Needs controlled credential homes and identity checks** | Explicit homes and status/account-read work; two exhausted Claude accounts failed in place. A permanent no-reassignment contract and protection against home mutation were not established. | |
| +| 2. Report provider binary version | **Solved directly** | Capture version at launch; Claude init and Codex app-server/thread metadata also identify the binary version. Parse CLI version output into the runner's own structured record. | |
| +| 3. Effective isolation configuration | **Needs provider-specific attestation** | Codex exposes layered config and thread policy; the exact exec deny profile still needs matching readback. Claude init exposes only part of the merged policy. | |
| +| 4. Recoverable completion and usage | **Still open** | Completed resume works, but replay omits fields, counters mix cumulative and request-local semantics, and mid-turn crash recovery remains untested. | |
| +| 5. Amadan branch description readback | **Still open here** | Provider CLIs do not add the missing Amadan contract. Discussion 3 says it is being built on `branch-description-read`; this probe did not verify its delivery. | |
| +| 6. Process coverage on a shared user | **Needs protected containment and the dedicated runner user** | Scopes contain ordinary detached children, but same-UID processes can move themselves out. Empty scope is not an escape proof. | |
| +| Codex read isolation | **Solved directly for tested shell deny; needs broader policy verification** | Named deny profiles work without Paseo. Native reader coverage, full allowlist policy, tools and all escape routes still require certification. | |
| + |
| +## Recommendation and cleanup |
| + |
| +Do **not** replace the production Paseo layer on the strength of this probe. Build a version-pinned direct adapter as the next isolated validation step if replacing the transport remains desirable. Claude headless and Codex app-server provide enough control for that work; Codex exec JSON alone omits required tool visibility. |
| + |
| +The runner would own process supervision, credential-home selection, environment sanitization, per-attempt tools, workspace preparation and cleanup, permission/question routing, usage deltas and a durable event journal. Before changing eligibility, prove crash recovery and completion accounting, attest the effective policy, and block cgroup/user-service escapes. Keep the Amadan readback gate independent. These requirements remain even if a supervised trial is chosen. |
| + |
| +No application code changed, so `make ci` was not run. Checks were the actual provider calls, JSON parsing of every captured stdout line, positive workspace reads, negative sentinel reads with a host control, write-effect checks, scope termination, process migration, session readback and config-hash restoration. This probe did not add implementation tests or claim the repository's mutation-test gate had run. |
| + |
| +Cleanup stopped every probe scope and reaped harness processes. Codex's two probe threads were deleted through `thread/delete`; only the probe's Claude transcript/debug artifacts were removed. The throwaway repository, stdio server, generated schema and captured scratch files were removed after retaining the evidence here. No review server, watcher or background process was left running. No `.claude/HANDOFF.md` was written. |
| + |
| +## Appendix A: exact launch commands |
| + |
| +Each command below ran with `cwd=$W`, stdout to `$P/<label>.jsonl` and stderr to `$P/<label>.err`. The environment filter described in section 3 ran first. Every launch set `CODEX_HOME=/home/paulca/.codex` and `CLAUDE_TMPDIR=$P/claude-tmp`; both Claude home variables were set to the home listed per launch. Shell quoting below is generated from the recorded argument arrays. |
| + |
| +### claude1 |
| + |
| +Both Claude home variables: `/home/paulca/.claude`. |
| + |
| +```sh |
| +systemd-run --user --scope --unit=equipo-probe-claude1-hpha7 --property=KillMode=control-group claude -p --verbose --output-format stream-json --model claude-haiku-4-5 --effort low --setting-sources '' --disable-slash-commands --strict-mcp-config --mcp-config /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/mcp.json --tools Bash,Read,Write,AskUserQuestion --permission-mode manual --permission-prompt-tool mcp__probe__permission --settings /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/claude.json 'Do only these probe actions, no skills or agents. Call probe_ping once. Use Write to create hello.txt containing hi. Use Write to create denied.txt containing no; if denied do not retry. Use AskUserQuestion to ask which word with choices hi and bye. Finally use Bash to run exactly: setsid sleep 600 </dev/null >/dev/null 2>&1 & echo $! > claude-child.pid . Instead of the final dot, end the command at claude-child.pid. Report briefly.' |
| +``` |
| + |
| +### claude1b |
| + |
| +Both Claude home variables: `/home/paulca/.paseo/zerosub/homes/claude-4f309ff29169`. |
| + |
| +```sh |
| +systemd-run --user --scope --unit=equipo-probe-claude1b-hpha7 --property=KillMode=control-group claude -p --verbose --output-format stream-json --model claude-haiku-4-5 --effort low --setting-sources '' --disable-slash-commands --strict-mcp-config --mcp-config /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/mcp.json --tools Bash,Read,Write,AskUserQuestion --permission-mode manual --permission-prompt-tool mcp__probe__permission --settings /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/claude.json 'Do only these probe actions, no skills or agents. Call probe_ping once. Use Write to create hello.txt containing hi. Use Write to create denied.txt containing no; if denied do not retry. Use AskUserQuestion to ask which word with choices hi and bye. Finally use Bash to run exactly: setsid sleep 600 </dev/null >/dev/null 2>&1 & echo $! > claude-child.pid . Instead of the final dot, end the command at claude-child.pid. Report briefly.' |
| +``` |
| + |
| +### claude1c |
| + |
| +Both Claude home variables: `/home/paulca/.paseo/zerosub/homes/claude-2b21c7944303`. |
| + |
| +```sh |
| +systemd-run --user --scope --unit=equipo-probe-claude1c-hpha7 --property=KillMode=control-group claude -p --verbose --output-format stream-json --model claude-haiku-4-5 --effort low --setting-sources '' --disable-slash-commands --strict-mcp-config --mcp-config /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/mcp.json --tools Bash,Read,Write,AskUserQuestion --permission-mode manual --permission-prompt-tool mcp__probe__permission --settings /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/claude.json 'Do only these probe actions, no skills or agents. Call probe_ping once. Use Write to create hello.txt containing hi. Use Write to create denied.txt containing no; if denied do not retry. Use AskUserQuestion to ask which word with choices hi and bye. Finally use Bash to run exactly: setsid sleep 600 </dev/null >/dev/null 2>&1 & echo $! > claude-child.pid . Instead of the final dot, end the command at claude-child.pid. Then run Bash sleep 600 in the foreground. Do not wait for more instructions.' |
| +``` |
| + |
| +### codex1 |
| + |
| +```sh |
| +systemd-run --user --scope --unit=equipo-probe-codex1-hpha7 --property=KillMode=control-group codex exec --json --ignore-user-config --ignore-rules -m gpt-6-luna -c 'model_reasoning_effort="low"' -c 'approval_policy="never"' -c features.multi_agent=false -c features.apps=false -c 'default_permissions="probe"' -c 'permissions.probe.filesystem={":root"="read","/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo"="write","/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/outside"="deny"}' -c permissions.probe.network.enabled=false -c 'mcp_servers.probe.command="python3"' -c 'mcp_servers.probe.args=["/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/mcp.py"]' -c mcp_servers.probe.required=true 'No skills or other agents. Call MCP probe_ping once. Use shell cat to read /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo/inside.txt then cat /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/outside/sentinel.txt. Also try the native file-read tool on those two files if one is available. Report denials without bypassing. Do nothing else.' |
| +``` |
| + |
| +### claude2 |
| + |
| +Both Claude home variables: `/home/paulca/.paseo/zerosub/homes/claude-2b21c7944303`. |
| + |
| +```sh |
| +systemd-run --user --scope --unit=equipo-probe-claude2-hpha7 --property=KillMode=control-group claude -p --verbose --output-format stream-json --model claude-haiku-4-5 --effort low --setting-sources '' --disable-slash-commands --strict-mcp-config --mcp-config /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/mcp.json --tools Bash,Read,Write,AskUserQuestion --permission-mode manual --permission-prompt-tool mcp__probe__permission --settings /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/claude.json --resume a60ed016-112e-4dfe-bb26-86734a1fc429 'Do only these checks and report actual tool results. Use Read on /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo/inside.txt then Read on /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/outside/sentinel.txt. Then Bash: cat /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo/inside.txt; cat /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/outside/sentinel.txt . End command at sentinel.txt with no dot. No other tools, no attempts to bypass a denial.' |
| +``` |
| + |
| +### app1 |
| + |
| +```sh |
| +systemd-run --user --scope --expand-environment=no --unit=equipo-probe-app1-hpha7 --property=KillMode=control-group codex app-server --listen stdio:// -c 'model="gpt-6-luna"' -c 'model_reasoning_effort="low"' -c features.apps=false -c features.multi_agent=false -c 'approval_policy="on-request"' -c 'approvals_reviewer="user"' -c 'mcp_servers.probe.command="python3"' -c 'mcp_servers.probe.args=["/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/mcp.py"]' -c mcp_servers.linear.enabled=false -c 'developer_instructions="Only perform the supplied disposable probe. No skills or agents."' -c 'model_provider="openai"' |
| +``` |
| + |
| +### codex2 |
| + |
| +```sh |
| +systemd-run --user --scope --unit=equipo-probe-codex2-hpha7 --property=KillMode=control-group codex exec --json --ignore-user-config --ignore-rules -m gpt-6-luna -c 'model_reasoning_effort="low"' -c 'approval_policy="never"' -c features.multi_agent=false -c features.apps=false -c 'default_permissions="probe"' -c 'permissions.probe.filesystem={":root"="read","/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo"="write","/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/outside"="deny"}' -c permissions.probe.network.enabled=false -c 'mcp_servers.probe.command="python3"' -c 'mcp_servers.probe.args=["/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/mcp.py"]' -c mcp_servers.probe.required=true resume 01a1a045-5a36-7aa0-a555-ce66213015ef 'Call MCP probe_ping once, then report its result and the workspace file content from the previous turn. No other tools.' |
| +``` |
| + |
| +### app2 |
| + |
| +```sh |
| +systemd-run --user --scope --expand-environment=no --unit=equipo-probe-app2-hpha7 --property=KillMode=control-group codex app-server --listen stdio:// -c 'model="gpt-6-luna"' -c 'model_reasoning_effort="low"' -c features.apps=false -c features.multi_agent=false -c 'approval_policy="on-request"' -c 'approvals_reviewer="user"' -c 'mcp_servers.probe.command="python3"' -c 'mcp_servers.probe.args=["/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/mcp.py"]' -c mcp_servers.linear.enabled=false -c 'developer_instructions="Only perform the supplied disposable probe. No skills or agents."' -c 'model_provider="openai"' |
| +``` |
| + |
| +The first three Claude launches used this initial `$P/claude.json`; section 6 gives the replacement used for `claude2`: |
| + |
| +```json |
| +{"disableAllHooks":true,"enabledPlugins":{},"sandbox":{"enabled":false},"permissions":{"ask":["Write","Bash","AskUserQuestion"],"allow":["mcp__probe__probe_ping"]}} |
| +``` |
| + |
| +Sandboxing was disabled for the first containment/permission probe, then enabled for the read-isolation probe. Neither result is substituted for the other. |
| + |
| +## Appendix B: app-server requests |
| + |
| +The harness wrote one JSON object per stdin line and parsed one per stdout line. It initialized with `experimentalApi:true`, then sent `initialized`. Server permission requests were answered with the matching ID. Only these two `turn/start` requests were sent; the later question answer used `turn/steer` in the same active turn. |
| + |
| +### app1 |
| + |
| +```json |
| +{"id":1,"method":"initialize","params":{"clientInfo":{"name":"equipo_probe","version":"1"},"capabilities":{"experimentalApi":true}}} |
| +{"method":"initialized","params":{}} |
| +{"id":2,"method":"thread/start","params":{"model":"gpt-6-luna","cwd":"/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":"read-only","config":{"features.apps":false,"features.multi_agent":false,"model_reasoning_effort":"low"},"developerInstructions":"Do only the exact probe actions. No skills, no agents, no unrelated file reads.","historyMode":"legacy"}} |
| +{"id":3,"method":"turn/start","params":{"threadId":"01a1a045-a71d-72f3-8dac-ad04b3a7ae69","input":[{"type":"text","text":"Use shell command execution with sandbox_permissions=require_escalated for these separate commands: (1) printf hi > /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo/approved.txt (2) printf no > /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo/denied.txt (3) setsid sleep 600 </dev/null >/dev/null 2>&1 & echo $! > /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo/codex-child.pid . End the third command at .pid with no final dot. Do not retry any denial. Then report the results briefly. Do not use apply_patch."}],"effort":"low"}} |
| +``` |
| + |
| +### app2 |
| + |
| +```json |
| +{"id":1,"method":"initialize","params":{"clientInfo":{"name":"equipo_probe","version":"1"},"capabilities":{"experimentalApi":true}}} |
| +{"method":"initialized","params":{}} |
| +{"id":2,"method":"thread/resume","params":{"threadId":"01a1a045-a71d-72f3-8dac-ad04b3a7ae69","model":"gpt-6-luna","cwd":"/home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo","approvalPolicy":"on-request","sandbox":"read-only"}} |
| +{"id":3,"method":"turn/start","params":{"threadId":"01a1a045-a71d-72f3-8dac-ad04b3a7ae69","input":[{"type":"text","text":"First use request_user_input to ask which greeting, choices hi and bye. After the answer run exactly one shell command with sandbox_permissions=require_escalated: setsid sleep 600 </dev/null >/dev/null 2>&1 & echo $! > /home/paulca/.cache/tmp/equipo-direct-probe-hpha7_x0/repo/codex-child.pid . Omit the final dot. Then run python3 -c \"import time; time.sleep(600)\" in the foreground. This is an explicitly authorized disposable containment test, do not modify other files."}],"collaborationMode":{"mode":"plan","settings":{"model":"gpt-6-luna","reasoning_effort":"low","developer_instructions":"Ask the requested structured question, then execute the explicitly requested containment commands. No other tools or files."}}}} |
| +``` |
| + |
| +A program should also handle asynchronous question-bearing agent messages. This harness initially waited for the older question RPC, then sent the observed asynchronous answer through `turn/steer`. That was a harness adaptation, not a new prompted run. |
| + |
| +## Appendix C: stdio MCP server |
| + |
| +The initial server lacked the `annotations` object on `probe_ping`; the final source below includes the four hints added before `codex2`. The permission tool only handled the known disposable probe requests. It is deliberately not a production authorization policy. |
| + |
| +```python |
| +import sys,json,pathlib |
| +root=pathlib.Path(__file__).parent |
| +for line in sys.stdin: |
| + m=json.loads(line); method=m.get('method'); result={} |
| + if 'id' not in m: continue |
| + if method=='initialize': result={'protocolVersion':'2024-11-05','capabilities':{'tools':{}},'serverInfo':{'name':'equipo-probe','version':'1'}} |
| + elif method=='tools/list': result={'tools':[ |
| + {'name':'probe_ping','description':'Return a nonsecret probe marker','annotations':{'readOnlyHint':True,'destructiveHint':False,'idempotentHint':True,'openWorldHint':False},'inputSchema':{'type':'object','properties':{}}}, |
| + {'name':'permission','description':'Decide a probe permission request','inputSchema':{'type':'object','properties':{'tool_name':{'type':'string'},'input':{'type':'object'},'tool_use_id':{'type':'string'}},'required':['tool_name','input']}}]} |
| + elif method=='tools/call': |
| + name=m['params']['name']; a=m['params'].get('arguments',{}) |
| + if name=='permission': |
| + inp=a.get('input',{}); deny='denied.txt' in json.dumps(inp) |
| + value={'behavior':'deny','message':'Probe denial: do not retry.'} if deny else {'behavior':'allow','updatedInput':inp} |
| + if a.get('tool_name')=='AskUserQuestion': |
| + value['updatedInput']={**inp,'answers':{q['question']:'hi' for q in inp.get('questions',[])}} |
| + else: value='equipo-mcp-ok' |
| + with (root/'mcp-calls.jsonl').open('a') as f: f.write(json.dumps({'name':name,'arguments':a,'response':value})+'\n') |
| + result={'content':[{'type':'text','text':json.dumps(value) if isinstance(value,dict) else value}]} |
| + print(json.dumps({'jsonrpc':'2.0','id':m['id'],'result':result}),flush=True) |
| +``` |