Commit Graph
11406 Commits
Author SHA1 Message Date
rhan-oai e103bbc06f Apply model catalog overrides to history, notes, and context tools (#56313)
## What changed

- Read optional tool descriptions and parameter schemas for `history`, `notes`, `new_context`, and `get_context_remaining` from the acting model's catalog messages.
- Support catalog namespace descriptions for history and notes, preserving explicit empty and whitespace descriptions.
- Share catalog override handling across native tools and MCP resource helpers. Keep bundled schemas when overrides are invalid, preserve encrypted parameters, and leave tool identity and transport fields unchanged.

## Testing

Add coverage for sparse catalog serialization, schema fallback and encryption preservation, per-step tool definitions, and context tool updates when switching models. Extend outgoing-request tests to verify history and notes overrides while retaining history image attachments.

GitOrigin-RevId: 1adac8b5009f95c91adba491f20a4e2e2dc91475
2026-10-23 00:46:28 +00:00
cassirer-openai 5b792948f9 Track accepted conversation history in rollout traces (#56312)
## Why

Model output alone does not establish that an item entered conversation history. Treating every response item as accepted can include discarded attempts, while relying on a later request misses accepted final output when a turn ends or is interrupted.

## What changed

- Record `HistoryItemAccepted` events and retain Responses item IDs, generating missing IDs consistently across item events.
- Build thread conversation history from request inputs, compaction checkpoints, and explicit acceptance. Keep unaccepted output accessible through its inference call.
- Preserve inference provenance across retries and late response records without overwriting newer request or compaction snapshots.
- Mark turns with errors as failed. Bump trace schemas to version 2 and reject incompatible bundles and event schemas during replay.

## Testing

Add reducer coverage for discarded attempts with identical text, late responses, compaction, inherited context, and legacy bundle rejection. Add CLI integration tests that run `debug trace-reduce` after success, stream failure, and interruption followed by shutdown, including responses without provider item IDs.

GitOrigin-RevId: 8e387a91d9b3f704df82847d630e6f0b08f998b3
2026-10-23 00:45:20 +00:00
goodman-oai 878070b5a6 Support model-specific writable-root permission wording (#56309)
## What changed

Add optional `writable_root` and `writable_roots` templates to model-catalog permission messages. Select the template by the number of displayed roots and substitute exactly one `{{ roots }}` placeholder with the existing formatted path list.

Fall back to the bundled sentence for missing, empty, invalid, or oversized templates. Preserve path contents, permission-path limits, and denied-read instructions. Update the permission wording when the selected model changes.

## Testing

Add coverage for template validation and size limits, singular/plural selection after path truncation, path preservation, sparse serialization, and model switches that append changed permissions once while preserving request history.

GitOrigin-RevId: 4dcfb7ff70b91db3dba3dda684b355b920e07974
2026-10-23 00:40:04 +00:00
Benjamin Carlsson 334527705c Separate directory and repository scopes in the TUI (#56308)
## Why

The `Cwd` session filter included sessions from linked worktrees, leaving no way to restrict the picker to the current directory. Project grouping also combined tasks across linked worktrees.

## What changed

- Keep `Cwd` filtering and directory-scoped `resume --last` and `fork --last` lookups limited to the current directory.
- Add an explicit `Repo` picker filter when multiple local worktrees are available, including sessions from corresponding directories across linked worktrees. Cycle between `Cwd`, `Repo`, and `All` in either direction.
- Add `Directory` grouping to the agent command center alongside `Project`, `Status`, and `Model`. Keep this choice in memory without writing a configuration value older clients cannot read.

## Testing

Extend coverage for directory and repository filtering, pagination scope, linked-worktree grouping, directory aliases, grouping persistence, and adjacent selection after task removal. Update picker and command center snapshots.

GitOrigin-RevId: 59603c9c5136db43124102b3277d1d1dab36bb87
2026-10-23 00:29:14 +00:00
andrewgu-oai 75a4146411 Add support for environment-scoped managed hooks (#56304)
## What changed

- Add discovery and listing APIs for environment-owned required hooks, with command and MCP execution routed to the owning environment.
- Use each environment's working directory in hook input, withhold controller transcript paths, and prevent environment hooks from granting permission requests.
- Resolve `command_windows` against the environment's platform and, when hooks are enabled, reject unloadable required hooks before accepting environment configurations at startup or readiness.

## Testing

Add regression coverage for invalid managed hook matchers at startup and readiness, successful readiness after correction, and per-hook working directory and transcript path scoping for `SubagentStop`.

GitOrigin-RevId: 1ac0ab3778ba608c72e5917fcbaebcc1d454887f
2026-10-23 00:09:23 +00:00
andrewgu-oai 7a5860da35 Add hook configuration to environment attachments (#56302)
## What changed

- Add `environment_hooks` to `EnvironmentConfig` for hooks from an environment's effective managed requirements. Initialize it empty for inferred thread configurations and report the handler count in debug output.
- Move `HookEventsToml`, `MatcherGroup`, and `HookHandlerConfig` into `codex_protocol::hooks`, with re-exports from `codex_config::hook_config`.
- Validate MCP hook input recursively to reject nulls and integers outside the signed 64-bit range without converting through `toml::Value`.

GitOrigin-RevId: 410506c8e2b89c9519c81d86b44ccd760d751693
2026-10-23 00:02:29 +00:00
viyatb-oai dc4844c907 Add TLS forwarding tests for MITM SigV4 requests (#56301)
## What changed

Add a test-only MITM CA constructor and local TLS origin fixtures to exercise AWS SigV4 forwarding:

- Check `aoss` payload hashes and credential replacement for GET and POST requests, while preserving unsigned requests and requests using another access key.
- Verify rejection of unsupported HTTP/1.1 framing and signing headers, and check the forwarded body, payload hash, and signed header presence at an HTTP/2 origin.
- Verify that draining signed request bodies releases buffering capacity before response headers arrive, allowing a ninth request to complete while eight responses remain pending.

GitOrigin-RevId: 4da0a77baace31486e77ad97d9581ec9f51bb34e
2026-10-23 00:01:18 +00:00
viyatb-oai e4deed3981 Mark built-in dummy credentials and strengthen collision checks (#56297)
## What changed

- Add `masked` after the provider prefix in built-in dummy credentials, followed by at least 22 random alphanumeric characters. Stop copying punctuation from the real credential.
- Check built-in dummy candidates against observed credential owners and discoverable configured-provider aliases, and reject overlaps with existing dummy credentials. Allow configured patterns to match a built-in dummy's format when no credential identity collides.

## Testing

Extend regression coverage for short and opaque credentials, fresh dummy values, known and late credential collisions, alias discovery, header injection, and text restoration. Verify that explicit authorization values remain unchanged even when they resemble masked credentials.

GitOrigin-RevId: 5080176f3ecbcdbb18943eab30136e15a4a3985e
2026-10-22 23:48:20 +00:00
smurching-oai 5a1c247dd5 Decouple managed configuration loading from ChatGPT authentication (#56295)
## What changed

Introduce a `BundleSource` interface for authentication, cache identity, bundle fetching, and unauthorized-request recovery. Move ChatGPT plan eligibility and credential recovery into `ChatGptSource`, while keeping validation, caching, and retry orchestration in the shared service.

Support source-specific cache namespaces while preserving the existing ChatGPT cache location. Retain one authentication recovery context across all retries of a bundle fetch.

## Testing

Extend the external authentication test to verify that recovery happens only once per bundle fetch, including when an intervening request failure triggers a retry.

GitOrigin-RevId: f5009f72dc4479f96d4ed1da9232f250988444a5
2026-10-22 23:38:09 +00:00
Adam Perry @ OpenAI eca79b000c Use fixed-token auth fixtures in Vertex tests (#56293)
## Why

The sequential token fixture rewrites shared files when resolving credentials. Concurrent credential resolution needs a fixture that can return the same token independently for each caller.

## What changed

Add `ProviderAuthCommandFixture::fixed_token`, which reads a token file using `cat` on Unix or `cmd.exe` on Windows without modifying it. Use it in the Vertex command-auth and guardian-request tests.

GitOrigin-RevId: 5bf5134f113b546a643a47012281fb960e885b15
2026-10-22 23:30:35 +00:00
Adam Perry @ OpenAI ef33e43a15 Fix MCP cancellation tests to use the metadata callback (#56292)
Update both `call_tool` invocations in `dropping_tool_call_cancels_remote_request` to pass `|_| Ok(None)`, matching the metadata callback API while continuing to omit metadata.

GitOrigin-RevId: 9d0f3e3108fe81972ce4fd4cca13f4b7febcc616
2026-10-22 23:14:44 +00:00
Kenny Yi 2326a3f74b Scope model catalogs and caches by thread originator (#56284)
## What changed

Select an originator-specific models manager before resolving thread model metadata. Supported originators send their own `originator` header and use separate in-memory catalogs and disk caches, so each thread receives the corresponding model instructions and tools.

Reuse managers for repeated originators and share the API-key model discovery setting across them. Unsupported originators retain the default manager and catalog.

## Testing

Add coverage for originator headers, concurrent catalog isolation, cache reuse across restarts, shared discovery policy, and the instructions and tools sent in actual turns.

GitOrigin-RevId: ae4aa51c8df2813a72fc8aed8978fd630e467069
2026-10-22 22:44:48 +00:00
Benjamin Carlsson 35e2102808 Group consecutive transcript prompts into one background block (#56280)
## Why

Consecutive user prompts in the rich transcript have extra blank spacing that breaks up their shared background.

## What changed

- Join adjacent visible user prompts into one background block, skipping hidden entries when determining adjacency.
- Keep prompts separated when intervening content becomes visible through detailed mode or search, and restore grouping when it is hidden again.
- Preserve selectable source offsets and joined spacing when text is rewrapped, and reuse cached layouts when checking adjacency.

## Testing

Add regression tests for prompt grouping, layout cache reuse, source offsets across rewrapping, detailed reasoning, and search-driven visibility. Update transcript snapshots to reflect the tighter spacing.

GitOrigin-RevId: faca8001244b0ac883d9d670864c8f7856ac2bad
2026-10-22 22:39:41 +00:00
viyatb-oai d124fe9de1 Add negotiated network policy metadata support for MCP calls (#56278)
## What changed

Add an optional `NetworkPolicyMetadataProvider` to the MCP runtime. Advertise `codex/network-policy-meta` only to trusted ChatGPT origins when a provider is available, and attach policy metadata only when the sending session also advertises support.

Strip caller-supplied policy metadata and derive restrictions from the call's captured permission profile and server environment. Resolve metadata against each session's capabilities, including after recovery, while retaining one policy snapshot per call. Fail the call before sending if policy resolution fails. Existing runtime callers leave the provider unset.

## Testing

Add tests for capability negotiation, trusted-origin restrictions, forged metadata removal, both tool dispatch paths, and policy snapshot reuse. Add HTTP session-recovery coverage for changing capabilities and policy-resolution failures while preserving caller metadata and read-only restrictions.

GitOrigin-RevId: 4b978f986abc0475fc67659be98fc01a2d6ce7cd
2026-10-22 22:33:07 +00:00
viyatb-oai 129220bf05 Support bounded request bodies in AWS SigV4 signing (#56277)
## Why

The network proxy previously required AWS signing requests to have an empty body or use `UNSIGNED-PAYLOAD`, preventing signing of nonempty payloads.

## What changed

- Buffer and hash request bodies before signing, then forward the original bytes.
- Add `max_body_bytes` with an 8 MiB default and a 16 MiB maximum, plus a 30-second body read timeout.
- Limit concurrent buffering to eight requests with a five-second capacity wait. Retain reservations while forwarded body data remains alive.
- Reject trailers and mismatched content lengths for buffered payloads while preserving streaming for explicitly unsigned payloads.

## Testing

Add coverage for payload hashing and forwarding, body limits and timeouts, fragmented body collection, and buffer reservation lifetimes. Extend signing tests for S3 path and query canonicalization, header replacement, and secret exclusion from trace logs.

GitOrigin-RevId: 48c18442fa90ae3efb1a4a99a168d07e1be2c496
2026-10-22 22:28:10 +00:00
goodman-oai ca87ef86e1 Wait for cloud config refresh cancellation in loader lifetime tests (#56274)
## Why

Aborting a refresh task is asynchronous, so yielding once before checking `is_finished()` does not guarantee cancellation has completed.

## What changed

Return the refresh task's `JoinHandle` from `cloud_config_bundle_loader_for_service` and retain its `AbortHandle` in the loader lifetime. Update `each_loader_owns_refresh_until_its_last_clone_is_dropped` to await each task and assert cancellation after dropping its last loader clone, while still checking that the replacement loader's task remains active.

GitOrigin-RevId: 2eb65211aefc21f9195ff766d8793f4b8f5a74c4
2026-10-22 21:56:16 +00:00
Matthew Zeng cb2581dae8 Preserve MCP disable reasons across runtime overlays (#56266)
## Why

A requirements denial on a custom `codex_apps` registration could block the trusted hosted Apps replacement. Requirements filtering also lost whether a server had been explicitly disabled, which must remain effective across runtime overlays.

## What changed

- Track explicit disables separately from requirements denials, retaining the requirement source across catalog rebuilds and server materialization.
- Allow trusted host-owned Apps to bypass a previous registration's requirements denial while preserving explicit disables and blocking later custom replacements.
- Preserve combined explicit and requirements disables during repeated filtering, and reject those servers when preparing standalone MCP login HTTP clients.

## Testing

Extend regression coverage for hosted Apps replacements, later custom replacements, cloud catalog refreshes, repeated requirements filtering, and standalone login rejection.

GitOrigin-RevId: 736a13c40fbf7436b4d0682f70c335f33f45962f
2026-10-22 21:11:21 +00:00
Celia Chen 3fd148a20c Add a built-in Google Cloud Vertex AI provider (#56265)
## What changed

- Support `model_provider = "gcp"` with a Vertex AI endpoint derived from `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION`, defaulting to the `global` location.
- Obtain credentials through `gcloud auth application-default print-access-token` by default, and allow `base_url`, `auth`, and `http_headers` overrides under `model_providers.gcp`.
- Use a static model catalog tailored to Vertex AI, preserve function tools, namespaces, and client-side tool search, and support remote compaction V2. Disable unsupported reasoning summaries, Responses Lite, custom tools, web search, and image generation.
- Expose a `gcp` account type through the app-server protocol and generated clients without resolving credentials during account reads or requiring OpenAI authentication.

## Testing

Add coverage for endpoint resolution, configuration overrides, model catalog filtering, authenticated requests, unsupported request fields, missing credentials, account reporting across provider changes, and automatic remote compaction.

GitOrigin-RevId: 97a3158269e6dbc2605e2cf576998e09817ea12a
2026-10-22 21:01:14 +00:00
willwang-openai 61a991990f Reject backslashes in HTTP(S) marketplace URL userinfo (#56263)
## Why

The URL parser treats backslashes as HTTP(S) path separators, while Git/libcurl does not. This difference can make a marketplace URL appear to match an allowed host pattern while Git connects to a different host.

## What changed

Reject HTTP(S) URLs containing literal backslashes in userinfo when checking marketplace host patterns. Continue allowing encoded backslashes in userinfo and backslashes in paths or query strings.

## Testing

Expand regression coverage to verify that denied URLs never invoke the cloner, create the marketplace install directory, or write configuration. Extend host-pattern tests to cover accepted HTTP(S) URL variants.

GitOrigin-RevId: cfdd29d6e83fb1718b505abaae85d37257317953
2026-10-22 20:55:25 +00:00
Owen Lin 40db507eec Avoid redundant settings checkpoints when resuming threads (#56250)
## Why

Resuming a thread with unchanged settings appended another `ThreadSettingsApplied` event to its rollout.

## What changed

Compare the effective settings with the latest persisted settings for the same thread before writing a checkpoint. Persist settings when they differ or no matching checkpoint exists, even if no turn follows the resume.

## Testing

Add a regression test that restarts the app server, resumes a materialized thread without overrides, and verifies that its persisted settings events remain unchanged.

GitOrigin-RevId: c545791ed3bb4020fa3da6d233607a9ba73e5c8d
2026-10-22 20:06:07 +00:00
Dmitriy Kovalenko c227654800 Consolidate Rust unit tests under dedicated test modules (#56247)
## What changed

Move inline crate tests into `lib_tests.rs` and nest related test suites under each crate's `tests` module. Update imports, subprocess test filters, logging targets, and snapshot names to match the new module paths.

Keep test helpers accessible where needed and preserve the schema writer's exact test name used by release tooling.

GitOrigin-RevId: de55eaae66dce4941abb33dd0b2f170093daa8f9
2026-10-22 19:36:47 +00:00
goodman-oai a3d93e1e69 Make the code mode yield/resume test yield explicitly between phases (#56236)
Add `yield_control()` after phase 2 in
`code_mode_can_yield_and_resume_with_wait` so the intermediate output is
returned explicitly. Increase both `wait` calls' `yield_time_ms` from 1,000
to 10,000 to allow more time for each phase to produce its output.

GitOrigin-RevId: 3626a64ae0269c22ad634ec2e3fd5e27942f649f
2026-10-22 17:49:53 +00:00
Abhinav 8c7affbe1b Emit prompt telemetry only after hooks accept input (#56234)
## Why

Prompt telemetry can include full user text. Emitting it before hook acceptance logs prompts that `UserPromptSubmit` hooks subsequently block.

## What changed

Move prompt telemetry from input submission to hook acceptance, including queued and steered input. Preserve telemetry for accepted Guardian review prompts that are converted to response items during finalization.

## Testing

Extend hook regression tests to assert that blocked prompts are absent from telemetry and rollouts, while accepted queued prompts are logged exactly once. Extend Guardian review coverage to assert exactly one prompt event across inspection steps.

GitOrigin-RevId: aa71f98de2356dd08f62ff492e897ab3a43b54c9
2026-10-22 17:48:34 +00:00
goodman-oai 7ace9c6aa2 Make Opus encoder test timestamps follow sample time (#56233)
Timestamp synthetic frames in `real_encoder_produces_twenty_millisecond_opus_packets`
from a single start time using each block's sample offset and input rate. This
keeps the test audio contiguous even when the test thread is descheduled.

GitOrigin-RevId: e66440fcc3b3c965a7b1b22b61246c2a622a9cc9
2026-10-22 17:42:21 +00:00
Charlie Marsh ffda54f5b8 Reuse current model context across paginated resume config loading (#56224)
## Why

Resuming a paginated thread rechecks stored history after loading configuration. Unchanged model context can be reused instead of loading it again.

## What changed

Retain the prepared model context across configuration loading and reuse it when the thread ID, rollout path, and history revision still match. Add `ThreadStore::is_model_context_current` to validate revisions, with a fresh read when validation fails or is unavailable.

## Testing

Add coverage for revision invalidation after history is appended or removed. Extend resume tests to cover paginated history, concurrent metadata and lifecycle changes, workspace-root changes, and preservation of saved user messages in model requests.

GitOrigin-RevId: bad2ca0caddb63523264ac530ffb801db3961f2b
2026-10-22 17:15:06 +00:00
felixxia-oai 96a0d8d551 Use cargo_bin in the Windows sandbox manifest test (#56220)
Resolve `codex-windows-sandbox-setup` with `codex_utils_cargo_bin::cargo_bin` so the manifest test supports both Cargo binary paths and Bazel runfiles.

GitOrigin-RevId: 23e62800cdd5994eb18fa47fcc1479f4ce10c42e
2026-10-22 17:02:32 +00:00
felixxia-oai be537fb60c Remove the u64 cast from WSL DrvFS detection (#56214)
GitOrigin-RevId: 9298584c88089222fe61209b76641fa970555e1f
2026-10-22 16:46:42 +00:00
jif a390571745 Default fresh memory profiles to v2 (#56211)
## Why

Profiles without a v1 memory workspace have no legacy context to preserve or consolidate before using v2.

## What changed

- Select v2 when memories are enabled and the `memories` directory is absent. Preserve explicit `memories.version` settings, the `memories.dual_write = false` opt-out, and the v1 default for existing workspaces or filesystem check errors.
- Report `v2_ready` immediately for profiles without a v1 workspace. Keep the consolidation count and valid-summary requirements for profiles with a v1 workspace.
- Make resetting an absent memory workspace a no-op so it does not create an unused v1 directory.

## Testing

Extend coverage for default and explicit version selection, opt-outs, version-specific memory reads, fresh-profile readiness and reset behavior, and running only the v2 pipeline for fresh profiles.

GitOrigin-RevId: a8fb0844962ae9266ffbe88af97e8dc4a99ac15f
2026-10-22 16:26:03 +00:00
felixxia-oai 8ba7aed55f Stabilize the marketplace staging cleanup test (#56210)
## Why

A concurrent fork can retain locks from a previous cleanup pass until exec,
causing the next pass to skip cleanup and fail the test's assertions.

## What changed

Wait for and explicitly release both staging locks before each cleanup pass in
`cleanup_reclaims_unpublished_and_aged_legacy_clones`. Run the existing age
scenarios in a loop and report the age when legacy directory assertions fail.

GitOrigin-RevId: 115d887e6b74159f22a2f675237e3b3356ab0308
2026-10-22 16:24:53 +00:00
viyatb-oai 9a8a85bc53 Add AWS SigV4 signing to network proxy MITM hooks (#56182)
## Why

Allow workloads to make AWS requests with placeholder credentials while keeping real AWS credentials in the trusted proxy process.

## What changed

- Add an `aws_sigv4` hook action with a placeholder access key ID, region, service, HTTPS port, and credential sources from proxy environment variables or files.
- Re-sign matching requests after network and hook authorization and header transformations, using the configured credentials and optional session token.
- Support empty payloads and explicitly unsigned payloads, including streaming unsigned S3 uploads. Reject selected requests with incompatible credential scopes, presigned URLs, unsupported streaming signatures, or ambiguous framing through the hook denial path.
- Mark generated credential headers as sensitive and suppress signing SDK trace events that could expose credentials.

## Testing

Add tests for the published AWS IAM signature vector, unsigned S3 uploads with a session token, and rejection of invalid transport, credential scopes, signing inputs, and unsupported bodies.

GitOrigin-RevId: ab4fbbc00ba40a5bb309add521fea6ee2ff6e79e
2026-10-22 14:01:19 +00:00
felixxia-oai 2f3fb111be Enable reasoning effort overrides by default (#56163)
## What changed

Promote `reasoning_effort_override` to stable and enable it by default, allowing supported models to receive reasoning effort changes through configuration updates in conversation history.

Update request-history snapshots to include the configuration updates, and remove explicit feature enablement from the reasoning effort override test builder so the suite exercises the default.

GitOrigin-RevId: 6ce16d7f985c33f008e5230fc9bae09cdaf141d5
2026-10-22 12:46:24 +00:00
olliem-oai 94350a9101 Add managed network review domains before allow rules (#56154)
## Why

Managed network policies need to require approval for selected hosts even when an exact or wildcard allow rule matches them.

## What changed

- Add `experimental_network.review_domains` to managed requirements and route matching hosts through the existing network approval flow. Explicit denials retain precedence, and approved connections still undergo DNS and local-address checks.
- Preserve review patterns across environment policy attachments and remote proxy configuration. Reject execution on an exec-server that lacks the `networkProxyReviewDomains` capability when review patterns are present.
- Expose `reviewDomains` through the app-server requirements API and generated schemas, and show `review_domains` in debug configuration output.
- Update approval reasons to say that network access requires approval rather than assuming the host is absent from the allowlist.

## Testing

Extend coverage for review precedence over exact and wildcard allows, explicit denials, DNS checks after local and remote approvals, approval hooks, policy merging, remote configuration round trips, and requirements API serialization.

GitOrigin-RevId: 4a861061a0ed80b3537d3b72f2caecb0db2a4f0b
2026-10-22 11:52:34 +00:00
jif 67fb9da4b6 Preserve safe enterprise MCP authentication error details (#56153)
## Why

Enterprise MCP token exchange and sign-in failures can collapse into generic errors, hiding useful diagnostics such as an OAuth `invalid_scope` rejection or a cancelled sign-in.

## What changed

Introduce `EmaErrorDetail` to carry static operation messages and sanitized SDK diagnostics through token-source errors and enterprise login completion. Exchange failures can report the stage, HTTP status, and allowlisted OAuth error code, such as `IdentityProvider: HTTP 400: invalid_scope`, without retaining arbitrary provider text or raw error chains.

Preserve specific discovery, credential storage, cancellation, and account/configuration mismatch errors instead of replacing them with generic failure messages.

## Testing

Extend tests to cover `invalid_scope` diagnostics, specific sign-in completion errors, and exclusion of credentials from diagnostics even when an outer error context contains sensitive text.

GitOrigin-RevId: e9280a5db3565ea91da0810bab528da5ee088d64
2026-10-22 11:51:23 +00:00
jif 61f34c35af Fix the MCP auth status test's IdP OAuth configuration (#56139)
Initialize `client_secret` and `token_endpoint_auth_method` to `None` in
`ema_auth_statuses_do_not_wait_for_account_refresh` to match
`McpServerIdpOAuthConfig`.

GitOrigin-RevId: 0c800b4f60d2468d7c2cb0b8d83bbdb4b3998574
2026-10-22 10:38:19 +00:00
eknight-oai b337fe06b7 Defer agent mail after empty final answers (#56133)
## Why

An explicit `final_answer` with empty or whitespace-only text could allow queued agent mail to restart the turn instead of leaving it queued for the next turn.

## What changed

Treat explicit `final_answer` messages as terminal regardless of visible text in both completed-item handling and turn-item finalization. Untagged messages still require visible text to defer mailbox delivery; `commentary` and `partial_answer` messages do not defer it.

## Testing

Extend regression coverage for empty and whitespace-only final answers, delivery of queued agent mail on the next turn, and message board notifications arriving before or after an empty final answer.

GitOrigin-RevId: 466f1a9c613e07d67ce45458858ba32d5d23f11d
2026-10-22 10:03:05 +00:00
rhan-oai 2dbe6bfa44 Cancel MCP tool requests when response futures are dropped (#56132)
## Why

Dropping a local tool-call future did not notify the MCP server that the request was cancelled, leaving remote work running.

## What changed

- Send a cancellation notification for the request when its response future is dropped, covering both ordinary tool calls and tool-input rounds.
- Preserve write order for stdio and in-process transports so cancellation cannot arrive before its tool request, without waiting for tool responses.

## Testing

Add regression tests for cancellation on drop, request-before-cancellation ordering under reversed send polling and exhausted task budgets, and continued use of the shared connection after cancellation.

GitOrigin-RevId: fab02d546fd82c601756117d9ecbf1017c28ac11
2026-10-22 09:57:51 +00:00
jif c260087efe Avoid blocking EMA auth status checks on account refresh (#56127)
## Why

EMA MCP auth status checks acquired an account grant lease, making status inspection wait for account refresh coordination or an existing lease.

## What changed

Add `AuthManager::account_oauth_grant()` to inspect an owner-checked grant without acquiring the refresh lock. Use it for EMA status checks and share a single lazy read across servers, including missing grants and read errors. Keep refresh exclusion for token exchanges through `lease_account_oauth_grant()`.

## Testing

Add regression coverage for status checks across two EMA servers while an account lease is held. Extend account refresh tests to verify inspection completes with a lease held and refresh queued, and returns no grant after logout.

GitOrigin-RevId: 921214dd552eb216c713596f2737460053a07d08
2026-10-22 09:37:28 +00:00
jif 07316174c6 Forward Guardian reviewer events to parent raw-event subscribers (#56124)
## What changed

Add the disabled-by-default `guardian_recorded_items` feature to forward recorded reviewer items and interruptions through the parent's raw-event subscription, preserving reviewer thread and turn IDs without modifying the parent's history or completing its turn.

Emit reviewer items as `rawResponseItem/completed` notifications and interruptions as interrupted `turn/completed` notifications. Mark opted-in reviewer requests with `guardian_recorded_items` metadata.

## Testing

Extend Guardian integration tests to cover reviewer identity, recorded-item metadata replay, concurrent reviewer interruptions, independent parent completion, and behavior without the feature enabled.

GitOrigin-RevId: beb4dbf6c6f2a800a2fbf3cfd11ae174a1382386
2026-10-22 09:20:00 +00:00
Benjamin Carlsson 86e17e98c7 Prepare TUI startup to accept multiple backend sessions (#56097)
## What changed

- Add `InitialBackendSessions` to carry the initial session and additional sessions into the TUI event loop. Existing launches continue to supply a single session.
- Shut down all supplied sessions on startup errors, cancellation, and early exits.
- Register the under-development `tui_multi_backend` feature flag, disabled by default, and expose it in the configuration schema.

## Testing

Add a regression test that fails bootstrap and verifies that both initial backends receive shutdown requests. Update multi-source event polling coverage to use the new initialization path.

GitOrigin-RevId: e5db439552de97594e6f13360b90be71256ab2f0
2026-10-22 06:32:01 +00:00
Eric Traut c2d5ea52e1 Keep TUI preferences editable when execution settings are invalid (#56091)
## Why

Saving a local preference could succeed but fail to apply live because reloading the full configuration also resolved execution settings. An unknown `model_provider`, for example, prevented the preference from taking effect.

## What changed

Reload config-panel preferences from the configuration layer stack into `LocalSettings` without rebuilding execution settings. Preserve CLI overrides, loader overrides, cloud configuration, and the existing choice of working directory.

## Testing

Extend the offline remote-session preference test with an unknown `model_provider` override, verifying that automatic recap and paste detection preferences still persist and apply live.

GitOrigin-RevId: 2377a01c77f3cb978a7ee6cd67c1fe89361131fb
2026-10-22 05:51:47 +00:00
Eric Traut 47a1f6bb77 Honor server approval reviewer defaults on fresh TUI startup (#56090)
## Why

A saved client `approvals_reviewer` setting could override the app server's default when starting a fresh thread.

## What changed

Use explicit invocation overrides for the first thread's approval reviewer, leaving the selection to the server when no override is provided. Typed overrides take precedence over key-value overrides, and repeated key-value overrides use the last value. Explicit profile launches retain their resolved configuration behavior.

## Testing

Extend startup tests to cover server defaults, embedded startup, explicit override precedence, and profile launches. Verify that the first turn uses the reviewer returned by the server.

GitOrigin-RevId: 19d4d75bb8fbe522fb9495bd9c6951513f8ac4d2
2026-10-22 05:50:40 +00:00
Celia Chen b4ad33d1a3 Cache decrypted Codex auth and managed secrets (#56081)
## Why

Repeated reads of Codex auth and managed secrets repeat expensive scrypt decryption even when the encrypted file and keyring passphrase are unchanged.

## What changed

Extend the decrypted snapshot cache to `CodexAuth` and `ManagedSecrets`, keeping at most one snapshot per namespace. Reuse snapshots only when the file path, ciphertext, and passphrase match, and invalidate matching snapshots on writes. Every read still checks the file and keyring before reusing plaintext.

## Testing

Extend cache tests to cover concurrent reuse, writes, external file replacement, file removal, key rotation, keyring errors, invalid ciphertext, and isolation across homes and namespaces. Prime the auth cache before verifying fallback when the keyring fails.

GitOrigin-RevId: eaf802ef4cfdbe482b56423807a1fe0fe3def2cd
2026-10-22 04:59:19 +00:00
smurching-oai 342ed69a17 Require managed configuration from the configured server (#56055)
## Why

Local administrators need to require managed configuration from a specific customer-hosted server before a session can start.

## What changed

- Add a local managed `config_server` requirement with an HTTPS base URL and optional OAuth settings. Validate endpoints and derive the bundle route as `codex/config/bundle` beneath the base URL.
- Replace the entire `config_server` block when a higher-priority requirements layer supplies one, keeping the endpoint and OAuth settings together. Reject this setting in fetched policy.
- Track the applied server through configuration snapshots, role overrides, and refreshes. Reject session startup and managed refreshes when the applied server does not match the requirement; user refreshes retain the session's managed configuration.

## Testing

Add coverage for missing, mismatched, and matching server configuration at session startup, whole-block replacement, rejection of server settings in fetched policy, and preservation across role overrides and refreshes.

GitOrigin-RevId: 51e8a1738dabdb117ae858120f6fb09ae2ff1261
2026-10-22 02:15:00 +00:00
viyatb-oai 2a77e82f09 Support configured credential providers in remote execution (#56049)
## Why

Remote credential masking previously fell back to unmasked execution whenever custom credential providers were configured.

## What changed

- Transport configured provider rules to the executor-local network proxy, where credential values and destination context are resolved.
- Advertise `credentialMaskingCustomProviders` and negotiate masking support. Keep the warning and unmasked fallback for executors that support only built-in providers.
- Discard provider rules when masking is disabled and omit their contents from debug output.

## Testing

Extend coverage for capability compatibility, provider configuration round trips, and fallback on older executors. Exercise configured-provider masking in remote request history and verify that masked placeholders are restored to real credentials in upstream request headers.

GitOrigin-RevId: b036f56900b343ddccc17b5293c82bc1f3426237
2026-10-22 01:54:51 +00:00
Anthony Tafoya 0769c6aeeb Enable executor cleanup hooks with V2 capability discovery (#56044)
## Why

Executor hooks depended on V1 discovery snapshots, so plugins discovered through V2 could not run their cleanup hooks.

## What changed

Prepare executor hook sources during step setup from either V1 or V2 discovery and capture them in `StepContext` for stop, interrupt, and memory consolidation hooks. Restrict V2 sources to selected plugin installations while preserving plugin enablement, hook admission, MCP routing, and app tool policy checks.

## Testing

Add unit coverage for V2 hook admission, environment routing, disabled plugins, and failed discovery. Add integration coverage showing that `Stop` and `Interrupt` cleanup hooks run with V2 discovery alone and remain silent when the plugin is disabled.

GitOrigin-RevId: a4c0e9c56bdebcdf22cea63f02f8fb4c5eed358e
2026-10-22 01:42:11 +00:00
Benjamin Carlsson 45179176e5 Add a channel-backed cloud app-server client (#56037)
## What changed

- Add `CloudClient` and integrate it with `AppServerClient` and `AppServerRequestHandle` for requests, notifications, server-request replies, events, and shutdown.
- Keep retained request and reply handles bound to their cloud backend, with event delivery independent of request completion and a timeout for shutdown.
- Return no platform or Codex home metadata for cloud clients, and reject TUI filesystem operations for this backend.

## Testing

Add tests for backend ownership of retained handles, independent event delivery, errors after the command receiver closes, and shutdown timeouts when the worker does not respond.

GitOrigin-RevId: 4cf308dc0ea6fa6e7b14dd4542d93e8030b0162d
2026-10-22 01:14:34 +00:00
smurching-oai 09ec2451bf Add request-scoped OAuth credentials and session lifecycle APIs (#56036)
## What changed

- Add `OAuthSessionRequest` to pair access tokens with their authorization identity and retain rejected-token recovery across transient failures and retries. New sign-ins receive an identity that survives token refresh.
- Expose explicit login, logout, and authorization identity lookup, plus a per-manager option to disable automatic browser login while allowing credential reuse and refresh.
- Move serializable `OAuthSessionConfig` into `codex-model-provider-info`, add an optional `device_authorization_url` field, and share endpoint URL validation through `codex-http-client`.
- Distinguish permission failures, transient token endpoint failures, and invalid responses using `io::ErrorKind`.

## Testing

Add coverage for sign-in identity preservation through refresh retries, removal of saved and cached credentials on logout, and suppression of automatic browser login. Extend token endpoint error classification coverage.

GitOrigin-RevId: ae9f72e787171e179fe139a3b840a9f7e1e46506
2026-10-22 01:07:13 +00:00
alexsong-oai 8440e76ae6 Enable the Bedrock setup wizard by default (#56033)
## What changed

Promote `bedrock_setup_wizard` to stable and enable it by default for eligible onboarding. Users can still disable it with `features.bedrock_setup_wizard = false`.

## Testing

Update onboarding coverage to check the enabled default and explicit opt-out. Remove the explicit opt-in from daemon startup tests so they exercise the default configuration.

GitOrigin-RevId: 5bd911088681a31d34aa444398e6d3f7d1d87955
2026-10-22 00:50:52 +00:00
liame-oai 943c70d8d2 Support client Responses API metadata in thread/sample (#56031)
## What changed

Add optional `responsesapiClientMetadata` to `ThreadSampleParams` and forward it to the sample turn's Responses API metadata. Update the experimental protocol schema.

## Testing

Extend the thread sample integration test to verify that client metadata appears in both the request header and body, preserves the explicit `turn_trigger` when client metadata supplies a conflicting value, and does not carry over to the next parent turn.

GitOrigin-RevId: eb1f80824d476fc6c584a2b35d97e59d51fd4273
2026-10-22 00:33:28 +00:00
richardopenai e8bb1b6641 Limit decoded HTTP/3 response headers in the TCP tunnel (#56024)
## Why

QPACK can expand compact response headers into large decoded field sections. Bound their size before `h3` constructs its capacity-limited `HeaderMap`.

## What changed

Set the HTTP/3 client's maximum field section size to 64 KiB so oversized responses are rejected with `HeaderTooBig`.

## Testing

Add a regression test that sends QPACK static references around the size limit and a much larger expansion. Verify that oversized responses are rejected and a subsequent valid response succeeds on the same connection.

GitOrigin-RevId: d7c83a7a755dfafae05919ec52542ffce40a1ef4
2026-10-22 00:19:02 +00:00