Commit Graph
5470 Commits
Author SHA1 Message Date
Charlie Marsh aa39ded153 Trace MCP refresh causes and plugin metadata changes (#60505)
## What changed

- Track and log `McpRefreshReason` values for runtime refreshes, including invalidations received during thread startup and forced refreshes. Restore claimed reasons when a refresh is cancelled before publication, while preserving concurrent invalidations.
- Correlate installed-plugin metadata invalidations with downstream MCP refreshes using a shared change ID. Log changed field names by plugin ID, additions, removals, and reordering without logging field values.
- Record whether background installed-plugin bundle updates were requested by startup, plugin listing, or installation.

## Testing

Add coverage for metadata change attribution across membership changes and reordering, and for retaining refresh causes across cancellation and concurrent invalidation.

GitOrigin-RevId: 3d4485ccfcc1d8788eb9909a060ac200c467af13
2026-11-10 02:45:30 +00:00
ioanbudea-OAI 0e6f153732 Derive sandbox telemetry labels directly from permission profiles (#60500)
## What changed

Compute the `sandbox_policy` label for `codex.conversation_starts` from the effective `PermissionProfile` without constructing a legacy `SandboxPolicy`. Preserve the historical labels and native-path compatibility fallbacks, including `workspace-write` for writable profiles that cannot be represented by a legacy policy.

Share the full-disk write compatibility check with session startup and the write-intent check with legacy policy conversion.

## Testing

Extend telemetry tests to assert sandbox labels in both logs and traces across disabled, external, read-only, workspace-write, and full-disk profiles, including unrenderable writable URIs and read restrictions. Add protocol assertions for legacy write-intent detection.

GitOrigin-RevId: 00f11d763c366453e7bb0899546a4ebbdb93c4d5
2026-11-10 02:31:50 +00:00
ioanbudea-OAI 1c9b058d26 Unify Guardian context preparation across reviewers (#60498)
## Why

Asynchronous Guardian collection applied entry caps and compressed heartbeat messages before request preparation, while synchronous collection preserved originals. Preserve the captured evidence so request-time profiles and budgeting determine what is delivered.

## What changed

- Replace `prepare_sync_context` with a shared `prepare_context` entry point for synchronous and asynchronous presentations.
- Defer text caps, native-message omission, and heartbeat compression to preparation, preserving heartbeat reference numbering across transcript deltas.
- Support elastic transcript preparation for both reviewer profiles.
- Borrow collected asynchronous context instead of cloning the full transcript, and filter previous reviews against reviewer history during preparation.

## Testing

Add coverage for collection preserving originals, fixed preparation truncating text and omitting oversized native entries, and elastic preparation deferring entry caps for both profiles. Update heartbeat tests to cover full and delta preparation without mutating collected evidence.

GitOrigin-RevId: 4d4e448acf5dc8880a05c3c9a9754378135f61eb
2026-11-10 02:18:39 +00:00
Sean Huang 064b2d9bca Preserve typed gRPC code-mode session admission errors (#60496)
## Why

Session-opening failures were returned as strings, preventing callers from inspecting the terminal gRPC admission status directly.

## What changed

- Add `GrpcCodeModeSessionProvider::open_session` returning `GrpcSessionOpenError`, distinguishing admission status codes, admission timeouts, and other setup failures.
- Keep string errors for the existing `CodeModeSessionProvider` trait API.
- Re-export `ProcessOwnedGrpcCodeModeSessionProvider` from `codex-core`.

## Testing

Extend admission tests to assert terminal status codes, cover exhausted `ResourceExhausted` retries, and verify that `DeadlineExceeded` is not retried.

GitOrigin-RevId: 9d7f2e733e12b8bb7def368fa5fc5a09ea2a374e
2026-11-10 02:09:01 +00:00
jameswt-oai 6aa88f9946 Remove the Xcode 26.4 MCP elicitation compatibility workaround (#60488)
## What changed

Route MCP elicitations through the standard handling paths for Xcode 26.4 clients. Remove the client-specific auto-deny flag and the synthetic acceptance of session elicitation requests without dispatching them to the client.

Simplify `request_mcp_server_elicitation` to return the optional response directly, and remove telemetry guards that depended on whether the workaround bypassed dispatch.

GitOrigin-RevId: ab540dcd67f8fa6d16c69bc7629f436e4b5aa73a
2026-11-10 01:30:43 +00:00
Charlie Marsh 4b345a8de9 Treat workspace access denials as terminal errors (#60480)
## Why

A `403` with `codex_workspace_access_denied` indicates that the account cannot use Codex in the selected workspace. Retrying or falling back to HTTP does not resolve that denial.

## What changed

Map `codex_workspace_access_denied` and `invalid_workspace_selected` responses to a shared workspace access denial error, and rename the error variant to reflect its broader scope. Keep workspace denials excluded from compaction model fallback.

## Testing

Extend API error mapping tests to cover the new code on `403` and preserve ordinary handling for `503`. Add WebSocket coverage verifying that an explicit workspace access denial does not trigger HTTP fallback.

GitOrigin-RevId: e601a22a0fa783a4ce5401a98ff9c8d3d9d1b074
2026-11-10 00:54:30 +00:00
Charlie Marsh 65f2709052 Treat content policy violations as terminal errors (#60479)
## What changed

Recognize `content_policy_violation` in HTTP 400 responses and streamed errors as a dedicated, non-retryable error. Preserve the provider's message and available HTTP status, use a fallback message when needed, and report `CodexErrorInfo::InvalidPrompt` to clients.

End the response stream immediately on this error and stop compaction from falling back to the current model after a content policy rejection. Add redacted diagnostic output and a dedicated sampler failure reason.

## Testing

Extend coverage for HTTP and wrapped WebSocket errors, missing or blank provider messages, terminal stream failures with retry headers, and content policy rejections during local and remote compaction on model downshift.

GitOrigin-RevId: 592170ac30c07b0b303a8d5cb15bd35c8f821b55
2026-11-10 00:53:04 +00:00
Charlie Marsh bb360e5db8 Stop retrying explicit invalid-workspace errors (#60475)
## Why

HTTP 403 responses with `invalid_workspace_selected` were treated as unexpected status errors, allowing retries and compaction fallback to another model after the server rejected the selected workspace.

## What changed

Recognize the code in `detail.code` or `error.code`, falling back to the `x-error-json` header when the body has no code. Classify these 403 responses as `InvalidWorkspaceSelected` and disable retries and compaction model fallback while preserving the response details and HTTP status. Other 403 responses retain their existing retry behavior.

## Testing

Add coverage for body and header error codes, code precedence, HTTP and WebSocket retry behavior, and local and remote compaction during a model downshift.

GitOrigin-RevId: f44a3bee5ef06e601909839868ab99cea6dd7d03
2026-11-10 00:07:57 +00:00
Charlie Marsh d3147716e0 Respect error retry policy during local compaction (#60473)
## Why

Local compaction retried invalid requests and server overload errors without retry advice, and used local backoff even when the server supplied `Retry-After`.

## What changed

Use `CodexErr::retry_delay` to decide whether and when to retry local compaction. Honor the original `Retry-After` deadline when present, while retaining the configured retry limit and context-window trimming behavior.

## Testing

Add coverage verifying that manual local compaction does not retry invalid requests or overload responses without retry advice, but retries overload responses with `Retry-After`.

GitOrigin-RevId: abe6cbba661f701b97f8b1ab83b1fe86979f03c0
2026-11-10 00:07:10 +00:00
Dmitriy Kovalenko 76dcb8199b Honor permission grant scopes in executor capability discovery (#60461)
## Why

Approved filesystem access should make executor skills discoverable and readable for the lifetime of the grant. Turn-scoped access must not authorize persistent plugin servers or hooks, or bypass disabled-plugin policy.

## What changed

- Apply environment-specific session grants to capability discovery and refresh MCP after session grants change.
- Use a separate discovery inventory for skills with turn-scoped grants, keeping plugin servers and hooks on the session inventory. Reuse discovery results across unchanged model steps.
- Preserve disabled-plugin checks for unreadable manifests and symlinked manifest files or directories, including ancestor markers, while retaining standalone skill roots.

## Testing

Add coverage for V1 and V2 skill discovery before approval, after approval, and on the next turn; disabled-plugin ownership checks; discovery cache reuse; and session hooks surviving turn-scoped discovery failure.

GitOrigin-RevId: 929a7f8cb01f4bcfb4bee2c50ae02cd762066b2d
2026-11-09 22:20:07 +00:00
Jenia Varavva 9f04d886f3 Support cancellation and deadlines for realtime attachments (#60443)
## Why

A pending realtime connection handshake can hold up subsequent attachment requests. Callers need to cancel obsolete attempts or limit how long they may take to establish a connection.

## What changed

- Add `RealtimeAttachmentOptions` with an optional cancellation receiver and `start_before` deadline to `Op::RealtimeConversationAttach`.
- Interrupt pending connection work and finish cleanup before acknowledging cancellation. Reject cancelled or expired requests before replacing an existing conversation, and recheck cancellation and the deadline before publishing a connection.
- Preserve a successfully published connection when cancellation arrives later. Dropping a cancellation sender whose value is `false` lets the attempt continue.
- Prepare the daemon startup test's socket directory with `codex_uds::prepare_private_socket_directory`.

## Testing

Add integration coverage for cancelling a held handshake, skipping cancelled or expired queued requests, preserving the next usable call, and releasing a pending handshake when its deadline expires without a cancellation receiver.

GitOrigin-RevId: 7144c1237bcbe3b859f10b654d919ae9ff20cbbb
2026-11-09 20:24:40 +00:00
Won Park 6bd17ba6ae Revalidate request auth ownership after budget checks (#60436)
## Why

Account changes during asynchronous request setup can invalidate the credentials selected for a generation request.

## What changed

- Restart HTTP request setup if the auth owner changes during the budget check.
- Validate the WebSocket connection's retained auth owner with `AuthOwner::is_current()` after budget checks.

## Testing

Add regression coverage for account switches during HTTP budget checks and external credential changes before WebSocket request setup, in both dual-header and assertion-only runtime auth modes.

GitOrigin-RevId: 7a1e1475a40aa2d34cd94f60f729ad697f3f7028
2026-11-09 19:50:14 +00:00
Charlie Marsh 27fcd7cbed Expose deferred MCP servers in resource listings (#60423)
## Why

Aggregate resource listings omitted dormant MCP servers, leaving callers without their names for explicit queries.

## What changed

Include a sorted `deferredServers` list in aggregate `list_mcp_resources` and `list_mcp_resource_templates` results alongside resources from ready servers. Apply the listing filters to deferred servers and omit the field when empty. Discovery leaves dormant servers unstarted; callers can query them by passing `server` explicitly.

## Testing

Extend the resource discovery scenario for direct calls and Code Mode to verify deferred server names, confirm discovery leaves the server unstarted, and then list and read resources by server name.

GitOrigin-RevId: f95b8beb64bb1329f4ae3245e8c375614fcb3360
2026-11-09 17:58:16 +00:00
Dylan Hurd 8703d32bd0 Treat goal objectives as untrusted context (#60342)
## What changed

- Pass goal objectives as untrusted `goal_objective` context instead of embedding them in continuation instructions. Direct the model to use `get_goal` if the objective is missing or truncated.
- Inject newly created objectives into their originating active turn without dropping unrelated client context. Render them as tool outputs when `UntrustedAsToolOutput` is enabled.
- Queue additional context together with automatic turn input so both reach the first model request.

## Testing

Extend app-server coverage to verify that model-written objectives appear as tool outputs at creation and continuation, without duplicating them in user messages. Update steering and Python SDK tests to check objective preservation and delivery alongside continuation instructions.

GitOrigin-RevId: 6f44f6d6c895bb4dc378c9cf84d6470ccc885c67
2026-11-09 03:58:05 +00:00
richardopenai c9b4267c37 Expose agent tree IDs and environment removal (#60190)
## What changed

- Add `CodexThread::agent_tree_id()` to identify a loaded agent tree. The root and native children share an ID; loading a new tree produces a new ID even when reusing a persisted thread ID.
- Add `EnvironmentManager::remove_environment()` to unregister an environment while preserving existing handles and the default environment ID.

## Testing

Extend tests to check tree IDs across child creation, forks, warm reuse, and cold reloads, and to verify environment removal and re-registration.

GitOrigin-RevId: 43944ed6766374508d9862cd5d333bc4cb67c338
2026-11-08 02:27:59 +00:00
Alex Kira c3936b4b8a Allow model overrides for incremental Code Mode tool messages (#60188)
## What changed

Add `exec_tools_update_hint` and `exec_tools_removed_definitions_header` to `model_messages.tools.incremental_tools` and use them when rendering Code Mode catalog updates and removals.

Overrides are literal strings limited to 512 UTF-8 bytes per field. Missing, null, or oversized values use the existing bundled wording. Empty strings omit the guidance while retaining changed definitions and removal keys. Wording changes alone do not trigger catalog updates.

## Testing

Extend unit coverage for defaults, null fields, independent fallback, and UTF-8 byte limits. Add scenario assertions and a snapshot covering custom and empty wording, model switches, catalog changes, and restoration after compaction.

GitOrigin-RevId: da9e00fdb5197a2b5fa39ce533ba87c76ff3e82c
2026-11-08 01:13:32 +00:00
Alex Kira 5226f2fb4b Add metrics for incremental exec catalog updates (#60177)
## What changed

Count tool and namespace-instruction entry deltas in `codex.tools.exec_entry_updates`, tagged by `added`, `schema_changed`, or `removed`. Entry replacements count as `schema_changed`; full catalog declarations do not count as entry deltas.

Record rendered UTF-8 batch sizes in `codex.tools.exec_update_bytes`, including hints and framing but excluding full declarations and removal notices.

## Testing

Extend the namespace transition test to verify action counts, UTF-8 byte totals, and metric behavior when exec is hidden, restored, or unchanged.

GitOrigin-RevId: 22070b84230296d78a67b83641cbc02157d84419
2026-11-07 22:38:11 +00:00
Alex Kira aa9b9cc94e Test exec catalog preservation across session and compaction changes (#60173)
## What changed

- Cover incremental exec tool settings and catalog changes across resume, fork, tool mode switches, and compaction.
- Verify that adopting background compaction preserves live exec declarations, tool metadata updates, and retained conversation order after a model catalog refresh.
- Include an `exec` namespace in the top-level tool catalog ordering and snapshot round-trip test.

GitOrigin-RevId: 3df603b98a006abb55a5095b299080f036576242
2026-11-07 21:44:47 +00:00
psachdeva-oai 202b590e84 Preserve display instructions in answer moderation (#60172)
## Why

Recovered answer history needs presentation instructions alongside the moderation flag so clients can apply the intended display behavior.

## What changed

- Add optional `display` metadata with an `action` and optional `blockType`, `cyberTrustedAccess`, and `checkTrustedContacts` fields.
- Carry display metadata through final answers, legacy events, thread history reconstruction, and legacy rollout migration.
- Expose the metadata in the app-server protocol and update generated JSON schemas, TypeScript types, and Python SDK models. Missing display fields remain compatible with existing stored moderation data; the app-server emits absent optional values as `null`.

## Testing

Extend the final-answer moderation test to cover display metadata in answer items and legacy events. Add serialization coverage for missing display data, nullable fields, and preservation of an explicit `false` value.

GitOrigin-RevId: b798a2ecc53c2a94c7659ef3d9663b3143b70a1a
2026-11-07 21:31:08 +00:00
Alex Kira 33b3f80a09 Wire incremental exec tool updates into Code Mode sessions (#60163)
## Why

Changes to nested tools should update the model's catalog without repeating the full `functions.exec` declaration or rewriting retained context.

## What changed

Pass structured exec definitions through the tool router into the session's tool world state. Enable granular updates for Responses Lite in `CodeModeOnly` when both `IncrementalTools` and `IncrementalExecTools` are enabled.

Append changed tool definitions, namespace instructions, and removals as developer messages. Keep common exec instructions and shared types frozen until compaction, then install the latest full catalog.

## Testing

Add feature-gating coverage and a scenario snapshot covering tool additions and removals, namespace instruction changes, eager/deferred transitions, re-enabling tools, retained context, and catalog restoration after compaction.

GitOrigin-RevId: bbf850d4e5018388eeb4c09345d885d776962e09
2026-11-07 19:26:20 +00:00
Alex Kira 2bc8e7f545 Add support for incremental code mode tool definitions (#60157)
## What changed

Render stable entries for nested tool definitions and namespace instructions alongside the full `functions.exec` description. Add optional catalog tracking that emits complete replacements for added or changed entries and explicit notices for removed entries, while keeping the existing exec declaration unchanged.

Preserve entry hashes while exec is unavailable, then restore the full catalog and withdraw removed entries when it returns. Keep the existing snapshot format for ordinary tool catalogs.

This change provides the rendering and state support; runtime activation remains disabled.

## Testing

Add tests for definition rendering and namespace identity, batched additions and changes, removal notices, unchanged catalogs, and full catalog restoration after exec is hidden.

GitOrigin-RevId: f472bd3e8e770a8cad9663c72e290abe7d0473be
2026-11-07 18:24:25 +00:00
tongzhou wang 57a808a392 Preserve code mode dispatch errors in rollout traces (#60122)
## Why

Code mode requests can fail before a `CodeCellStarted` event. Suppressing their dispatch traces loses the caller-facing error in that case.

## What changed

Record dispatch lifecycles for code mode custom payloads, preserving their results independently of code cell events.

## Testing

Update the incompatible-payload regression test to use the code mode tool name and verify that replay retains the failed tool call and result payload even when no code cells were recorded.

GitOrigin-RevId: 687a36cd7ba55665ed7abc88c36732597e7fb025
2026-11-07 12:41:14 +00:00
cooper-oai cce9d3228b Use runtime authentication for Analytics requests (#60101)
## What changed

- Honor `RuntimeAgentInstances` and the configured runtime auth mode for Analytics plan discovery and report requests to OpenAI endpoints.
- Share installation ID resolution and Codex runtime registration setup through `codex-runtime-agent-instance`.
- Preserve typed runtime authentication errors so expired credentials retain the “Sign in again to load Analytics” guidance.

## Testing

Add coverage for both runtime auth modes across regional and staging endpoints, fresh assertions for each request, sign-in guidance after bootstrap failure, redirect rejection, and invalid organization/project selectors.

GitOrigin-RevId: 50e0d959b3abd81ebe7a6a584e272f14cf52e504
2026-11-07 10:41:36 +00:00
cooper-oai efdacaf46f Stop retrying terminal runtime authentication denials (#60096)
## Why

Invalid assertions and paused or revoked runtime instances cannot recover through request retries or credential refresh. Permanent refresh-token failures also need to retain their sign-in error instead of becoming retryable stream errors.

## What changed

- Recognize terminal runtime denial codes in `401` and `403` response bodies and identity error headers, preserving HTTP diagnostics while stopping retries.
- Skip credential recovery for runtime denials in runtime-enabled model providers and backend requests, while preserving recovery for ordinary credential expiration.
- Propagate permanent refresh-token failures through runtime authentication as `RefreshTokenFailed` errors.

## Testing

Add coverage for body and header denials, preserved HTTP diagnostics, provider-scoped credential recovery, and cached permanent refresh failures. Complete-turn tests verify that runtime denials stop without retries or refreshes while expired credentials recover in both runtime authentication modes.

GitOrigin-RevId: 33f6f707454130e97e13f3b53e29d2c484602152
2026-11-07 09:48:46 +00:00
rhan-oai c4f0e09912 Allow asynchronous model request budget checks (#60080)
## What changed

Make `ModelRequestContributor::budget_exhausted` return an `ExtensionFuture` and await budget checks before HTTP and WebSocket generation. WebSocket warmup continues to skip budget checks.

If the account changes during the post-connect budget check, rebuild the request setup and reconnect before sending the WebSocket request.

## Testing

Update tests to cover a pending budget check that resolves to exhaustion, warmup connection reuse, and an account switch while the post-connect budget check is awaiting completion.

GitOrigin-RevId: 462c74b86a46a4b2276f901c69187fc7cbc3ff81
2026-11-07 07:45:36 +00:00
rhan-oai f5ac7a757e Support asynchronous host service-tier reads and acceptance (#60075)
## What changed

Make `AgentServiceTier` reads asynchronous and have updates return a receipt for local acceptance. Await acceptance during root startup and settings updates outside state and registry locks, sharing the receipt with explicit same-tier retries.

Await shared-tier reads during child preparation, startup prewarm, and step capture. Allow cancellation while capturing a step, and keep host propagation independent of the acceptance wait.

## Testing

Extend the host-child WebSocket test to cover delayed acceptance, same-tier retries without duplicate updates, accessible settings while acceptance is pending, and tier inheritance during prewarm and subsequent steps.

GitOrigin-RevId: 0e2e1899834c37684e904c4a36e66344a0c6c7f3
2026-11-07 06:51:10 +00:00
cooper-oai d4a341bd52 Reauthenticate runtime requests before reusing WebSocket access (#60055)
## Why

An open WebSocket can remain usable after its runtime is paused. Runtime-authenticated requests need a fresh handshake to revalidate access before submitting more work.

## What changed

- Reconnect before each runtime-authenticated Responses request and skip speculative preconnection. Preserve turn routing when the runtime identity is unchanged.
- Open a fresh connection for each runtime-authenticated Guardian classification instead of prewarming or reusing pooled sockets.
- Preserve HTTP fallback for unsupported upgrades and connection failures, while propagating authentication, authorization, rate-limit, and policy errors.

## Testing

Add regression coverage for pause and unpause behavior, credential changes, fresh assertions, and Guardian HTTP and WebSocket transports in both runtime authentication modes.

GitOrigin-RevId: 9f650147260da5cbbf5bb23dfff0af095fff3955
2026-11-07 04:06:26 +00:00
evanz-oai 44ccf39457 Preserve model catalogs when starting child agents (#60049)
## Why

Child startup can lose remote model capabilities such as `tool_search` when the selected catalog is uninitialized or disk data is older than the parent's in-memory snapshot.

## What changed

- Initialize the final provider, auth, and originator catalog before resolving a child's startup model, then read it from memory.
- Preserve loaded catalogs, including empty responses and updates that failed to persist, without overwriting concurrent refreshes.
- Reuse catalogs across retry and WebSocket transport overrides while retaining routing and header distinctions.

## Testing

Add regression coverage for child tool search with warm, cold, and disabled caches; failed cache writes; concurrent refreshes; empty catalogs; and Guardian reviewer catalog reuse.

GitOrigin-RevId: 01d995a65b623cc7d6f26e2dc9b6e8cf380de782
2026-11-07 03:16:52 +00:00
viyatb-oai b7d2321ef7 Derive MCP network policy and preserve saved denials (#60046)
## Why

Stale saved grants or malformed rules can cause valid network denials to be discarded. A failed rule write can also leave the in-memory policy inconsistent with native enforcement.

## What changed

- Add a helper to derive MCP network policy from controller and environment policies, permission profiles, approval settings, and saved rules. Preserve managed restrictions and conservatively deny traffic that requires review, request hooks, or DNS checks the metadata cannot express.
- Retain valid saved denials when grants violate managed constraints or a rule batch is malformed.
- Serialize runtime updates and persistence, publishing denials before the write so they remain effective if saving fails. Publish saved grants after a successful write.
- Extract validation of listener settings for running proxy updates.

## Testing

Add coverage for policy composition, mixed-executor local binding, native proxy denial parity, stale grants, malformed denials, failed persistence, and compatibility with trusted MCP servers without policy negotiation support.

GitOrigin-RevId: ef00632acb48a51fc582f18d20a3e713f953a191
2026-11-07 03:06:33 +00:00
viyatb-oai a90c808408 Centralize Windows sandbox filesystem override resolution (#60042)
Add `WindowsSandboxFilesystemOverrides::resolve` to select the elevated or
restricted-token resolver, and use it in core, exec-server, and direct-spawn
sandbox preparation. Pass the child environment through to the elevated
resolver.

Replace the exported unsupported-sandbox reason helper with a test-local
wrapper around the shared resolver.

GitOrigin-RevId: f1d404356a4f680ce81123bc8284508f27d4d6ab
2026-11-07 02:46:41 +00:00
Eric Traut 11ca3f7531 Require explicit project trust in non-interactive runs (#60041)
## What changed

Keep untrusted project configuration and MCP servers disabled in exec runs, even with `--sandbox workspace-write`, and warn when project configuration is disabled.

Add `--trust` to `codex exec` and `codex review` to save project trust for the current and future chats, including MCP commands outside the sandbox. The grant persists with `--ephemeral`, refuses explicitly untrusted projects, and cannot be combined with `--ignore-user-config`.

Pass the working directory as a configuration default so embedded server startup does not implicitly grant trust. Preserve the selected `--oss` provider across configuration reloads.

## Testing

Extend CLI parsing and MCP integration coverage for explicit trust, persistence across ephemeral runs, disabled project configuration with write access, and rejection of conflicting or explicitly untrusted settings.

GitOrigin-RevId: b57f4f8829f98d77c5487fa8405c7f29b5d70d0c
2026-11-07 02:39:03 +00:00
Alex Kira 762f87d5bb Restrict legacy incremental tools to Amazon Bedrock providers (#60040)
## What changed

Gate `incremental_tools_legacy` on the `amazon-bedrock` and
`amazon-bedrock-runtime` provider IDs instead of the OpenAI provider for regular
Responses requests. Responses Lite continues to use `incremental_tools`.

## Testing

Expand the tool catalog update scenarios to cover both Bedrock provider IDs with
legacy incremental tools enabled and disabled. Update the regular Responses tool
removal scenario to use the Bedrock provider.

GitOrigin-RevId: ad0ff31975166a2a7fdcee6fefc272ecc79dd448
2026-11-07 02:37:50 +00:00
Charlie Marsh af9a98b074 Add opt-in lazy startup for cached stdio MCP servers (#60039)
## Why

Regular chats start MCP servers eagerly even when cached tool definitions are available and the servers go unused. Allow those chats to use the cached catalog and defer eligible stdio servers until first use.

## What changed

- Add the disabled-by-default `mcp_lazy_stdio_startup` feature and expose it through experimental feature configuration.
- Defer cached stdio servers in regular chats when enabled, while keeping servers that require a live startup connection eager. Required servers with `startup_readiness = "catalog"` may defer; explicit reconnects remain eager.
- Announce the full eager startup batch before terminal statuses and exclude dormant servers from the initial startup summary. Update TUI tracking so deferred servers can report startup independently in later rounds.

## Testing

Add scenario coverage for a cached server staying dormant during unrelated work, starting on first use, and refreshing tool definitions and visibility. Cover required live startup, eager event ordering, experimental feature configuration, and TUI status handling.

GitOrigin-RevId: 74075fcd4f26c8c79b5901b6a8cb03fdb9e35a7f
2026-11-07 02:28:44 +00:00
Charlie Marsh fb2b06a829 Surface MCP server startup errors when preparing cached tool calls (#60038)
## Why

A cached MCP tool can remain advertised after its server fails to start. Calling it previously returned a generic unavailable-tool error, hiding the startup failure from the model.

## What changed

Propagate preparation errors through MCP tool calls and recorded approval preparation, preserving the error chain and adding the server name to startup failures. Keep the unavailable-tool error for tools that are missing, filtered, or no longer visible to the model.

## Testing

Update the executor capability downgrade test to require the credential resolution startup error in the model's tool output and assert that the host token is absent.

GitOrigin-RevId: 434074eb748165b2fe19de3a40046835f26992df
2026-11-07 02:28:22 +00:00
Eric Traut 738ef9f3bb Omit sensitive process inputs from spawn trace logs (#60034)
## Why

Command arguments and environment variables can contain credentials. Logging them when spawning a child process can expose those credentials in trace output.

## What changed

Replace argument, `arg0`, and environment contents in `spawn_child_async` trace logs with argument and environment counts and a flag indicating whether `arg0` is overridden. Keep the program, working directory, network sandbox policy, and stdio policy in the trace.

## Testing

Add a regression test that captures trace output and verifies that argument, `arg0`, and environment canaries are omitted while the program path remains visible.

GitOrigin-RevId: c317e7dcc6fd8b4eafb6fcfe98dc8634807c813d
2026-11-07 02:01:23 +00:00
cooper-oai 10cf2b9ea2 Honor managed runtime authentication modes and expand coverage (#60014)
## What changed

Allow `requirements.toml` to pin `features.runtime_agent_instances.mode` to `dual_header` or `assertion_only`. Apply the required mode when no explicit mode is configured and reject conflicting explicit settings, while preserving legacy boolean requirements.

Document experimental runtime authentication configuration, credential lifecycle, and bootstrap authentication behavior.

## Testing

Add coverage for managed mode defaults and conflicts, runtime reuse and rotation across account requests and restarts, fresh assertions on Realtime and MCP reconnects, and Realtime destination and environment restrictions.

GitOrigin-RevId: bcf9502178f477c1e8232386f1f3e360bf23d667
2026-11-07 00:18:36 +00:00
rhan-oai e0aa0434f4 Adapt multi-agent mode guidance for hosted tools (#60011)
## What changed

- When `multi_agent_v2.disable_native_tools` is enabled, use bundled mode policies instead of model catalog guidance, while preserving explicitly configured mode hints.
- Refer to multi-agent tools and instruct the model to read the full multi-agent skill before calling them. Keep proactive delegation enabled for `Ultra` reasoning and explicit-request-only delegation for other reasoning levels.
- Reset retained nonempty custom mode hints to explicit-request-only guidance when multi-agent support is disabled, including after a cold resume.

## Testing

Extend integration tests and request snapshots to cover hosted-tool guidance, configured hint precedence, proactive mode with `Ultra` reasoning, and the mode reset after a cold resume.

GitOrigin-RevId: 403791ef76f990e385d9c155d9c2edc9acfcd4fe
2026-11-06 23:50:54 +00:00
Dmitriy Kovalenko a5a00d6c73 Add a shared Windows Bazel setup action (#60010)
## What changed

Add `.github/actions/setup-bazel-windows` to prepare MSVC, derive the Bazel Windows path, download the pinned Cygwin snapshot, and run the existing verified Windows dependency bootstrap. Export the Windows system root and host architecture for subsequent steps.

Use the action in the Bazel workflow and argument-comment lint action. Remove an unused `EnvironmentAttachment` import from the session tests.

GitOrigin-RevId: 8dc711dc9301bb44d49be3fdab79bd4ca981b7d0
2026-11-06 23:48:38 +00:00
cooper-oai 44f1b0e867 Apply runtime authentication to realtime connections (#60003)
## Why

Realtime connections bypassed runtime authentication and reused captured authentication headers for sideband handshakes. They need to honor the selected credential source and its transport policy across call creation, retries, and reconnects.

## What changed

- Use runtime authentication for realtime WebSocket connections, WebRTC call creation, and sideband attachment when enabled for supported OpenAI destinations.
- Resolve authentication on every WebSocket handshake, preserving credential ownership and request scope while generating fresh assertions. Reject authentication failures without falling back to bearer authentication.
- Keep call creation and sideband attachment bound to the selected credentials and account network policy, including when inference uses a different provider.
- Avoid runtime initialization for local marketplace and MCP operations, plugin commands that do not use the remote catalog, and model debugging with a configured catalog.

## Testing

Add coverage for fresh handshake credentials on retries and reconnects, credential and account changes, runtime authentication modes, destination validation, and registration failures.

GitOrigin-RevId: 57e53122912fa78a524427b0f51013f76f9f7681
2026-11-06 22:27:23 +00:00
fahad-OAI 8fcabd75a0 Preserve app invocation context across MCP tool refreshes (#59991)
## What changed

Keep the advertised `_codex_apps.invocation_context` when an app's tool metadata refreshes on the same server connection, while using refreshed values for other metadata. If the invocation context changes on a different connection, skip the call as unavailable.

## Testing

Extend the code-mode compaction test to refresh app tools before resuming a cell and verify that calls retain the original invocation context while picking up the refreshed `resource_uri`.

GitOrigin-RevId: 1b6072faed74623994ea82035a6ed977451984a4
2026-11-06 21:53:04 +00:00
Sean Huang cf39544acd Resolve startup models using thread creation options (#59987)
## What changed

Replace `ThreadManager::models_manager_for_startup` with `resolve_startup_model`, which accepts `StartThreadOptions` and returns the selected `ModelInfo` before starting or cold-resuming a thread.

Share model resolution and effective session source selection with thread startup so the lookup honors the same catalog, configuration overrides, and provider fallback setting.

## Testing

Update coverage to compare startup model information with the started thread's selected model, including provider catalog defaults and context window overrides. Add coverage for provider fallback being enabled and disabled.

GitOrigin-RevId: 57040c4afeacc47c7596832271898577a3584c89
2026-11-06 21:34:25 +00:00
ioanbudea-OAI 2889d8e1bf Normalize turn context permissions to a required profile (#59963)
## What changed

Make `TurnContextItem.permission_profile` required and remove its legacy `sandbox_policy` and `file_system_sandbox_policy` fields. Normalize older histories into a permission profile during deserialization, preserving the restrictive fallback for malformed filesystem rules.

Keep legacy compatibility fields in rollout serialization so older readers remain usable. Update turn recording, metadata extraction, and permission checks to consume the profile directly.

## Testing

Add coverage for legacy normalization, profile-only serialization, missing permissions, and malformed filesystem rules. Extend rollout round-trip fixtures to cover deny rules and filesystem roots from another platform.

GitOrigin-RevId: 27515fec60cccbac5806b98fb71f54e311a09701
2026-11-06 19:29:06 +00:00
jif 4e688da437 Skip the network denial grace period when remote decisions drain (#59960)
## Why

Completed remote commands wait up to 100 ms for late network denials even when all execution-owned network decision callbacks and requests have finished.

## What changed

Allow deferred network approval cleanup to finish as soon as an executor-owned remote proxy's decisions drain. Retain the grace period when a shared listener could still report an untagged denial, including when that listener starts during the command. Always register the blocked-request observer when starting the session proxy.

## Testing

Extend the paused-time regression test to cover immediate completion after remote callbacks drain and propagation of a late denial from a newly registered shared listener.

GitOrigin-RevId: 41bda6504f6d97d5626beba58cf30fb4a9a2dbdd
2026-11-06 19:18:02 +00:00
Sean Huang 12dc86beb3 Expose model metadata from each thread's catalog and settings (#59958)
## What changed

- Add `ThreadManager::models_manager_for_startup` to obtain the model catalog used when starting or cold-resuming a root thread, including its effective originator.
- Add `CodexThread::selected_model_info` to resolve the model for future turns using the thread's current settings, catalog, and model overrides.
- Share catalog selection logic between startup lookup and thread creation.

## Testing

Add coverage verifying that startup and thread lookups use the thread-specific catalog, preserve the configured context window, and reflect model selection updates.

GitOrigin-RevId: d7976caebb7459e1e9ca55f3c6f6bb2af92cf3de
2026-11-06 19:16:53 +00:00
ioanbudea-OAI c1c07853fe Use permission profiles for protected-model startup downgrades (#59933)
## What changed

Check the effective permission profile directly when applying startup restrictions for models that require automatic review, instead of converting it to a legacy sandbox policy.

Preserve the downgrade to `workspace-write` for profiles with full disk write access and enabled network access, excluding external enforcement and writable paths that cannot be converted to local paths. Share writable-path conversion with the legacy sandbox adapter.

## Testing

Add startup regression coverage for profiles that are downgraded, preserved, or rejected, including read-only carveouts and writable paths that cannot be converted locally. Verify restored permissions, automatic review selection, and workspace settings.

GitOrigin-RevId: 256c949f23d84dfba185a45a01b638ff5f1df52e
2026-11-06 16:00:54 +00:00
jif 2210380232 Resolve Guardian policy from the reviewed thread's catalog (#59913)
## Why

Async classification could use policy from the manager's startup catalog even when the reviewed thread had a different reviewer policy.

## What changed

Share reviewer resolution between synchronous review and async classification, using the thread's catalog and reviewer eligibility rules. Select reviewer metadata from the same catalog snapshot, filter out models unsupported by API authentication, and preserve captured parent metadata when no eligible default reviewer exists.

## Testing

Update the async classification regression test with distinct thread and manager catalog policies, asserting that the thread reviewer's policy appears in classifier instructions.

GitOrigin-RevId: 0b28644d30bda42d2cf1bd8a31de2e8f8d38e1a6
2026-11-06 13:44:03 +00:00
jif ad1dbba32d Scope file change approval cancellation to the requesting turn (#59910)
## Why

A delayed file change approval cancellation could interrupt a later turn, even when the original approval was no longer pending.

## What changed

Send `Op::CancelPatchApproval` with the approval ID and requesting turn ID from the app server. Resolve cancellations only for a matching pending approval and interrupt its requesting turn only if it is still active. Route legacy `Op::PatchApproval` abort decisions through the same pending-approval handling.

## Testing

Add a regression test that cancels an approval, then replays that cancellation while a second turn has a pending approval with the same call ID. Verify that the second approval succeeds and its turn remains active.

GitOrigin-RevId: 4c833ccd0f33c2df4e9dfb25e2729ab19b6c879f
2026-11-06 13:21:43 +00:00
jif bbf57cec15 Avoid full image decoding for original-detail context estimates (#59908)
Read inline image dimensions with `ImageReader::into_dimensions` instead of
loading the full image into memory. Keep the existing patch-based estimate
and fallback when dimensions cannot be read.

GitOrigin-RevId: fd45eb748ce03134261c867397e1fe46c6023f2d
2026-11-06 13:18:18 +00:00
jif f49ae52079 Recompute the approval reviewer when switching models (#59893)
## Why

Switching away from a model that requires automatic review should restore the user's requested approval reviewer instead of retaining the model's enforced reviewer.

## What changed

Recompute the reviewer from the requested preference and model requirements when the model changes without an explicit reviewer update, unless the session uses a trusted guardian reviewer. Preserve an explicit automatic-review preference across subsequent model switches.

## Testing

Extend the app-server settings regression test to cover restoring user review after leaving a protected model and retaining an explicit automatic-review choice across repeated model switches.

GitOrigin-RevId: a5672d1ebe94c2fac201ad460b4789d11df03b1a
2026-11-06 12:04:44 +00:00
psachdeva-oai ddd1812a51 Carry targeted moderation decisions on final-answer messages (#59842)
## What changed

Read `final_answer_moderation` metadata and attach `moderation: { moderated: boolean }` to the completed final-answer message only when its item ID matches. Apply this in both normal and plan modes, and reset the pending decision when a new response starts.

Preserve the answer's native item ID and moderation flag through legacy events and history reconstruction. Combine text parts into one legacy event when a moderation decision is present.

Expose nullable moderation data on app-server agent messages and update the JSON schemas, TypeScript types, and Python models.

## Testing

Add an integration test for moderation on completed answers and their legacy events. Extend protocol conversion tests to cover populated moderation data and serialization as `null` when absent.

GitOrigin-RevId: f286b67731a84b3daf5d10b7644f2e31b62f0e53
2026-11-06 07:43:44 +00:00