Repository navigation
docs(codex): measure per-thread MCP environment boundaries - #842
Merged
Merged
Conversation
stamp-build
Bot
force-pushed
the
agent/otter/codex-mcp-env
branch
2 times, most recently
from
November 16, 2026 13:45
05f7557 to
913f851
Compare
stamp-build
Bot
force-pushed
the
agent/otter/codex-mcp-env
branch
from
November 16, 2026 16:00
913f851 to
965f619
Compare
stamp-build Bot
added a commit
that referenced
this pull request
Nov 16, 2026
<!-- stamp:review:v1 --> <sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_7af5f2d40bc7765e123c92541169d1dc"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp →</a></sup> --- <!-- /stamp:review:v1 --> Design for letting Raft-style hosts (each agent with its own credential) share one Codex app-server, from the evidence in #828 and #842. No code change; the adapter work follows. - **`env` stays process-level** and keeps splitting the shared pool: Codex reads some variables itself (API keys, proxies, certificates, `CODEX_HOME`), and thread configuration cannot change those. - **A separate tool-only scope (`toolEnv`)** carries variables meant only for the tools started for a session. On Linux, Codex 0.169.0 delivers them per thread to the shell (`shell_environment_policy.set`) and stdio MCP servers (`mcp_servers.<name>.env`); none reached a peer's children, persisted files under `CODEX_HOME` or model requests. They never enter the shared process environment, which Codex copies into live shell snapshots. - **Only an explicit shared request** pools sessions whose `toolEnv` differs, and only on a measured platform (Linux). Automatic placement keeps them apart. - **Declared differences:** user hooks and user-configured MCP `env_vars` keep the process environment; same-user tools can read a peer's environment through `/proc` in either placement (not a credential boundary); `toolEnv` values in recorded native requests are redacted whatever their name. - Also records the hook-trust timing difference measured in #823. Changed: `docs/design/system.md` (rule 1), `docs/design/decisions.md` (new entry), `docs/runtimes/codex.md`. Two rounds of independent review; the first rejected moving the whole `env` per thread, which led to the tool-only scope. `pnpm run check` passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Cindy <[email protected]>
Merged
stamp-build Bot
added a commit
that referenced
this pull request
Nov 16, 2026
<!-- stamp:review:v1 --> <sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_eceb15d527901fd3e637198cbc05d8c3"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp →</a></sup> --- <!-- /stamp:review:v1 --> Three breaking changes to the public API surface (109 unused or retired export names and `usability()` removed, and a stricter installation type), skill lists for Kimi and OpenCode with a shared `scope` field on every runtime's skills, DSH system prompts, and upgrading an Antigravity CLI that is below OAR's minimum version. Runtimes and sessions behave as before. ## Breaking: unused public exports removed (#851) 109 export names that are unused or explicitly retired are no longer public: mostly per-runtime entry points that duplicate a `Runtime` member (`codexSession`, `claudeListModels`, `antigravityInstallation`, ...), internal parsers and convenience reducers. Where there is a replacement it is usually the runtime object, for example `codexRuntime.session` or `claudeRuntime.accountUsage`; some names (internal parsers, `PiModelCatalogOptions`) have none. Every removed name is listed with its replacement, or the reason there is none, in the [migration table](https://github.com/botiverse/oar/blob/main/experiments/public-api-sweep-2026-11-16/README.md#migration-table). Runtime behavior, record formats and the retained types are unchanged. Kept on purpose: `orient()` and its types, `claudeInstallation`, and the runtime-author SPI on `@botiverse/oar/kernel` (`inputImagesRefusal`, `withInputImages`, `withdrawHeld`, `HeldInput`). ## Breaking: `usability()` removed; `orient()` kept (#835) `usability()` and its types (`RuntimeUsability`, `UsabilityOptions`, `UnusableReason`) are gone from every entry point (root, browser and `@botiverse/oar/observe`). Readiness is host policy: read the probes in an `orient()` snapshot directly. A probe answered `unsupported` (this runtime has no such reader) stays distinct from one that failed or timed out, and an auth probe that answered can still say `unknown`. `orient()` stays because a host depends on its single time budget, its three depths and its per-probe outcomes. ## Breaking: installation snapshot types; upgrade a too-old Antigravity (#856) `installation()` now reports a located executable below OAR's minimum version as the new exported type `VersionUnsupportedInstallation`: `kind: "unsupported"`, `code: "version_unsupported"`, `reason`, `via: "executable"` and its `command`, with `installedVersion` and `requiredVersion` when known. Other `unsupported` snapshots no longer carry `code` or version fields. Code that builds or narrows these snapshots must follow the new shapes. `checkUpdate()` and `upgrade()` accept a `VersionUnsupportedInstallation`; other readers still take only an available installation. The `oar upgrade` command accepts it too. Antigravity gains `upgrade` through its own `agy update` (measured from 1.4.9 to 1.5.9), so a host can update an agy below 1.5.0 in place. DSH has no native self-updater and so no `upgrade`; Pi's `pi update --self` is not connected yet. ## Skills: Kimi, OpenCode, and `scope` everywhere (#840, #849, #850) - **Kimi** `skills()` reads Kimi's own Web workspace catalog, including its built-in skills, without a session or a prompt. It starts a private loopback service, reads, and stops it on success, failure and timeout. Kimi can write its usual logs, indexes, project registration and a persistent `server.token`, as opening a Kimi session would. A workspace that already existed is never unregistered; an interrupted read can leave the one it created behind. - **OpenCode** `skills()` uses `debug skill` on v1 and the native HTTP catalog on v2 (2.2.7 or newer), read after plugin activation; older v2 answers `version_unsupported`. On v2 a plugin that failed to load marks the result `partial`. Built-in skills get `source: "builtin"`. - **Grok** skills keep their native source and path (1.0.77 reports them as an object). - **New optional fields on `SkillEntry`, filled for Claude, Codex, Grok, Kimi, OpenCode and Pi:** `scope` (`builtin`, `user`, `project`, `managed` or `other`) and `plugin` (the native plugin or package). `scope` comes only from a category the runtime itself reports, or for OpenCode from the native root a skill was loaded from; absent means unknown. The native `source` string is unchanged. ## DSH: system prompts (#836, #853) DSH sessions now accept `systemPrompt` and `appendSystemPrompt` instead of refusing them, as literal agent-scoped prompt sections. Replacement and append together become one complete section; a conflicting native complete prompt refuses the open. On resume a supplied value applies immediately and an omitted one returns to the native default (declared in `Runtime.resumedSessionOptions`). Native child agents keep their own default prompts. `launchArgs` and a root-session `outputSchema` stay refused; the `launchArgs` refusal message now gives the measured reason (an overlay can disable the OAR bridge). ## Testing (#847, #848) `scriptedRuntime` scripts can make the runtime's process exit on its own (`turn.exit(code)`), recorded like a vendor process's unexpected exit, so a host can test that path. Passing an `effort` to a scripted runtime that lists no effort levels now throws `UnsupportedOptionError` instead of a plain `Error`, like other runtimes. Contributed by TennyZhuang (Airwing). ## Also - Design: a tool-only environment (`toolEnv`) for sharing one Codex process across agents with their own credentials (#852); not implemented yet. Evidence on per-thread MCP environment (#842). - Daily runtime version record (#854) and clearer sea-trial failure messages (#855). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Cindy <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The earlier thread-isolation probe exercised shell environment and MCP
env_vars, leaving explicit per-thread MCPenvunmeasured. This native Codex 0.169.0 follow-up shows that two threads with the same MCP command and arguments get separate children with their own explicit values. After an app-server restart, omitting config loses both the MCP registration and shell token; supplying it restores them.Add reproducible local-provider probes, selected evidence and a comparison with upstream 75fc67e8. Nine recursive CODEX_HOME scans found no literal per-thread MCP or shell tokens, while process-environment controls appeared in live shell snapshots. All 27 captured model requests were free of test tokens. A separate explicitly enabled loopback WebSocket experiment lets A's model-invoked shell read B's metadata/history through native RPC, without returning the tested tokens. The report distinguishes that listener from OAR's stdio transport and bounds the persistence claims.
No production adapter, credentials policy or shared-placement admission changes. The experiment uses the optional launch-env argument merged in #828. Cindy and Tenny review the credential-boundary evidence. Rebased after #828, #837, #840 and #836 merged; the only manual conflict retained both experiment-index entries. The report, probes and selected native evidence are unchanged.
Validation: native 0.169.0 Linux x64, 12 stdio turns plus 2 socket turns, all through a local scripted provider; selection assertions verify environments, distinct instances, resume behavior, file scans and peer-read responses.
CI=1 pnpm run checkpassed 4,495 unit tests and 18 mock behavior cases. Full raw evidence and initial runs remain local with committed fingerprints. No real-account calls.