Commit Graph
13415 Commits
Author SHA1 Message Date
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
Michael Bolin dd9e291646 permissions: finish profile-backed app surfaces 2026-04-26 13:30:00 -07:00
Michael Bolin 3fcc326dc9 permissions: remove core legacy policy round trips 2026-04-26 13:30:00 -07:00
Michael Bolin 9b79aa71e1 permissions: migrate approval and sandbox consumers to profiles 2026-04-26 13:30:00 -07:00
Michael Bolin 9018a11e50 permissions: derive compatibility policies from profiles 2026-04-26 13:30:00 -07:00
Michael Bolin 4d7ce3447d permissions: make runtime config profile-backed (#19606)
## Why

This supersedes #19391. During stack repair, GitHub marked #19391 as
merged into a temporary stack branch rather than into `main`, so the
runtime-config change needed a fresh PR.

`PermissionProfile` is now the canonical permissions shape after #19231
because it can distinguish `Managed`, `Disabled`, and `External`
enforcement while also carrying filesystem rules that legacy
`SandboxPolicy` cannot represent cleanly. Core config and session state
still needed to accept profile-backed permissions without forcing every
profile through the strict legacy bridge, which rejected valid runtime
profiles such as direct write roots.

The unrelated CI/test hardening that previously rode along with this PR
has been split into #19683 so this PR stays focused on the permissions
model migration.

## What Changed

- Adds `Permissions.permission_profile` and
`SessionConfiguration.permission_profile` as constrained runtime state,
while keeping `sandbox_policy` as a legacy compatibility projection.
- Introduces profile setters that keep `PermissionProfile`, split
filesystem/network policies, and legacy `SandboxPolicy` projections
synchronized.
- Uses a compatibility projection for requirement checks and legacy
consumers instead of rejecting profiles that cannot round-trip through
`SandboxPolicy` exactly.
- Updates config loading, config overrides, session updates, turn
context plumbing, prompt permission text, sandbox tags, and exec request
construction to carry profile-backed runtime permissions.
- Preserves configured deny-read entries and `glob_scan_max_depth` when
command/session profiles are narrowed.
- Adds `PermissionProfile::read_only()` and
`PermissionProfile::workspace_write()` presets that match legacy
defaults.

## 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/19606).
* #19395
* #19394
* #19393
* #19392
* __->__ #19606
2026-04-26 13:29:54 -07:00
efrazer-oaiandShijie Rao fed0a8f4fa feat: load AgentIdentity from JWT login/env (#18904)
## Summary

This PR lets programmatic AgentIdentity users provide one token through
either stdin login or environment auth.

`codex login --with-agent-identity` reads an Agent Identity JWT from
stdin, validates that it has the required claims, and stores that token
as the `agent_identity` value in `auth.json`. The file format is
token-only; the decoded account and key fields are runtime state, not
hand-authored auth.json fields.

The Agent Identity JWT claim shape and decoder live in
`codex-agent-identity`; `codex-login` only owns env/storage precedence
and conversion into `CodexAuth::AgentIdentity`.

When env auth is enabled, `CODEX_AGENT_IDENTITY` can provide the same
JWT without writing auth state to disk. `CODEX_API_KEY` still wins if
both env vars are set.

Reference old stack: https://github.com/openai/codex/pull/17387/changes
Reference JWT/env stack: https://github.com/openai/codex/pull/18176

## Stack

1. https://github.com/openai/codex/pull/18757: full revert
2. https://github.com/openai/codex/pull/18871: isolated Agent Identity
crate
3. https://github.com/openai/codex/pull/18785: explicit AgentIdentity
auth mode and startup task allocation
4. https://github.com/openai/codex/pull/18811: migrate Codex backend
auth callsites through AuthProvider
5. This PR: accept AgentIdentity JWTs through login/env

## Testing

Tests: targeted login and Agent Identity crate tests, CLI checks, scoped
formatter/linter cleanup, and CI.

---------

Co-authored-by: Shijie Rao <shijie.rao@openai.com>
2026-04-26 19:49:54 +00:00
Michael Bolin a69e2539ab Merge 869706f870 into sapling-pr-archive-bolinfest 2026-04-26 12:43:58 -07:00
Michael Bolin 869706f870 permissions: finish profile-backed app surfaces 2026-04-26 12:43:45 -07:00
Michael Bolin 8cf1ae2710 permissions: remove core legacy policy round trips 2026-04-26 12:43:45 -07:00
Michael Bolin dd8aee00ac permissions: migrate approval and sandbox consumers to profiles 2026-04-26 12:43:45 -07:00
Michael Bolin 5d0500420b permissions: derive compatibility policies from profiles 2026-04-26 12:43:45 -07:00
Michael Bolin 04805fb788 permissions: make runtime config profile-backed 2026-04-26 12:43:44 -07:00
Michael Bolin ac2bffa443 test: harden app-server integration tests (#19683)
## Why

Windows Bazel runs in the permissions stack exposed that app-server
integration tests were launching normal plugin startup warmups in every
subprocess. Those warmups can call
`https://chatgpt.com/backend-api/plugins/featured` when a test is not
specifically exercising plugin startup, which adds slow background work,
noisy stderr, and dependence on external network state. The relevant
startup/featured-plugin behavior was introduced across #15042 and
#15264.

A few app-server tests also had long optional waits or unbounded cleanup
paths, making failures expensive to diagnose and contributing to slow
Windows shards. One external-agent config test from #18246 used a
GitHub-style marketplace source, which was enough to exercise the
pending remote-import path but also meant the background completion task
could attempt a real clone.

## What Changed

- Adds explicit `AppServerRuntimeOptions` / `PluginStartupTasks`
plumbing and a hidden debug-only
`--disable-plugin-startup-tasks-for-tests` app-server flag, so
integration tests can suppress startup plugin warmups without adding a
production env-var gate.
- Has the app-server test harness pass that hidden flag by default,
while opting plugin-startup coverage back in for tests that
intentionally exercise startup sync and featured-plugin warmup behavior.
- Lowers normal app-server subprocess logging from `info`/`debug` to
`warn` to avoid multi-megabyte stderr output in Bazel logs.
- Prevents the external-agent config test from attempting a real
marketplace clone by using an invalid non-local source while still
exercising the pending-import completion path.
- Bounds optional filesystem/realtime waits and fake WebSocket
test-server shutdown so failures produce targeted timeouts instead of
hanging a shard.
- Fixes the Unix script-resolution test in `rmcp-client` to exercise
PATH resolution directly and include the actual spawn error in failures.

## Verification

- `cargo check -p codex-app-server`
- `cargo clippy -p codex-app-server --tests -- -D warnings`
- `cargo test -p codex-rmcp-client
program_resolver::tests::test_unix_executes_script_without_extension`
- `cargo test -p codex-app-server --test all
external_agent_config_import_sends_completion_notification_after_pending_plugins_finish
-- --nocapture`
- `cargo test -p codex-app-server --test all
plugin_list_uses_warmed_featured_plugin_ids_cache_on_first_request --
--nocapture`
- Windows Local Bazel passed with this test-hardening bundle before it
was extracted from #19606.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/19683).
* #19395
* #19394
* #19393
* #19392
* #19606
* __->__ #19683
2026-04-26 12:43:16 -07:00
Michael Bolin 750073b9f0 merge commit for archive created by Sapling 2026-04-26 09:04:29 -07:00
Michael Bolin 94b148985a permissions: finish profile-backed app surfaces 2026-04-26 09:04:18 -07:00
Michael Bolin 7fb2474298 permissions: remove core legacy policy round trips 2026-04-26 09:04:18 -07:00
Michael Bolin c06be99973 permissions: migrate approval and sandbox consumers to profiles 2026-04-26 09:04:18 -07:00
Michael Bolin bbf5996946 permissions: derive compatibility policies from profiles 2026-04-26 09:04:18 -07:00
Michael Bolin c966040ae7 permissions: make runtime config profile-backed 2026-04-26 09:04:18 -07:00
Michael Bolin 0b157cc217 test: harden app-server integration tests 2026-04-26 09:04:18 -07:00
Michael Bolin 7ae9c19c31 merge commit for archive created by Sapling 2026-04-26 08:50:14 -07:00
Michael Bolin 34ef6ea7c5 permissions: finish profile-backed app surfaces 2026-04-26 08:49:49 -07:00
Michael Bolin 84bcbc8a98 permissions: remove core legacy policy round trips 2026-04-26 08:49:49 -07:00
Michael Bolin 77258c7ee7 permissions: migrate approval and sandbox consumers to profiles 2026-04-26 08:49:49 -07:00
Michael Bolin 6bc3d4dcf5 permissions: derive compatibility policies from profiles 2026-04-26 08:49:49 -07:00
Michael Bolin 7fdbbbc894 permissions: make runtime config profile-backed 2026-04-26 08:49:49 -07:00
Michael Bolin 4fb4b54b68 test: harden app-server integration tests 2026-04-26 08:49:49 -07:00
Michael Bolin 3bcd06bfb7 Merge 4021347d96 into sapling-pr-archive-bolinfest 2026-04-26 08:03:31 -07:00
Michael Bolin 4021347d96 permissions: finish profile-backed app surfaces 2026-04-26 08:03:05 -07:00
Michael Bolin ace9fcdfa3 permissions: remove core legacy policy round trips 2026-04-26 08:03:05 -07:00
Michael Bolin bfcdfd2d45 permissions: migrate approval and sandbox consumers to profiles 2026-04-26 08:03:05 -07:00
Michael Bolin facb2ee0c0 permissions: derive compatibility policies from profiles 2026-04-26 08:03:05 -07:00
Michael Bolin b5f87a05e5 permissions: make runtime config profile-backed 2026-04-26 08:03:05 -07:00
Michael Bolin 3099353c93 test: harden app-server integration tests 2026-04-26 08:02:55 -07:00
Michael Bolin 0359197207 Merge 46ded5363b into sapling-pr-archive-bolinfest 2026-04-26 07:50:56 -07:00
Michael Bolin 46ded5363b permissions: finish profile-backed app surfaces 2026-04-26 07:50:46 -07:00
Michael Bolin 8d37a2efdc permissions: remove core legacy policy round trips 2026-04-26 07:50:46 -07:00
Michael Bolin dc73f13be1 Merge 8c7965546c into sapling-pr-archive-bolinfest 2026-04-26 07:14:14 -07:00
Michael Bolin f62abbc3b1 permissions: migrate approval and sandbox consumers to profiles 2026-04-26 07:14:00 -07:00
Michael Bolin 8c7965546c permissions: finish profile-backed app surfaces 2026-04-26 07:14:00 -07:00
Michael Bolin 1e298e87b2 permissions: derive compatibility policies from profiles 2026-04-26 07:14:00 -07:00
Michael Bolin a8ffa3fc51 permissions: remove core legacy policy round trips 2026-04-26 07:14:00 -07:00