Commit Graph

10965 Commits

Author SHA1 Message Date
felixxia-oai
3fd9e7e30e Enable Guardian parent-compaction reuse by default (#46522)
## What changed

Promote `guardian_reuse_parent_compaction` to stable and enable it by default, allowing Guardian to reuse encrypted parent compaction when restarting review sessions.

## Testing

Update Guardian tests to rely on the default setting, including evidence retention after compaction and resume. Adjust cache-key assertions to verify that parent-history changes invalidate cached review sessions by default, while explicitly disabling reuse preserves the previous behavior.

GitOrigin-RevId: 196aff1e91d022490b3782f6c7b5f168907efab9
2026-09-18 23:59:40 +00:00
jif
d6fb836f31 Use macOS member fallback in shared process-group termination helpers (#46521)
## Why

On macOS, process-group signals can be denied even when individual members can be signalled. Core execution cleanup used helpers that did not retry those signals against group members.

## What changed

- Make `terminate_process_group` and `kill_process_group` use the existing member fallback on macOS, and simplify MCP and pipe callers to use the shared helpers.
- Use the saved process-group ID when escalating cancellation after the termination grace period, so this path also uses the fallback.
- Update the unsafe process-group ID test to exercise `terminate_process_group`.

GitOrigin-RevId: 1bab28d3d53cd401b51ffe71d41fbece12aed66d
2026-09-18 23:59:18 +00:00
jif
4b9e7f6473 Use paused time in sampler and model catalog timeout tests (#46519)
## Why

Timeout tests can avoid waiting for real deadlines by advancing Tokio's clock, but automatic advancement can expire requests before they reach the mock server.

## What changed

Pause Tokio time in the stalled-header sampling and model catalog deadline tests. Keep polling until the mock server receives each request, then explicitly advance past the relevant timeout. Add bounded wall-clock waits and fail if a request completes before reaching the server.

Preserve assertions for sampling retry exhaustion, connection permit recovery, and the catalog's `RequestTimeout` error.

GitOrigin-RevId: 252be25d75d73c713a4b8ccac1ff20ad820df556
2026-09-18 23:58:56 +00:00
jif
cdfda82386 Handle delayed process startup in the Guardian network approval test (#46518)
## Why

Process startup can outlast the first `exec_command` yield, causing the network approval test's fixed response sequence to route a Guardian response to the parent request.

## What changed

Match mock responses by request role and call ID, and poll running sessions with `write_stdin` until final output is available. Check the allow and deny outcomes against that final output while preserving the action-routing assertions.

GitOrigin-RevId: 2ea31d1bfd5a46adc6561580783e916dfab15996
2026-09-18 23:49:09 +00:00
jif
e811c2832a Stabilize the TUI exit interruption test (#46517)
## Why

The test launches a real shell, but its fixture uses a working directory that does not exist on clean runners. Waiting only for a turn-start notification also does not establish that the shell is running before interruption.

## What changed

- Give `exit_interrupts_before_requesting_shutdown` a temporary working directory.
- Replace the fixed 30-second sleep with a loop that stays alive while a temporary directory exists, with cleanup allowing the command to finish if the test fails early.
- Wait for both the turn ID and `exit-test-ready` output within a single 10-second timeout, and fail immediately if the turn completes before interruption.

GitOrigin-RevId: d8f92b941b3fe8a077f447c6bf705a2ef922db03
2026-09-18 23:48:49 +00:00
jif
d374a93b41 Handle completion timing in the multi-agent resume test (#46516)
## Why

A grandchild's completion can arrive while the worker is completing its response, triggering an extra sampling request to drain the message. The cold root resume test previously allowed only one worker completion request.

## What changed

Match worker completion requests by the nested spawn's `function_call_output` and allow one or two requests. Scope the mock to the initial worker's lifetime and drop it before the follow-up phase.

GitOrigin-RevId: 10e0a429e6e1f51b5f04a86e3351c5fa4df9cb66
2026-09-18 23:47:19 +00:00
jif
8933a816eb Replay guardian checkpoints into a fresh session in tests (#46514)
## Why

Replaying a checkpoint into the original session can let preserved live state
mask missing checkpoint data.

## What changed

Update `guardian_checkpoint_preserves_live_context_without_storage` to restore
forked history into a fresh session with the matching guardian context mode.
Keep the existing context restoration assertions for both `Legacy` and
`ThreadOwned` modes.

GitOrigin-RevId: 211b567f6b33ffca6dc51110a208aec234004b98
2026-09-18 23:39:52 +00:00
jif
7fb599de8c Rename AgentControl to LocalAgentControl (#46513)
GitOrigin-RevId: a8e8a5c818a1751c5d2667f5af87e481482fc7db
2026-09-18 23:39:30 +00:00
jif
0f7c8608bd Capture Guardian review checkpoints from live context (#46512)
## Why

Committing a Guardian review snapshot currently flushes and reloads the transcript from storage, even though the completed model context is already available in memory.

## What changed

- Build forkable checkpoints directly from live session state, preserving model history, retained Guardian context, world state, turn context, and token usage.
- Preserve compaction window metadata and MCP resource origins in the checkpoint.
- Recognize prior user turns inside compacted replacement history.

## Testing

Add round-trip checkpoint tests for legacy and thread-owned Guardian context without storage, including preservation after live history is mutated. Extend the review compaction test to assert that checkpoints do not load history from storage.

GitOrigin-RevId: cb2638ca93bba6ab4472de50c7e2913e1a2f25a8
2026-09-18 23:37:35 +00:00
Charlie Marsh
05a93a8a1d Avoid cloning excluded turn items during thread resume (#46511)
## Why

Resuming a running thread with a summary initial page cloned every active-turn item before discarding those outside the summary, including potentially large reasoning payloads.

## What changed

- Snapshot the active turn using the requested `TurnItemsView`, copying only the first user message and final agent message for summaries and no items for `NotLoaded`.
- Preserve full snapshots when the resume response includes full turns, even if its initial page requests a summary.
- Share item selection between snapshots and page responses, and skip selection when a turn already has the requested view.

## Testing

Add unit coverage for summary selection, completed-turn metadata, and metadata-only snapshots. Extend running-thread resume coverage for default summaries, explicit full pages, and full turns returned alongside a summary page.

GitOrigin-RevId: 6ddcd93c44dbc8083827ac82f442b31730a4edde
2026-09-18 23:37:11 +00:00
Charlie Marsh
dfb265764d Avoid cloning active turn items for metadata-only thread resumes (#46510)
## Why

Resuming a running thread cloned the active turn's items even when the response did not need them.

## What changed

Add a metadata-only turn snapshot and use it for resume status checks and initial pages with `TurnItemsView::NotLoaded`. Only snapshot items when including turns or requesting an initial page with items, preserving item data for `Summary` and `Full` views.

## Testing

Add lifecycle coverage for metadata snapshots and extend running-thread resume tests to check metadata-only responses and populated `Summary` and `Full` pages.

GitOrigin-RevId: 281a2b7e1faf3a3fc07e007a065b16235eda08b6
2026-09-18 23:33:08 +00:00
jif
36430b3688 Flush completed Guardian reviews before delivering decisions (#46509)
## Why

The parent could receive a Guardian decision before the review's terminal event was flushed, allowing the reviewed action to start while completion was still being saved.

## What changed

Flush the review transcript and `TurnComplete` event together before delivering completion to the parent. Clear the reviewer's active turn before delivery so the parent can immediately request another review. Skip redundant completion flushes for Guardian reviewers while retaining the existing pre-completion flush on errors and cancellation.

## Testing

Add a gated thread-store regression test covering two consecutive reviews in the same reviewer thread. Verify that each save includes `TurnComplete` and that the approved command cannot start while the save is blocked.

GitOrigin-RevId: 9274b08ddba1ea93d4fb4709bbfdc2ccaea866ab
2026-09-18 23:28:13 +00:00
jif
2b84296288 Refresh the model catalog before turns after auth changes (#46508)
## Why

Credential changes can leave the in-memory model catalog associated with a different identity, causing subsequent turns to use bundled model metadata instead of the active credentials' catalog.

## What changed

- Refresh mismatched catalogs before user turns and mailbox-triggered wakeups, resolving lazy command credentials before comparing identities.
- Reuse a matching cache or fetch models with a five-second deadline covering auth resolution and cache access. Preserve fallback behavior on failure or timeout; static catalogs need no refresh.
- Recheck the active turn after discovery so an interrupted wakeup does not continue starting a turn.

## Testing

Add coverage for user and mailbox turns after credential rotation, including switching back after another identity replaces the shared catalog. Verify refreshed context windows and request behavior, fallback on discovery failure or auth timeout, and command-auth token rotation.

GitOrigin-RevId: 7e4ad25f1c4476e2023225731924af28c1181767
2026-09-18 23:26:12 +00:00
jif
8003609cc7 Run Windows sandbox tests exclusively when local (#46507)
## Why

Sandbox setup rotates machine-wide account passwords. The process-local test lock cannot prevent concurrent `exec-server` elevated filesystem tests from changing those passwords between setup and logon.

## What changed

- Add the Bazel `exclusive-if-local` test tag to `windows-sandbox-rs` to prevent this overlap during local test execution.
- Include the full error chain and sandbox log when the elevated non-TTY command test fails to spawn a session.

GitOrigin-RevId: bba87fc606ea60a35cf0451ed0ef68ef2eb14d3a
2026-09-18 23:25:49 +00:00
jif
12acac2a66 Share ChatGPT cookies between HTTP and WebSocket transports (#46506)
## Why

WebSocket handshakes did not reuse the HTTP cookie store or retain response cookies, so routing cookies such as `__oailb` were unavailable to subsequent connections.

## What changed

- Reuse the HTTP factory's ChatGPT cookies for secure WebSocket handshakes, preserving explicit `Cookie` headers and marking generated headers sensitive.
- Retain allowlisted infrastructure cookies from both successful and rejected upgrades. Keep configured cookies scoped to their factory and exclude account and session cookies from the shared store.
- Apply HTTPS cookie scope to `wss` requests, preserving host and path restrictions and excluding insecure `ws` requests and non-ChatGPT hosts.

## Testing

Add HTTP/WebSocket cookie-sharing coverage and local TLS handshake tests for routing-cookie reuse across connectors, rejected-upgrade refreshes, explicit header precedence, cookie scope, session-cookie exclusion, and deletion.

GitOrigin-RevId: 6bd6afe16e97cf9758ca7ba207a4e88c969497a4
2026-09-18 23:17:17 +00:00
rhan-oai
cc7591646e Support catalog parameter schemas for Multi-Agent V2 tools (#46505)
## What changed

Add optional JSON-encoded `parameters` to catalog tool messages and apply them to all six Multi-Agent V2 tools, including plain, namespaced, and code-mode exposure. Schema selection follows the active model, including mid-turn model changes.

Require an object schema supported by the existing `JsonSchema` subset and preserve bundled encryption annotations. Fall back to bundled parameters when overrides are missing, invalid, unsupported, or omit encrypted properties. Tool execution and argument handling remain unchanged.

## Testing

Extend integration coverage for schema overrides, fallback behavior, encryption annotations, exposure modes, and mid-turn model changes. Add a snapshot scenario exercising `list_agents` with a catalog parameter schema.

GitOrigin-RevId: 978be6d5f7e6a6865969922be5483bc697b20aca
2026-09-18 23:16:56 +00:00
Eric Traut
907b751eab Add six bundled TUI themes and theme-aware accents (#46504)
## What changed

- Bundle `ada`, `babbage`, `curie`, `cushman`, `dali`, and `davinci` themes for configuration and the theme picker, preserving precedence and invalid-file warnings for custom themes with the same names.
- Use `codex.accent` for active and selected controls on truecolor and 256-color terminals, retaining existing fallbacks at lower color depths.
- Honor terminal-default diff backgrounds and clear matching gutter fills, allowing `dali` and `davinci` to show diffs without background fills.
- Restrict Windows native palette fallback to `ConsoleWindowClass` so a ConPTY palette is not mistaken for the renderer's colors when OSC probing fails.

## Testing

Add tests and snapshots for theme preview, selection, cancellation, custom-theme precedence, invalid-file warnings, accent color depth, and disabling individual diff fills.

GitOrigin-RevId: 72f3ef08f82626436dd2d80d40210cc77e1a5616
2026-09-18 23:16:04 +00:00
Eric Traut
547c9a1aad Use catalog model display names throughout the TUI (#46503)
## Why

Model pickers and session details show raw model IDs even when the catalog provides a display name.

## What changed

- Use catalog display names in model and reasoning pickers, session headers, status displays, and terminal titles, retaining fallback labels for models absent from the catalog.
- Keep model IDs for selection and persistence, and preserve picker highlights by ID when display names change or are shared by multiple models.
- Remove the legacy-model instruction from the full model picker.

## Testing

Add regression tests and snapshots for custom display names, startup and resumed session headers, fallback labels, terminal titles, and picker refreshes. Verify that selecting a display name still persists the original model ID.

GitOrigin-RevId: 101fe82b20f7a8a90ceeff7999bd07ad42ca46db
2026-09-18 23:15:39 +00:00
pakrym-oai
f5b941c910 Add configuration and feature diagnostics to report metadata (#46501)
## What changed

- Record an explicit allowlist of scalar configuration values and individual boolean feature tags for each sampling request, replacing the combined enabled-feature list.
- Distinguish configured context-window overrides from the effective model limit, and emit `unset` for absent values so earlier overrides do not linger.
- Expand `tags_json` into report metadata and raise the tag limit from 64 to 512, while allowing existing values to update at capacity.

## Testing

Add tests for configured and effective context windows, clearing overrides, feature toggles, dynamic tag upload serialization, and updates at the tag limit.

GitOrigin-RevId: 57608fac936d8ce315e36d452a2950e46370b39b
2026-09-18 23:07:36 +00:00
Jeremy Rose
04e4d2b40f Block mutating fcntls in restricted macOS Seatbelt policies (#46500)
## Why

`F_MAKECOMPRESSED` and `F_TRANSFEREXTENTS` can mutate files through read-only descriptors, bypassing `file-write*` and `file-ioctl` restrictions. Even a deny-default Seatbelt policy needs an explicit denial for these operations.

## What changed

Deny `system-fcntl` commands `80` and `110` whenever the filesystem sandbox policy lacks full disk write access.

## Testing

Add macOS regression tests that run Seatbelt children under read-only and workspace-write policies, assert both operations fail with `EPERM`, and verify file contents and metadata remain unchanged. An unrestricted positive control verifies the mutations, allowing for unsupported extent transfers.

GitOrigin-RevId: 7a7a5ef30f9ff658a86071b51f1f7b4952d5cdad
2026-09-18 23:07:12 +00:00
sayan-oai
e0f05de6e0 Allow approved escalation with environment-owned network policies (#46499)
## Why

Environment-owned network policies rejected explicit sandbox escalation before command approval, and retained terminals that bypassed or no longer matched those policies required a new terminal.

## What changed

- Allow `require_escalated` commands through the normal approval flow and bypass managed network proxies when full escalation is permitted.
- Preserve denied-read restrictions, including the sandbox and network proxy needed to enforce them.
- Track the network restrictions bypassed at launch and require escalation review for terminal input when launch permissions or network settings warrant it, instead of rejecting input outright.

## Testing

Extend network approval coverage for approved and denied escalation, unproxied remote execution, and preserved denied-read restrictions. Add retained-terminal coverage verifying command and `write_stdin` approvals with restricted and unrestricted filesystems, and update the unit test for changed environment network policies to expect escalation review.

GitOrigin-RevId: 50524b1bc4e3df58447c3c92fb9e50e69ed50cf8
2026-09-18 23:06:48 +00:00
Eric Traut
e497393552 Allow worktree sessions to use an existing local daemon (#46498)
## Why

`--worktree` and command-line worktree feature overrides previously excluded sessions from using the local daemon, even though worktree allocation is client-owned and thread requests already forward the feature.

## What changed

- Allow `--worktree` and boolean `features.worktrees` overrides to remain eligible for daemon connections, while preserving exclusions for other configuration overrides and `--no-daemon`.
- Skip daemon auto-start for `--worktree` launches.

## Testing

Add daemon eligibility tests for worktree options and overrides. Run the existing worktree startup and fork test scenarios against both embedded and daemon backends, checking ownership before the first turn and confirming daemon connections through `/status`.

GitOrigin-RevId: b3f4782e83d8e20974fb4a831442cae013d58e56
2026-09-18 23:05:31 +00:00
riley-oai
c0e1b78253 Preserve the provisioned macOS CLI's code-signing identity (#46495)
## Why

Existing login-keychain access rules identify the CLI as `codex`. Packaging it in an app bundle must preserve that code-signing identifier independently of the bundle identifier and provisioned App ID.

## What changed

- Sign the provisioned CLI with the identifier `codex`, retaining `com.openai.codex.cli` as its bundle identifier.
- Require the expected signing identifier and team during signature verification, and reject unexpected bundle identifiers, executable names, or package types.
- Document the identity distinction and keychain compatibility limits.

## Testing

Extend signing-driver tests to check the signing identifier, verification requirement, bundle metadata, and provisioned entitlements, and to reject altered bundle identity fields. These tests use generated credentials and stubbed native tools; they do not verify runtime keychain access or credential recovery.

GitOrigin-RevId: ab00072e48189551adb0e70008210fee6d36241d
2026-09-18 22:53:21 +00:00
Eric Traut
6d29cc6bac Keep remote workspace roots under server control (#46494)
## Why

Workspace paths from the client configuration belong to the client host. Sending them to a remote app server can override the server's workspace roots.

## What changed

- Omit client-configured `runtimeWorkspaceRoots` from remote start, resume, and fork requests so the server resolves defaults or restores saved roots.
- Preserve server-provided roots when forking an active session or side conversation, including after reloading client configuration.
- Reject `--add-dir` and `sandbox_workspace_write.writable_roots` command-line overrides with `--remote` before connecting, directing users to configure additional roots on the server.

## Testing

Add regression coverage for remote workspace roots across start, turn, resume, and fork operations; active-session forks after configuration reloads; and embedded requests retaining explicit roots. CLI tests cover rejected root overrides and continued acceptance of network-access overrides.

GitOrigin-RevId: b87ea6037d197db68e25a1a8610d693f6aa13caf
2026-09-18 22:53:00 +00:00
Eric Traut
35b746a3e3 Allow /review during MCP startup (#46493)
## Why

MCP startup alone should not prevent opening the review picker or submitting inline review instructions.

## What changed

- Defer `/review` availability checks and draft clearing to dispatch, where thread state is available.
- Reject live review commands while foreground work is running, pending, or queued, preserving the draft and attachments.
- Distinguish live and queued dispatch so a queued review does not clear a newer composer draft.

## Testing

Add regression tests for the review picker and inline instructions during MCP startup, draft and attachment preservation when review is blocked, and newer draft preservation when a queued review opens.

GitOrigin-RevId: 48962bfc26127ffa8dd157f15be512b78bf9b39b
2026-09-18 22:52:38 +00:00
Eric Traut
4f3867123f Unify TUI tool output previews with a three-row limit (#46492)
## What changed

- Use a shared preview renderer for agent command output and MCP results, showing the first three wrapped rows with a hidden-line count and `ctrl + t` transcript hint.
- Apply one preview budget across all MCP result blocks. Count partially displayed logical lines as hidden and hard-wrap long URLs to fit the available width.
- Preserve complete MCP result text in transcript and raw output, including trailing failure diagnostics.
- Bound preview input before wrapping to limit work on very long lines and combining characters.

## Testing

Add unit tests and snapshots for wrapped output, hidden-line counts, blank lines, combining characters, shared MCP block limits, transcript preservation, and matching streamed and completed command previews.

GitOrigin-RevId: bd3c2ec40ee837dc8a7a171aaf91577a0ac50985
2026-09-18 22:51:10 +00:00
alexsong-oai
4d23af0975 Compose gateway OAuth with primary provider authentication (#46490)
## Why

Providers configured with `gateway_oauth` need gateway credentials alongside primary authentication for inference and model discovery.

## What changed

- Attach gateway tokens through the configured header or cookie while preserving primary authentication, including WebSocket handshake headers.
- Share gateway credential managers across matching provider instances and model discovery so they observe refreshed tokens.
- Reject authentication on gateway setup or token failures, invalid token values, and conflicting auth headers. Mark gateway headers sensitive and avoid exposing issuer error details.
- Include gateway OAuth configuration in model catalog cache identity to prevent reuse across different gateway configurations.

## Testing

Add provider and core integration tests covering combined credentials, header and cookie delivery, token refresh, shared credential state, cache isolation, and request blocking on gateway token or HTTP client initialization failures.

GitOrigin-RevId: cb74125cf7e87660967d49edacf14646cf0b99c4
2026-09-18 22:42:46 +00:00
rhan-oai
2f522c5dc0 Split analytics tests into focused suites (#46488)
## What changed

Replace `analytics_client_tests.rs` with event-specific suites under
`codex-rs/analytics/src/tests/suite/` and shared fixtures in `tests/support.rs`.
Group turn tests by events, requests, compaction, and accepted lines, and keep
cross-event arrival-order coverage in a dedicated reducer ordering suite.

Separate app and plugin ingestion assertions into their respective suites while
retaining a combined test for arrival order. Document where to place tests based
on the contract they cover.

GitOrigin-RevId: aba497f103ad6e23eca6266fc93d150d16f5913c
2026-09-18 22:41:26 +00:00
Eric Traut
71406edbd5 Keep TUI exploration grouped across reasoning and nonzero exits (#46487)
## Why

Reasoning summaries and nonzero command exits split adjacent exploration into separate groups, while compact history omitted exit codes. Replayed commands also failed to retain the same grouping as live commands.

## What changed

- Keep adjacent read, list, and search commands grouped across reasoning summaries and nonzero exits in both live and replayed history.
- Preserve reasoning in chronological order in the expanded transcript while omitting it from compact and raw history.
- Show nonzero exit codes in compact exploration entries and keep unsuccessful reads separate from successful read summaries. Render search exit code `1` without red failure styling, and label compound-command outcomes as `command exit`.

## Testing

Add regression coverage for live/replay rendering parity, reasoning order, grouping boundaries, and nonzero exit labels and colors. Update the overlapping-command test to verify that exploration stays grouped after a failure.

GitOrigin-RevId: 19c6ffec44c62c185fc6f79282c38e66468f7b80
2026-09-18 22:41:01 +00:00
Eric Traut
dbf478850f Make TUI async question replies compatible with desktop (#46486)
## Why

Async questions answered on another client should disappear from the TUI without losing drafts for other questions, even when questions have identical titles.

## What changed

- Send answers using the desktop reply envelope with stable per-question IDs, and resolve matching questions from committed messages and replayed history.
- Render replies as readable question-and-answer text in transcripts, queue previews, and input history.
- Preserve separate reply envelopes and message order when retrying rejected or interrupted input.
- Account for JSON escaping in input limits and fall back to plain text for oversized question IDs.

## Testing

Add regression coverage for cross-client dismissal, draft preservation, replay ordering, reply parsing, IDE context, distinct replies with identical text, and retry ordering. Update the async question scenario to use the reply envelope.

GitOrigin-RevId: 9b9e4b1e140508590401622d96cfc16fc192eb7c
2026-09-18 22:40:37 +00:00
Eric Traut
3d5b66c655 Handle unknown error classifications and configure gateway OAuth (#46482)
Preserve known error classifications, including BioPolicy, while falling back to Other for unknown values so saved sessions can still be read.

Add optional gateway OAuth settings to model provider configuration.

Co-authored-by: Owen Lin <owen@openai.com>
Co-authored-by: alexsong-oai <alexsong@openai.com>
GitOrigin-RevId: 64bcf45ca042efca7645c798db3746375426b0fe
2026-09-18 22:29:16 +00:00
sayan-oai
7498521d28 Keep MCP policy evaluation consistent with turn environments (#46335)
## Why

Environment settings saved for the next turn must not change MCP tool availability during the active turn.

## What changed

- Use one captured environment snapshot for MCP policy evaluation and runtime publication, including selections that are still starting or have failed.
- Compare both captured selections and ready environment handles when deciding whether to refresh the runtime, and rebuild the startup configuration when resolved selections change.
- Preserve the configuration origin of failed selections so MCP authority evaluation retains whether configuration comes from the thread.
- Box the MCP refresh future to keep it off the sampling request's stack.

## Testing

Add a regression test that updates the environment MCP policy while a turn waits for user input, verifies the tool remains visible when that turn resumes, and verifies it disappears on the next turn. Extend snapshot tests to cover starting and failed selections.

GitOrigin-RevId: cc2744b5137be69f000d70b0c7009b14079f39ae
2026-09-18 00:59:10 +00:00
Sean Huang
3724dc8361 Share platform identity across path, network, and sandbox configuration (#46334)
## What changed

- Add `Platform` to `codex-utils-path-uri` with metadata parsing, native platform detection, and path convention mapping. Preserve missing or unrecognized metadata as `Unknown`.
- Replace `NetworkProxyExecutorOs` with the shared type and keep executor-specific socket path validation in the network proxy.
- Extract `effective_sandbox_mode` with explicit platform and Windows sandbox level inputs, preserving the native Windows fallback from `workspace-write` to `read-only` when the sandbox is disabled.

## Testing

Add unit tests for platform metadata, path conventions, native platform detection, and sandbox mode selection across platforms and Windows sandbox levels.

GitOrigin-RevId: 4fe0972e3a91040e35f2a6dfa5bcdf6c9a29be88
2026-09-18 00:51:34 +00:00
chess
fd875b188b Handle disabled Windows sandbox accounts during cleanup (#46333)
## Why

Cleanup needs fresh logon tokens for sandbox accounts that may already be disabled. Temporarily enabling those accounts must leave a durable obligation to disable them again if the service exits unexpectedly.

## What changed

- Persist `cleanup_logon_pending` before enabling an account, then disable it again after the logon attempt before clearing the marker.
- Recover pending account disables before owner restoration or IPC admission, validating account SIDs before restoration. Block runtime readiness and provisioning while recovery is pending, and defer retirement until cleanup logons are prepared.
- Include the blocking logon details in cleanup timeout errors and suppress repeated identical cleanup errors in the Windows event log.

## Testing

Add receipt tests covering backward-compatible defaults and pending cleanup state surviving serialization, blocking readiness and owner admission until cleared.

GitOrigin-RevId: 801bec408a27ac85ccdc3eb5ca2bdb2ccb3d5827
2026-09-18 00:36:07 +00:00
Eric Traut
3cd255a4ee Dim conversation recaps in the TUI (#46332)
## What changed

Apply dim styling to all rendered recap lines and remove the cyan color from
`Next:`, preserving italics and bold labels.

## Testing

Update recap style assertions and add a rendered-buffer snapshot covering dimmed
text, label styling, line breaks, and next-action wrapping.

GitOrigin-RevId: 2dfef4753fa5da4e1fae32b5cdb03a881482f91b
2026-09-18 00:35:45 +00:00
Sean Huang
ad70cbdd96 Defer environment network policy validation until after composition (#46331)
## Why

Feature settings and managed requirements can replace domain and socket values. Validating the selected configuration first rejects invalid entries even when they would be replaced before use.

## What changed

Keep listener removal and unsupported controller-field rejection in `project_environment_profile_network`, but defer domain and socket validation to `validate_environment_network_policy` for the composed policy. Remove the executor OS argument from the preparation step.

## Testing

Update tests to verify that invalid domain patterns and socket paths survive preparation, fail final validation when retained, and pass when managed requirements replace them.

GitOrigin-RevId: 866c633c14ff0b4664e8bf5cf79fef51db5d7ed6
2026-09-18 00:27:00 +00:00
Michael Bolin
ff73d63e64 Move retry backoff into codex-async-utils (#46330)
Move the exponential backoff helper into `codex-async-utils` so
`codex-cloud-config` can use it without a runtime dependency on `codex-core`.
Keep `codex-core` as a development dependency for cloud-config tests.

Preserve the existing retry delays and jitter, and re-export `backoff` from
`codex_core::util` for existing callers.

GitOrigin-RevId: 338f3194e166e77003da532310ff5be78a0eac9e
2026-09-18 00:25:37 +00:00
viyatb-oai
608e4cc9a1 Avoid persisting project trust for projectless directories (#46328)
## Why

Starting a thread in a directory without a project could persist trust and
preapprove project configuration added later.

## What changed

Track whether configuration discovery found no project-root marker, Git checkout,
or project-local `.codex` directory. Skip implicit project trust in `thread/start`
for these directories. Preserve existing trust decisions and permission checks.

## Testing

Add regression coverage for starting a thread with full access, then adding
project configuration and verifying that a read-only thread does not load it or
persist trust. Add loader tests for projectless classification, project markers,
saved trust, managed configuration, and skipped discovery.

GitOrigin-RevId: da490c649d272494f65d4e22da1ebf89f9085477
2026-09-18 00:16:50 +00:00
Ahmed Ibrahim
5492c2b06e Broaden compaction fallback to the current model (#46324)
## Why

After a model switch, compaction with the previous model could fail after exhausting stream retries without falling back to the selected model.

## What changed

Allow compaction to fall back to the current model for all errors except `TurnAborted`, `Interrupted`, and `SessionBudgetExceeded`.

## Testing

Add a regression test that exhausts the previous model's compaction stream retries, then verifies that fallback compaction and turn sampling use the selected model.

GitOrigin-RevId: 9c9b7ccbb206d19f1ae750a32636fc9acaacfb2b
2026-09-17 23:54:31 +00:00
marksteinbrick-oai
a1efb59c4a Record active plugin inventory in turn analytics (#46323)
## What changed

Add `active_plugin_ids_at_turn_start` to turn analytics, combining active host plugins with selected plugin packages. Prefer remote plugin IDs when present and otherwise use validated package IDs. Sort and deduplicate the inventory.

Report `null` for unknown inventories, invalid IDs, IDs longer than 128 bytes, or inventories exceeding 512 distinct IDs; preserve `[]` for an observed empty inventory. Keep the first received inventory even when later resolved configuration updates arrive.

## Testing

Add coverage for ID selection and validation, deduplication, size limits, serialization, and preservation of the first inventory. Extend app-server tests to check inventories after plugin reconciliation and with selected plugins, including turns without explicit plugin mentions.

GitOrigin-RevId: 8a0de912e2570a902cd05bfc918dc8e6ff8b8527
2026-09-17 23:47:06 +00:00
sayan-oai
1f631def3f Set the Windows sandbox type in the pending environment test (#46322)
GitOrigin-RevId: 2154f485ddce735dcd76bdbce0b48d2053dfc45d
2026-09-17 23:42:07 +00:00
Eric Traut
f8c6026c38 Preserve web search actions and results in exec JSON output (#46319)
## Why

Web search events in `codex exec --json` dropped structured results and relied on a serialization round trip to convert action types.

## What changed

Map web search actions explicitly, preserving `open_page` URLs and `find_in_page` URLs and patterns. Forward structured results through an optional `results` field, omitting it when unavailable while preserving empty arrays and error payloads.

## Testing

Add regression coverage for page actions with absent, empty, successful, and error results in serialized `item.completed` events.

GitOrigin-RevId: 9a7f4c9c2eb163ba62f5e1642437a9debffc3816
2026-09-17 23:35:56 +00:00
alexsong-oai
a129392ebb Add OAuth credential management for model provider gateways (#46318)
## What changed

- Export `GatewayAuthConfig` and `GatewayAuthManager` with PKCE browser sign-in, loopback callbacks, cached token resolution, and refresh after expiry or rejection.
- Store gateway credentials in a dedicated encrypted namespace with an independent keyring key. Serialize token exchanges and persistence across processes, preserve refresh rotations after caller cancellation, and retain pending credentials when saving fails.
- Validate OAuth endpoints and token responses, disable token-request redirects and logging, and redact sensitive error details.

## Testing

Add tests covering browser authorization, callback state validation and cleanup, concurrent refreshes, cancellation, failed-save recovery, storage isolation, endpoint validation, and credential redaction.

GitOrigin-RevId: e0c17f1eab7acca378a14b2d00b80940d8542e47
2026-09-17 23:35:32 +00:00
sayan-oai
c775dd3c33 Defer environment selection changes until the next turn (#46310)
## Why

Updating environment selections while a turn is running must not redirect its tools or prevent its pending environment setup from completing.

## What changed

- Store future environment selections separately from active environments, and activate them when preparing new work with no task running.
- Keep turn contexts and MCP workspace roots tied to the active environment snapshot. Report saved selections through thread settings and `environment_selections()`.
- Route environment configuration and failure callbacks to matching active or future selections so each can finish setup independently.
- Stop the running task before manual compaction adopts the saved environments.

## Testing

Add regression tests that preserve a running task's working directory and workspace roots, then adopt the saved selection for the next task. Add remote environment coverage showing that future setup can complete while the active turn waits, with each turn receiving its own capability roots.

GitOrigin-RevId: 09a6b90131d2ab2441ce2fe9b0368a3668889f31
2026-09-17 21:47:23 +00:00
vkg-oai
0c9be8a836 Preserve plugin caches across display metadata refreshes (#46309)
## Why

Renewed image URLs and other display metadata changes unnecessarily invalidate loaded plugins and MCP and skill caches, even when installed plugin behavior is unchanged.

## What changed

- Compare installed plugin metadata by identity, version, enablement, policy, and availability before invalidating derived caches. Continue storing the full updated payload so display consumers receive fresh metadata.
- Preserve invalidation when behavioral metadata changes or reconciliation requires an effective plugin refresh.
- Export `remote_catalog_metadata_eq` to compare catalogs independently of display metadata and plugin display order, while retaining marketplace order significance.

## Testing

Add regression tests for display-only updates, behavioral changes, catalog ordering, and preservation of loaded skills and tool suggestions. Add an app-server integration test verifying that image URL renewals and badge updates preserve live MCP sessions and cached skill resources, while an authentication policy change invalidates resource caches.

GitOrigin-RevId: 22b9ba1234a9f850201c6890e03d1ef899a56c54
2026-09-17 21:35:44 +00:00
Rennie
fa8cf44985 Preserve bio policy errors as a distinct non-retryable error (#46306)
## Why

Streaming `bio_policy` failures were classified as generic invalid requests, losing their policy-specific classification.

## What changed

- Add `BioPolicy` errors across the API and core protocol, recognizing streaming failures and HTTP 400 responses, including wrapped WebSocket errors.
- Preserve server messages and use a biological-risk fallback when the message is missing or blank.
- Treat bio policy errors as non-retryable in core and guardian handling, and classify them in diagnostics and telemetry.
- Map `BioPolicy` to `other` in the app-server v2 protocol.

## Testing

Add coverage for error classification, message preservation and fallbacks, HTTP and wrapped WebSocket responses, guardian retry decisions, and app-server conversion. Extend the core integration test to verify that bio policy failures emit a typed error and complete the turn after a single request.

GitOrigin-RevId: 78c2647e8fc8f80297cb8a23fff06ab141099632
2026-09-17 21:25:55 +00:00
Charlie Marsh
55db7e8c88 Avoid cloning turn items for app-server active turn lookups (#46305)
## Why

App-server callers that only need the active turn ID or its presence currently create a full turn snapshot, unnecessarily cloning its items.

## What changed

Expose `ThreadState::active_turn_id()` and use it for interrupt validation, elicitation turn ID fallback, and teardown and shutdown logging, preserving the existing turn selection behavior.

## Testing

Update the interrupt integration test to wait for `turn/started` instead of a fixed delay and verify that an incorrect turn ID is rejected before successfully interrupting the active turn.

GitOrigin-RevId: 4a030655fbc4d229809cf13f80c3d7f788f19c13
2026-09-17 21:25:34 +00:00
Ian MacLeod
7a3c5a83e4 Serialize release asset uploads to avoid secondary rate limits (#46303)
Upgrade `softprops/action-gh-release` from `v2.6.1` to `v3.0.3` and enable
`preserve_order` in the Rust release workflow to upload assets serially,
following GitHub's recommendation to avoid concurrent REST API requests.

GitOrigin-RevId: d1fbbbb01e191967be303040cfa2949146a2292d
2026-09-17 21:15:36 +00:00
Sean Huang
ea218f5cd8 Validate network socket policies using the executor OS (#46302)
## Why

A controller and its executor can run different operating systems. Validating socket paths against the controller's OS can reject absolute paths that are valid on the executor, such as Windows paths on a Linux controller.

## What changed

- Thread `NetworkProxyExecutorOs` through network policy validation, proxy construction, and policy updates.
- Require allowed socket paths to be NUL-free and absolute for the executor OS, while preserving deny entries unchanged.
- Accept either Unix or Windows absolute syntax when executor metadata omits the OS, then validate against the executor's own OS at launch.
- Keep native path normalization and socket support checks at execution time.

## Testing

Add coverage for cross-platform absolute path syntax, invalid allow entries, preserved deny entries, and remote policy round trips that retain executor semantics through domain edits and proxy construction.

GitOrigin-RevId: 1ebc09cbce7138f60ec5fd62875591a3df52d067
2026-09-17 20:59:55 +00:00
alexsong-oai
8f73cdee45 Centralize OAuth login and refresh handling with safer diagnostics (#46300)
## Why

Login and token refresh have separate OAuth request and error handling. Token endpoint errors can echo credentials, and JSON decoding errors can expose token values in diagnostics.

## What changed

- Extract authorization URL construction, callback validation, PKCE, token grants, and error handling into a shared `oauth` module in `codex-rs/login`.
- Route authorization-code exchange and ChatGPT refresh through `OAuthClient`, retaining form and JSON encoding respectively and caller-owned HTTP and credential recovery policies.
- Redact echoed request secrets from rejection details and request IDs, redact sensitive transport URL fields, and replace token decoding errors with a generic error. Preserve original error codes for refresh failure classification.
- Keep callback state validation ahead of codes and provider errors, with the existing onboarding suffix handled by the login server.

## Testing

Add coverage for PKCE binding, request encoding and headers, callback state rejection, credential redaction, oversized or unreadable error bodies, and preservation of stored and cached credentials after transient refresh failures.

GitOrigin-RevId: d0a9583b99e24f5aafb751acd1e7200e2261a0e4
2026-09-17 20:17:06 +00:00