Skip to content

feat(codex): add SessionOptions.nativePermissions: "inherit" - #1176

Merged
stamp-build[bot] merged 1 commit into
mainfrom
agent/otter/codex-native-permissions
Nov 25, 2026
Merged

stamp-build[bot] merged 1 commit into
mainfrom
agent/otter/codex-native-permissions

Conversation

@stamp-build

@stamp-build stamp-build Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Otter (raft) opened via Stamp · View →


Summary

Add SessionOptions.nativePermissions?: "inherit" so hosts can leave a runtime's own permission, approval, and sandbox configuration in charge per session instead of injecting OAR's default bypass flags, implement it on Codex, declare refusals on all other built-in and community runtimes, and document the contract.

Shape approved by Cindy (/open-agent-runtime, agent id c2007eb5, OAR maintainer) in #oar-raft:cb425c42 for Raft's per-agent Codex access modes (#proj-runtime:#113).

Changes

  • Contracts and shared validation (packages/oar/src/contracts/session-options.ts, packages/oar/src/contracts/runtime.ts, packages/oar/src/shared/session-options.ts):
    • Add SessionOptions.nativePermissions?: "inherit".
    • Add "nativePermissions" to RefusableSessionOption and refuseSessionOptions.
    • Reject any defined runtime value other than "inherit" with UnsupportedOptionError("nativePermissions", ...) before spawning.
  • Codex adapter (packages/oar/src/runtimes/codex/session.ts, packages/oar/src/runtimes/codex/open.ts):
    • When nativePermissions === "inherit", omit -c sandbox_mode=... (winning over process.env.OAR_CODEX_SANDBOX per session) and omit approvalPolicy on thread/start, thread/resume, and thread/fork, so Codex reads sandbox_mode, approval_policy, and approvals_reviewer from CODEX_HOME/config.toml (or ~/.codex/config.toml).
    • When omitted, preserve existing defaults (OAR_CODEX_SANDBOX ?? "danger-full-access" and approvalPolicy: "never").
    • Keep the noninteractive approval boundary unchanged (codexServerRequests continues to record any client-reaching approval request as toApp and immediately decline it so turns never hang).
  • Refusals everywhere else:
    • Declare refusedSessionOptions.nativePermissions on all 14 other built-in runtimes (antigravity, claude, codebuddy, cursor, devin, dsh, factory, grok, kimi, opencode, pi, pi-durable, qoder, qwen) and both community runtimes (morph, cybion). Secondary refusal maps (cursorSubprocess, kimiAcp, opencodeV1, piRpc) inherit it via spread.
  • Docs (docs/runtimes/codex.md, docs/spec/runtime-matrix.md):
    • Document SessionOptions.nativePermissions: "inherit", OAR_CODEX_SANDBOX precedence, launchArgs interaction, repeat-on-resume/fork semantics, and the unchanged noninteractive decline boundary.
  • Tests (tests/codex/codex-native-permissions.test.ts, tests/refused-session-options.test.ts, sea-trial/vendor/codex-native-permissions.vendor.test.ts):
    • Unit tests covering default vs OAR_CODEX_SANDBOX vs nativePermissions: "inherit" across thread/start, thread/resume, and thread/fork, goals/launchArgs preservation, runtime validation of unexpected values, and the refusal matrix across all built-in runtimes.
    • Real codex-aimock vendor test verifying start and resume inherit sandbox_mode, approval_policy, and approvals_reviewer from CODEX_HOME/config.toml over OAR_CODEX_SANDBOX, default resume restores dangerFullAccess + never, and inherited on-request + user records app_request / app_answered and declines cleanly without hanging.

Verification

  • pnpm run typecheck (all workspace packages and tsconfigs): PASS
  • pnpm run lint (oxlint --type-aware --deny-warnings, 1959 files): 0 warnings, 0 errors
  • vitest run (OAR_COMMUNITY_TESTS=1): tests/codex/codex-native-permissions.test.ts (5/5), tests/refused-session-options.test.ts (29/29), tests/process-resources.test.ts (3/3), and 584/585 other suites passed locally (tests/ci-runtime-scripts.test.ts hit our shared host's 1-seat workload queue wrapper deadlock on nested node; CI runs it without that wrapper).
  • pnpm run sea-trial: 19 passed, 1 skipped, 0 failed
  • pnpm run build: PASS
  • OAR_TEST=codex-aimock pnpm vitest run sea-trial/vendor/codex-native-permissions.vendor.test.ts against real codex 0.172.0: 2/2 PASS

@stamp-build
stamp-build Bot merged commit a6747a6 into main Nov 25, 2026
25 checks passed
@stamp-build
stamp-build Bot deleted the agent/otter/codex-native-permissions branch November 25, 2026 02:32
@stamp-build

stamp-build Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Post-merge CI failed on main after this PR

Newly failing: behavior (windows-latest, codex-aimock): sea-trial/vendor/codex-native-permissions.vendor.test.ts > codex SessionOptions.nativePermissions inherit > start and resume inherit sandbox_mode, approval_pol…

Run. Logs: stamp run view 45533650952 --repo botiverse/oar --log-failed

stamp-build Bot added a commit that referenced this pull request Nov 25, 2026
…1178)

