Commit Graph
13457 Commits
Author SHA1 Message Date
Michael Bolin f045e121c5 Merge 78f9b24805 into sapling-pr-archive-bolinfest 2026-04-26 18:32:55 -07:00
Michael Bolin 78f9b24805 permissions: derive legacy exec policies at boundaries 2026-04-26 18:31:35 -07:00
Michael Bolin 59915e61f0 permissions: constrain requirements as profiles 2026-04-26 18:31:35 -07:00
Michael Bolin e6b716a031 permissions: store only constrained permission profiles 2026-04-26 18:31:35 -07:00
Michael Bolin d9f12bf889 permissions: centralize legacy sandbox projection 2026-04-26 18:30:54 -07:00
Michael Bolin 2b931eb1fe Merge e1f966b3ba into sapling-pr-archive-bolinfest 2026-04-26 17:44:11 -07:00
Michael Bolin 85a247f7ef permissions: finish profile-backed app surfaces 2026-04-26 17:43:45 -07:00
Michael Bolin e1f966b3ba permissions: derive legacy exec policies at boundaries 2026-04-26 17:43:45 -07:00
Michael Bolin 434fcb6fd7 permissions: constrain requirements as profiles 2026-04-26 17:43:45 -07:00
Michael Bolin 4937cc02d1 permissions: store only constrained permission profiles 2026-04-26 17:43:45 -07:00
Michael Bolin 294d2a8fcb permissions: centralize legacy sandbox projection 2026-04-26 17:43:45 -07:00
Michael Bolin 2cb8746457 permissions: remove core legacy policy round trips (#19394)
## Why

Several execution paths still converted profile-backed permissions into
`SandboxPolicy` and then rebuilt runtime permissions from that legacy
shape. Those round trips are unnecessary after the preceding PRs and can
lose split filesystem semantics. Core approval and escalation should
carry the resolved profile directly.

## What Changed

- Removes `sandbox_policy` from `ResolvedPermissionProfile`; the
resolved permission object now carries the canonical `PermissionProfile`
directly.
- Updates exec-policy fallback, shell/unified-exec interception,
escalation reruns, and related tests to pass profiles instead of legacy
policies.
- Removes legacy additional-permission merge helpers that built an
effective `SandboxPolicy` before rebuilding runtime permissions.
- Keeps legacy projections only at compatibility boundaries that still
require `SandboxPolicy`, not in core permission computation.

## Verification

- `cargo test -p codex-core direct_write_roots`
- `cargo test -p codex-core runtime_roots_to_legacy_projection`
- `cargo test -p codex-app-server
requested_permissions_trust_project_uses_permission_profile_intent`







































































---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/19394).
* #19737
* #19736
* #19735
* #19734
* #19395
* __->__ #19394
2026-04-26 17:43:32 -07:00
Michael Bolin 775cd91def merge commit for archive created by Sapling 2026-04-26 17:40:29 -07:00
Michael Bolin 901f2caf60 permissions: derive legacy exec policies at boundaries 2026-04-26 17:39:52 -07:00
Michael Bolin c083bfd24c permissions: constrain requirements as profiles 2026-04-26 17:31:05 -07:00
Andrey Mishchenko 35bc6e3d01 Delete unused ResponseItem::Message.end_turn (#19605)
This field is unused. Delete it.
2026-04-26 17:18:09 -07:00
Michael Bolin 1c457ba152 permissions: store only constrained permission profiles 2026-04-26 17:12:12 -07:00
Michael Bolin b9f505d67d merge commit for archive created by Sapling 2026-04-26 16:48:33 -07:00
Michael Bolin 5d19e0ace4 fix: fall back to git metadata for HEAD commit hash 2026-04-26 16:48:26 -07:00
Michael Bolin e772ad61b6 permissions: centralize legacy sandbox projection 2026-04-26 16:47:37 -07:00
Michael Bolin 68804b16e1 merge commit for archive created by Sapling 2026-04-26 16:37:04 -07:00
Michael Bolin d8019b1c83 fix: fall back to git metadata for HEAD commit hash 2026-04-26 16:36:20 -07:00
Ahmed IbrahimandCodex 0bda8161a2 Split MCP connection modules (#19725)
## Why

The MCP connection manager module had grown to mix orchestration, RMCP
client startup, elicitation handling, Codex Apps cache and naming
behavior, tool qualification and filtering, and runtime data. The
previous stacked PRs split these responsibilities incrementally; this PR
collapses that work into one self-contained refactor on latest main.

## What changed

- Move McpConnectionManager into connection_manager.rs.
- Move RMCP client lifecycle, startup, and uncached tool listing into
rmcp_client.rs.
- Move elicitation request tracking and policy handling into
elicitation.rs.
- Move Codex Apps cache, key, filtering, and naming helpers into
codex_apps.rs.
- Rename the tool-name helper module to tools.rs and move ToolInfo, tool
filtering, schema masking, and qualification there.
- Move runtime and sandbox shared types into runtime.rs.
- Preserve latest main PermissionProfile-based MCP elicitation
auto-approval behavior.

## Verification

- just fmt
- cargo check -p codex-mcp
- cargo check -p codex-mcp --tests
- cargo check -p codex-core

---------

Co-authored-by: Codex <noreply@openai.com>
2026-04-26 23:23:34 +00:00
Michael Bolin 4c58e64f08 test: increase core-all-test shard count to 16 (#19727)
## Summary

Increase `core-all-test`'s Bazel shard count from `8` to `16`.

## Why

[#19609](https://github.com/openai/codex/pull/19609) restored
`bazel.yml` to a 30-minute timeout and increased `app-server-all-test`'s
shard count because the bigger timeout risk was not just a cold Windows
build. The more common problem was a long `rust_test()` shard failing
and getting retried multiple times.

Recent `main` runs show that `//codex-rs/core:core-all-test` still has
the same shape of problem on Windows:

- [Run
24943931330](https://github.com/openai/codex/actions/runs/24943931330)
reported `//codex-rs/core:core-all-test` as flaky after first-attempt
failures in shard `5/8` and shard `8/8`.
- Those retries were driven by
`suite::cli_stream::responses_mode_stream_cli_supports_openai_base_url_config_override`
and
`suite::pending_input::steered_user_input_waits_when_tool_output_triggers_compact_before_next_request`.
- The failed shard attempts in that run took `272.61s` and `259.27s`
before retrying, which is exactly the sort of wall-clock cost that burns
through the 30-minute budget.
- [Run
24966332583](https://github.com/openai/codex/actions/runs/24966332583)
also retried `//codex-rs/tui:tui-unit-tests` after
`app::tests::update_memory_settings_updates_current_thread_memory_mode`
failed once on Windows.
- [Run
24965527138](https://github.com/openai/codex/actions/runs/24965527138)
and its linked [BuildBuddy
invocation](https://app.buildbuddy.io/invocation/ac1a8265-06fa-4da5-9552-4715b7965bce)
show the other half of the problem: when Windows cache reuse is weak,
the `bazel test //...` step can already consume `24m11s` on its own,
leaving very little headroom for flaky retries.

Increasing `core-all-test` to `16` shards does not fix the flaky tests,
but it does reduce the wall-clock cost when a single shard has to be
retried. That matches the mitigation we already applied to
`app-server-all-test` in `#19609`.

## What Changed

- Update `codex-rs/core/BUILD.bazel` so `core-all-test` uses `16` shards
instead of `8`.
- Leave `core-unit-tests` unchanged.

## Follow-up Work

This change is meant to buy back CI headroom while we fix the flaky
tests themselves in subsequent commits. The recent Windows retries that
look worth addressing directly include:

-
`suite::cli_stream::responses_mode_stream_cli_supports_openai_base_url_config_override`
-
`suite::pending_input::steered_user_input_waits_when_tool_output_triggers_compact_before_next_request`
-
`app::tests::update_memory_settings_updates_current_thread_memory_mode`

## Verification

- Compared `core-all-test`'s current sharding against the
`app-server-all-test` precedent in
[#19609](https://github.com/openai/codex/pull/19609).
- Inspected recent `main` Bazel workflow logs and the linked BuildBuddy
invocation to confirm that Windows retries on long shards are still
consuming a meaningful fraction of the 30-minute timeout budget.
- Did not run local tests for this change because it only adjusts Bazel
sharding metadata.
2026-04-26 23:10:26 +00:00
Michael Bolin 3ec32e7175 Merge dded5ad0b4 into sapling-pr-archive-bolinfest 2026-04-26 16:05:47 -07:00
Michael Bolin 9ed2360397 Merge a70f712441 into sapling-pr-archive-bolinfest 2026-04-26 16:01:33 -07:00
Michael Bolin a70f712441 fix: fall back to git metadata for HEAD commit hash 2026-04-26 16:01:18 -07:00
Michael Bolin dded5ad0b4 permissions: finish profile-backed app surfaces 2026-04-26 15:59:14 -07:00
Michael Bolin f74e3ec78e permissions: remove core legacy policy round trips 2026-04-26 15:59:14 -07:00
Michael Bolin 4cee8dca1c Merge 0bd83bcf70 into sapling-pr-archive-bolinfest 2026-04-26 15:59:05 -07:00
Michael Bolin 0bd83bcf70 test: increase core-all-test shard count 2026-04-26 15:58:54 -07:00
pakrym-oai ba159cbc79 Fix codex-core config test type paths (#19726)
Summary:
- Update config tests to reference config requirement types from
codex_config after the loader split.

Tests:
- just fmt
- cargo build -p codex-core --tests
- cargo clippy -p codex-core --tests -- -D warnings
2026-04-26 15:58:17 -07:00
Michael Bolin 31edb8198b Merge 6c9db2a21b into sapling-pr-archive-bolinfest 2026-04-26 15:48:41 -07:00
Michael Bolin 6c9db2a21b fix: update core config tests after loader move 2026-04-26 15:48:34 -07:00
Michael Bolin 3037832d56 Merge cc4b12b515 into sapling-pr-archive-bolinfest 2026-04-26 15:41:53 -07:00
Michael Bolin cc4b12b515 test: increase core-all-test shard count 2026-04-26 15:41:28 -07:00
Michael Bolin e5a631a567 Merge 27b79a2319 into sapling-pr-archive-bolinfest 2026-04-26 15:31:10 -07:00
Michael Bolin 27b79a2319 permissions: finish profile-backed app surfaces 2026-04-26 15:30:58 -07:00
Michael Bolin 6614f96165 permissions: remove core legacy policy round trips 2026-04-26 15:30:58 -07:00
Michael Bolin dda8199b73 permissions: migrate approval and sandbox consumers to profiles (#19393)
## Why

Runtime decisions should not infer permissions from the lossy legacy
sandbox projection once `PermissionProfile` is available. In particular,
`Disabled` and `External` need to remain distinct, and managed profiles
with split filesystem or deny-read rules should not be collapsed before
approval, network, safety, or analytics code makes decisions.

## What Changed

- Changes managed network proxy setup and network approval logic to use
`PermissionProfile` when deciding whether a managed sandbox is active.
- Migrates patch safety, Guardian/user-shell approval paths, Landlock
helper setup, analytics sandbox classification, and selected
turn/session code to profile-backed permissions.
- Validates command-level profile overrides against the constrained
`PermissionProfile` rather than a strict `SandboxPolicy` round trip.
- Preserves configured deny-read restrictions when command profiles are
narrowed.
- Adds coverage for profile-backed trust, network proxy/approval
behavior, patch safety, analytics classification, and command-profile
narrowing.

## Verification

- `cargo test -p codex-core direct_write_roots`
- `cargo test -p codex-core runtime_roots_to_legacy_projection`
- `cargo test -p codex-app-server
requested_permissions_trust_project_uses_permission_profile_intent`




































































---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/19393).
* #19395
* #19394
* __->__ #19393
2026-04-26 15:30:40 -07:00
pakrym-oai 9c3abcd46c [codex] Move config loading into codex-config (#19487)
## Why

Config loading had become split across crates: `codex-config` owned the
config types and merge logic, while `codex-core` still owned the loader
that assembled the layer stack. This change consolidates that
responsibility in `codex-config`, so the crate that defines config
behavior also owns how configs are discovered and loaded.

To make that move possible without reintroducing the old dependency
cycle, the shell-environment policy types and helpers that
`codex-exec-server` needs now live in `codex-protocol` instead of
flowing through `codex-config`.

This also makes the migrated loader tests more deterministic on machines
that already have managed or system Codex config installed by letting
tests override the system config and requirements paths instead of
reading the host's `/etc/codex`.

## What Changed

- moved the config loader implementation from `codex-core` into
`codex-config::loader` and deleted the old `core::config_loader` module
instead of leaving a compatibility shim
- moved shell-environment policy types and helpers into
`codex-protocol`, then updated `codex-exec-server` and other downstream
crates to import them from their new home
- updated downstream callers to use loader/config APIs from
`codex-config`
- added test-only loader overrides for system config and requirements
paths so loader-focused tests do not depend on host-managed config state
- cleaned up now-unused dependency entries and platform-specific cfgs
that were surfaced by post-push CI

## Testing

- `cargo test -p codex-config`
- `cargo test -p codex-core config_loader_tests::`
- `cargo test -p codex-protocol -p codex-exec-server -p
codex-cloud-requirements -p codex-rmcp-client --lib`
- `cargo test --lib -p codex-app-server-client -p codex-exec`
- `cargo test --no-run --lib -p codex-app-server`
- `cargo test -p codex-linux-sandbox --lib`
- `cargo shear`
- `just bazel-lock-check`

## Notes

- I did not chase unrelated full-suite failures outside the migrated
loader surface.
- `cargo test -p codex-core --lib` still hits unrelated proxy-sensitive
failures on this machine, and Windows CI still shows unrelated
long-running/timeouting test noise outside the loader migration itself.
2026-04-26 15:10:53 -07:00
pakrym-oai 2a020f1a0a Lift app-server JSON-RPC error handling to request boundary (#19484)
## Why

App-server request handling had a lot of repeated JSON-RPC error
construction and one-off `send_error`/`return` branches. This made small
handlers noisy and pushed error response details into leaf code that
otherwise only needed to validate input or call the underlying API.

## What Changed

- Added shared JSON-RPC error constructors in
`codex-rs/app-server/src/error_code.rs`.
- Lifted straightforward request result emission into
`codex-rs/app-server/src/message_processor.rs` so response/error
dispatch happens at the request boundary.
- Reused the result helpers across command exec, config, filesystem,
device-key, external-agent config, fs-watch, and outgoing-message paths.
- Removed leaf wrapper handlers where the method body was only
forwarding to a response helper.
- Returned request validation errors upward in the simple cases instead
of sending an error locally and immediately returning.

## Verification

- `cargo test -p codex-app-server --lib command_exec::tests`
- `cargo test -p codex-app-server --lib outgoing_message::tests`
- `cargo test -p codex-app-server --lib in_process::tests`
- `cargo test -p codex-app-server --test all v2::fs`
- `cargo test -p codex-app-server --test all v2::config_rpc`
- `cargo test -p codex-app-server --test all v2::external_agent_config`
- `cargo test -p codex-app-server --test all v2::initialize`
- `just fix -p codex-app-server`
- `git diff --check`

Note: full `cargo test -p codex-app-server` was attempted and stopped in
`message_processor::tracing_tests::turn_start_jsonrpc_span_parents_core_turn_spans`
with a stack overflow after unrelated tests had already passed.
2026-04-26 15:10:35 -07:00
Michael Bolin c62e87a6c4 Merge e2bf33e7d7 into sapling-pr-archive-bolinfest 2026-04-26 15:08:44 -07:00
Michael Bolin e2bf33e7d7 fix: fall back to git metadata for HEAD commit hash 2026-04-26 15:08:35 -07:00
Michael Bolin 20e848db98 Merge d04d4c225f into sapling-pr-archive-bolinfest 2026-04-26 15:07:13 -07:00
Michael Bolin d04d4c225f permissions: finish profile-backed app surfaces 2026-04-26 15:06:53 -07:00
Michael Bolin d39cd698f7 permissions: remove core legacy policy round trips 2026-04-26 15:06:53 -07:00
Michael Bolin f2a2ff715a permissions: migrate approval and sandbox consumers to profiles 2026-04-26 15:06:53 -07:00
Michael Bolin deaa307fb2 permissions: derive compatibility policies from profiles (#19392)
## Why

After #19391, `PermissionProfile` and the split filesystem/network
policies could still be stored in parallel. That creates drift risk: a
profile can preserve deny globs, external enforcement, or split
filesystem entries while a cached projection silently loses those
details. This PR makes the profile the runtime source and derives
compatibility views from it.

## What Changed

- Removes stored filesystem/network sandbox projections from
`Permissions` and `SessionConfiguration`; their accessors now derive
from the canonical `PermissionProfile`.
- Derives legacy `SandboxPolicy` snapshots from profiles only where an
older API still needs that field.
- Updates MCP connection and elicitation state to track
`PermissionProfile` instead of `SandboxPolicy` for auto-approval
decisions.
- Adds semantic filesystem-policy comparison so cwd changes can preserve
richer profiles while still recognizing equivalent legacy projections
independent of entry ordering.
- Updates config/session tests to assert profile-derived projections
instead of parallel stored fields.

## Verification

- `cargo test -p codex-core direct_write_roots`
- `cargo test -p codex-core runtime_roots_to_legacy_projection`
- `cargo test -p codex-app-server
requested_permissions_trust_project_uses_permission_profile_intent`



































































---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/19392).
* #19395
* #19394
* #19393
* __->__ #19392
2026-04-26 15:06:42 -07:00
Michael Bolin 6ea50d5cde Merge dd9e291646 into sapling-pr-archive-bolinfest 2026-04-26 13:30:10 -07:00