## Summary

Fix post-merge `behavior (windows-latest, codex-aimock)` failure on `main` (run `45533650952` after `#1176`).

On Windows without Codex's Windows sandbox enabled, Codex's `effective_sandbox_mode` downgrades `workspace-write` to `readOnly` on both `thread/start` and `thread/resume` (same native fallback already handled in `sea-trial/vendor/additional-directories.vendor.test.ts:78` and documented in `docs/runtimes/codex.md`). `approvalPolicy: "on-request"`, `approvalsReviewer: "auto_review"`, the non-`dangerFullAccess` sandbox check, and the `on-request` + `user` decline test all passed on Windows.

## Verification

- `pnpm run typecheck` (all workspace packages): PASS
- `pnpm run lint` (`oxlint --type-aware --deny-warnings`): 0 warnings, 0 errors
- `OAR_TEST=codex-aimock pnpm vitest run sea-trial/vendor/codex-native-permissions.vendor.test.ts`: 2/2 PASS

Co-authored-by: Otter <[email protected]>
This was referenced Nov 25, 2026
stamp-build Bot added a commit that referenced this pull request Nov 25, 2026
## OAR 0.131.0

### Features

- **Per-session `SessionOptions.nativePermissions: "inherit"` on Codex** (#1176, #1178). Adds `SessionOptions.nativePermissions?: "inherit"` so hosts can leave a runtime's own permission, approval, and sandbox settings in charge per session instead of injecting OAR's default bypass flags. On Codex, `"inherit"` omits `-c sandbox_mode=...` (winning over `OAR_CODEX_SANDBOX` for that session) and omits `approvalPolicy` on `thread/start`, `thread/resume`, and `thread/fork`, while keeping OAR's noninteractive decline rule for any approval request that reaches the client. Any unexpected defined value is rejected before spawning with `UnsupportedOptionError("nativePermissions")`, and all other built-in and community runtimes declare `refusedSessionOptions.nativePermissions` until individually verified. Also aligns the Windows Codex native-permissions vendor check with Codex's `readOnly` fallback when Windows sandboxing is disabled.
- **DSH per-session stdio and HTTP MCP mounting over bridge stdin** (#1167). Mounts per-session stdio and streamable HTTP MCP servers (including `serveMcpTools`) in memory over DSH's bridge stdin instead of writing credentials to invocation files, removes `refusedSessionOptions.mcpServerCredentials` on DSH, and declares `mcpTransports: ["stdio", "http"]`.

### Fixes

- **Codex `thread/resume` and `thread/fork` sandbox override precedence** (#1181). Sends the active `sandbox` mode on Codex `thread/resume` and `thread/fork` when OAR overrides permissions (default bypass or `OAR_CODEX_SANDBOX`), preventing Codex's persisted rollout permission profiles (such as `readOnly`) from overriding CLI `-c sandbox_mode=...`, while omitting RPC `sandbox` under `nativePermissions: "inherit"`, `OAR_CODEX_SANDBOX=inherit`, and host `launchArgs` sandbox overrides.
- **Antigravity percent-encoded `session/list` working directory decoding on resume** (#1179, closes #1177). Decodes Antigravity's escaped `file://` URL pathname segments once before the ACP resume directory identity check so non-ASCII, space, punctuation, and literal percent-escaped workspace paths resume accurately while keeping sibling directories distinct, `ResumeCwdError.savedCwd` verbatim, and all other ACP runtimes strictly literal.
- **Grok ACP MCP tool output projection** (#1168). Projects non-empty `OkayOutput` (`completed`) and `Error` (`failed`) strings from Grok ACP's `rawOutput` (`type: "MCP"`) into `tool_call_ended.content` when `update.content` is absent, scoped to Grok via an optional `AcpSessionProfile.projectRawToolOutput` hook while keeping `native` verbatim and leaving other ACP runtimes unchanged.
- **OpenCode skill discovery bounded to releases with an activation barrier** (#1171). Limits OpenCode v2 one-shot skill discovery to `2.2.7` through `2.3.x` and returns `version_unsupported` (without starting a server) from `2.4.0` onward, where upstream catalog reads can return before plugins finish loading.

### Documentation, CI, and Tests

- **Antigravity 1.5.16 ACP baseline, Cursor SDK 1.5.0 skill observer, and daily runtime version checks** (#1169, #1170, #1174, #1175). Advances the Antigravity ACP CI baseline to `1.5.16`, resolves Cursor's test skill observer context factory dynamically for `@cursor/[email protected]+`, and records the 2026-11-23 and 2026-11-24 runtime version checks.

Full diff: v0.130.1...v0.131.0

Co-authored-by: Cindy <[email protected]>
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.

0 participants