Commit Graph
12450 Commits
Author SHA1 Message Date
Charlie Marsh 57d4fac64a Avoid redundant clones when sending app-server notifications (#55723)
## Why

Targeted notification delivery and broadcast routing clone the message for every recipient, then discard the original.

## What changed

Use `std::iter::repeat_n` to move the original message to the last recipient, avoiding one clone per nonempty recipient list while preserving delivery behavior.

## Testing

Expand notification tests to cover empty, single, and multiple recipient lists, checking payloads, target order, and shared timestamps. Add broadcast coverage for zero, one, and two eligible recipients, verifying that uninitialized clients, clients without the required experimental API support, and clients that opted out are skipped.

GitOrigin-RevId: 2ba192f416ccd786e3566da3e5c851518b509afe
2026-10-21 01:49:26 +00:00
viyatb-oai db58a987b8 Allow unified exec to fall back when credential masking is unavailable (#55719)
## Why

Disabled or failed protected shell snapshots prevent commands from running when credential masking is enabled.

## What changed

Restore unmasked credentials and continue execution when a protected shell snapshot is unavailable. Log and emit a warning explaining that the command will run with unmasked credentials.

## Testing

Extend `brokered_shell_snapshot_fallback` coverage for disabled and failed snapshots, including managed feature settings. Verify the warning, successful execution with restored credentials, continued filesystem sandbox and network policy enforcement, and masking recovery after snapshot storage is repaired.

GitOrigin-RevId: 28561e571b2a043d0b6cfa248c9ba2a61dd558ba
2026-10-21 01:30:29 +00:00
cassirer-openai 3f31c0a040 Resolve MCP backend identity from runtime events in rollout traces (#55710)
## Why

MCP callable namespaces and tool names can differ from their backend identities or match built-in tool names. Classifying calls by name can misidentify MCP calls and incorrectly parse namespaced `write_stdin` calls as terminal operations.

## What changed

Resolve `ToolCallKind::Mcp` from the runtime invocation's server and tool as soon as the runtime starts, before MCP correlation assignment. Preserve the caller-facing summary and raw invocation, and skip built-in runtime handling for MCP calls.

Only create dispatch-based `write_stdin` terminal operations for calls without a namespace.

## Testing

Add replay regression coverage for prefixed and unprefixed MCP aliases, names that match built-in tools, and `write_stdin` arguments with and without a session ID. Verify backend classification, preserved callable identity and dispatch lifecycle, and the absence of terminal operations and sessions.

GitOrigin-RevId: 71f31335c1eb36b6b7e1a34383d10fc500bd2c4f
2026-10-21 00:53:48 +00:00
Anthony Tafoya b48277327d Centralize cloud skill cache state under the catalog lock (#55705)
## What changed

Move cached cloud skill contents into `SkillCatalogState` alongside the published catalog generation. Prepare auth scopes and access cached contents under the same lock, clearing contents when the auth scope changes and retaining them when a partial refresh preserves a complete catalog. Keep generation checks around asynchronous discovery and reads.

Use the auth key already captured by `prepare_cloud_generation` when creating a cloud plugin generation, so the stored and returned keys match.

GitOrigin-RevId: 426bb7868baf9ff7855988291783a8d3e38d9c93
2026-10-21 00:00:06 +00:00
Matthew Zeng 35757adb72 Enable MCP OAuth refresh coordination by default (#55701)
## What changed

Mark `mcp_oauth_refresh_coordination` as stable and enable it by default.

GitOrigin-RevId: f82074c7d148808ceeb4acd206bbadefd470e5b1
2026-10-20 23:42:20 +00:00
jif 6b13dffc5e Reuse Codex account grants for enterprise MCP authentication (#55698)
## What changed

- Prefer stored enterprise credentials when available; otherwise use a validated Codex account OAuth grant whose issuer matches the enterprise MCP configuration.
- Pin each connection to its credential source and OAuth client, reject stale account grants, and hold the account refresh lease only during the IdP exchange.
- Report actionable sign-in and issuer configuration errors, and classify token failures by credential source.

GitOrigin-RevId: 26673f276a31e4ca5290f6b120f0ac44c77d7239
2026-10-20 23:27:33 +00:00
jif feadd9441e Preserve enterprise MCP authorization across runtime refreshes (#55696)
## Why

Configuration reloads must cancel stale enterprise MCP startups while preserving access for running threads that still pass validation. Replacing a runtime during `thread/revert` must also leave the replacement able to use enterprise tools.

## What changed

- Separate pending startup cancellation from published thread lifetimes, with independent startup state for forks and replacement runtimes.
- Retain eligible enterprise MCP connections across refreshes and explicit reconnects while applying updated tool restrictions and approvals. Do not create replacement enterprise connections after initial startup.
- Revoke enterprise authorization when a thread is removed, drain requests when access is disabled, and revoke a connection's authority when token renewal requires authentication.

## Testing

Extend regression coverage to verify enterprise tool calls survive `thread/revert`, inherited fork configurations are cancelled after a reload, and enterprise calls fail after logout while ordinary MCP calls remain available.

GitOrigin-RevId: 2d634be3011854b57f73c741bd1ec6b5aed94ee5
2026-10-20 23:03:56 +00:00
Dmitriy Kovalenko 6fb1c3903d Use hermetic dsymutil for macOS Bazel builds (#55693)
## What changed

- Add a `dsymutil` wrapper that delegates to the C toolchain's `LLVM_DSYMUTIL`, and include it in macOS Rust binary compile inputs and `PATH` so `rustc` can find it by name.
- Build macOS release staging archives with `--config=ci-macos`, `--remote_download_toplevel`, and `--build_metadata=VISIBILITY=PRIVATE`.

GitOrigin-RevId: 0f46520807dd9804049b6ae18351275af3693907
2026-10-20 22:39:53 +00:00
Alex Kira d4e03acb61 Tag tool registration metrics with effective incremental tools mode (#55692)
## What changed

Add an `incremental_tools` attribute to `codex.tools.registered` using the effective mode for the current sampling request. Compute the mode once and reuse it for registration metrics and prompt construction across transport retries.

## Testing

Extend integration tests to verify the attribute for incremental and non-incremental requests, including when the feature flag is enabled but the Responses API does not support incremental tools. Assert registration sample counts and retain coverage that stream retries do not duplicate registration metrics.

GitOrigin-RevId: e5b7a1075fe722ef6bdf900ae07e2b1b06aecfb5
2026-10-20 22:34:40 +00:00
jif ec8edd576c Refine enterprise MCP auth errors and request authority checks (#55691)
## What changed

- Classify token-source failures by credential kind and exchange stage, with sign-in or administrator guidance that omits provider error text. Treat resource authorization failures separately from enterprise identity failures when deciding whether authentication is required.
- Add policy-bound request authority checks that return `RequestNotSent` when policy is updating or unavailable, while allowing admitted responses to finish. Support child authorities that isolate connection revocation and share response draining.
- Recheck account validity after acquiring the credential invalidation lock and check cancellation before deleting a rejected credential.

## Testing

Extend regression coverage for policy suspension during token renewal, completion of admitted requests, recovery with fresh authority, and transport retry classification. Expand provider-error tests to cover `unauthorized_client` and `invalid_client` while checking that credential text is not exposed.

GitOrigin-RevId: c0097adc35cb5fdffde1466e4bc2b5ec78114a4b
2026-10-20 22:33:14 +00:00
Dmitriy Kovalenko 75c78768d2 Reclaim aged legacy marketplace staging directories (#55690)
## Why

Legacy marketplace checkouts have no owner lock and were skipped by staging cleanup. Age thresholds allow cleanup to reclaim them while leaving recent clones from older binaries alone.

## What changed

Remove legacy `marketplace-add-` directories after 24 hours and `marketplace-upgrade-` directories after 10 minutes, based on directory modification time. Keep owner locks authoritative for current staging directories.

## Testing

Extend cleanup tests to cover both legacy age thresholds, preservation of recent legacy clones and live locked checkouts, and skipping legacy symlinks.

GitOrigin-RevId: 77b55bfe50ab29f5ceae46a80276b2c9e361107f
2026-10-20 22:27:04 +00:00
Dmitriy Kovalenko 69727ae170 Clean up failed and abandoned marketplace staging directories (#55689)
## Why

Failed marketplace adds can leave temporary checkouts behind, and interrupted adds or upgrades can leave abandoned staging directories.

## What changed

- Share a staging guard across marketplace adds and upgrades so temporary checkouts are removed on completion or failure, including config-write rollback.
- Reclaim up to four abandoned directories per cleanup pass during add and upgrade operations. Use file locks to preserve active checkouts and operating-system-specific names to avoid reclaiming another platform's staging directories.
- Skip symlinks and unrelated entries, and report cleanup failures as warnings.

## Testing

Add regression coverage for failed adds, CLI and automatic-upgrade cleanup, cross-process ownership and abandonment, lock contention, bounded cleanup, and symlink handling.

GitOrigin-RevId: 20999da0eab861dfb8025aad5e9fba2bcaf818b8
2026-10-20 22:25:54 +00:00
jif 36512a34ff Add account credential support to EMA token exchange helpers (#55685)
## What changed

- Add an account IdP identity resolver that checks ID-token bindings against trusted issuer and client provenance before discovering the refresh-token endpoint. An expired ID token does not by itself invalidate the refresh grant.
- Generalize `EmaIdpIdentity` and token exchange requests to carry caller-owned credential leases. Invoke a `finish_idp` callback after the IdP exchange and before resource authorization server I/O so callers can release their refresh guards at that boundary.
- Reject empty expected OIDC issuers and client IDs, and expose an unverified issuer hint solely for explaining legacy login migration.

GitOrigin-RevId: 34473fed82a9a6e58997664cd5e6e67049b5ee7e
2026-10-20 22:00:42 +00:00
Eric Traut 7389eebf45 Fix TUI permission selection and session state handling (#55682)
## Why

Queued prompts can resume before a pending permissions menu opens, and local
`/permissions` commands can bypass guards for outstanding permission changes.
Attaching to a different project can also retain model access information from
the launch directory.

## What changed

- Route `/permissions` through app permission guards and hold queued prompts
  while the menu is pending. Settle the hold when opening is rejected, discovery
  is invalidated, or a covering request is resolved.
- Apply the custom permission profile selection check beyond embedded servers.
- Refresh API-key model access when the first attached session changes the
  working directory, including with an embedded server. Propagate the widget's
  model catalog to the app and server even when the model response matches the
  widget's already-updated catalog.
- Skip sessions reported as `thread not loaded` during name lookup for all
  server types instead of falling back to unverified list metadata.

## Testing

Add regression coverage for permission guards, queued prompts across successive
permission menus, invalidated and covered menus, model catalog propagation,
project changes on initial attachment, and name lookup across server pages with
unreadable entries.

GitOrigin-RevId: eb49cb5268ce0ce1e40009b73a0180f23e61ed72
2026-10-20 21:40:30 +00:00
jif 2623f206bd Recheck account login ownership for enterprise MCP (#55680)
## Why

A persisted login replacement can leave the auth cache holding the previous login, even for the same account. Enterprise MCP authorization must detect that replacement before continuing to use enterprise credentials.

## What changed

- Check cached and persisted account login ownership before enterprise MCP connections and around token exchanges, revoking authorization when ownership changes.
- Recheck account ownership and login generation before committing enterprise sign-in credentials.
- Compare complete token data when checking whether an account OAuth grant is still current, and expose grant token access and credential comparison helpers.

## Testing

Add regression coverage for detecting a same-account login replacement without updating cached auth, rejecting enterprise MCP use after replacement, and keeping ordinary MCP usable while an enterprise account storage read is blocked.

GitOrigin-RevId: 6303f88a9cbcc84c99e453dc281b23d66930f518
2026-10-20 21:34:24 +00:00
Dmitriy Kovalenko ef1604d8f5 Upgrade the Rust toolchain to 1.99.1 (#55677)
## What changed

- Update Cargo and Bazel toolchain pins, CI and release workflows, and Windows setup from Rust `1.95.0` to `1.99.1`.
- Adapt Rust code to updated APIs and lint requirements, including `try_update` and `as_chunks`, and refresh the halfwidth sound marks snapshot.
- Update `webpki-root-certs` from `1.0.5` to `1.0.10` in the Cargo and Bazel lockfiles.

GitOrigin-RevId: e1aaed63b7e72bb8c8bbe25b32c6329c9a37b6c3
2026-10-20 21:28:45 +00:00
thomas c465563aa9 Enable app routing for remote curated Agent Plugins (#55667)
## Why

Agent Plugin manifests previously skipped app declarations, including service-generated declarations installed with remote curated plugins. This prevented those plugins from using app routing and suppressing matching direct MCP connections.

## What changed

- Recognize app declarations for Agent Plugins from `openai-curated-remote` across loading, capability summaries, plugin details, tool suggestions, and install authentication.
- Apply app routing to suppress same-name MCP servers when an app route is available. Keep unrelated MCP servers available and preserve direct MCP access in API-key mode.
- Keep app declarations inactive for Agent Plugins from other marketplaces.

## Testing

Add coverage for marketplace and authentication routing, service-generated app declarations during installation with both manifest formats, and app tools reaching turns. Verify that disabling Apps does not restore matching direct MCP connections.

GitOrigin-RevId: 791739569f0e01c898040bc2d028cf517f767e00
2026-10-20 20:27:32 +00:00
swastik-oai 2f5e242d9f Omit reasoning and compaction from Decisions snapshot comparisons (#55666)
## Why

Decisions snapshot comparisons reject requests containing reasoning or compaction, while conversation comparisons already omit those items. A parent compaction also causes snapshot comparisons to be rejected.

## What changed

- Share filtering of reasoning, compaction, and context compaction across both comparison modes, and ignore parent compaction when building the Decisions request.
- Distinguish malformed request setup from unsupported input items. Record setup errors as failures and unsupported input items as skipped comparisons.

## Testing

Extend the HTTP contract test to cover both comparison modes with reasoning, compaction, context compaction, and parent compaction while preserving message content. Update assertions for the distinct setup and unsupported-input errors.

GitOrigin-RevId: e3ba0cce3b6457b3e3eab3589352b70288cbb1ef
2026-10-20 20:21:14 +00:00
Ruslan Nigmatullin 66d0de9983 Add lifecycle hooks for inter-agent messages (#55657)
## What changed

Add `MessageLifecycleContributor` hooks to capture extension state when local agent control publishes a message and notify contributors when the recipient commits it to history, before sampling.

Carry shared delivery state through submissions, input queues, and mailbox eviction with `PendingAgentMessage`. Notify consumption at most once per delivery, release captured state when consumed or abandoned, and drop pending mail outside queue locks. Preserve the serialized message format without republishing restored history.

## Testing

Extend the mailbox eviction test to verify that publication state survives eviction and retained messages are consumed before the first resumed model sample.

GitOrigin-RevId: 9a1f6832bd48ec646a3fd179485c095e8dcc72cc
2026-10-20 19:39:43 +00:00
Ruslan Nigmatullin 87f3c3284e Track code-mode cell lifecycle and result buffering time (#55653)
## What changed

- Add `CodeModeCellTiming` notifications for yielded executions, terminal waits, and unavailable cells, with thread, call, and cell identifiers.
- Measure how long completed results remain buffered before retrieval and carry `result_buffered_for` through the runtime, stdio protocol, and gRPC response metadata. Immediate delivery reports zero; waits without a completed result report no buffering measurement.
- Default missing buffering data to zero for compatibility with older hosts.

## Testing

Extend runtime tests to verify buffering duration with a paused clock and retrieval through termination. Add gRPC conversion tests for nanosecond precision, optional metadata, and the distinction between immediate delivery and no completed result.

GitOrigin-RevId: 60c0c5a3affa69ac3779bf1812fca50f5748af76
2026-10-20 18:53:06 +00:00
Dan Gillespie 801bd4d773 Search compressed rollouts concurrently (#55652)
## What changed

Collect compressed rollout paths and scan them in up to four concurrent batches, reusing compiled search patterns within each batch. Preserve match snippets, plain rollout path keys, and per-file error handling.

## Testing

Extend the regression test to verify matches across seven compressed rollouts while skipping a corrupt file, and retain coverage for oversized search patterns and missing files.

GitOrigin-RevId: 522403654ab8577499f8f8043ccc017590c4833e
2026-10-20 18:40:33 +00:00
jif c6e4438a5d Guard auth persistence and reloads against concurrent login changes (#55646)
## Why

An in-flight token refresh or auth reload can outlive a login change or logout. Its result must not overwrite credentials for a different login or restore stale cached auth.

## What changed

- Serialize in-process auth storage reads and writes that participate in credential updates.
- Verify the stored login before persisting refreshed tokens or agent identity records, while allowing older clients to drop login metadata when the refresh token still matches.
- Reject stale auth reload results using generation checks, and invalidate pending reads on logout even when the cache is already empty.
- Keep account grant reads strict when the keyring is unavailable, while preserving ordinary auth fallback behavior.

## Testing

Add regression coverage for stale reloads after logout, login replacement during refresh, legacy metadata loss, keyring recovery with rotated tokens, and refresh persistence failures.

GitOrigin-RevId: 01bce9ddbc3101de868adcda3370fcdc4eb70163
2026-10-20 18:03:21 +00:00
jif 98f92bd0b5 Fix in-process app-server shutdown with full queues (#55645)
## Why

When unread events block notification delivery and the client request queue is full, shutdown can hang waiting to enqueue its shutdown message before reaching its timeouts.

## What changed

Drop the event receiver at the start of `InProcessClientHandle::shutdown` to unblock notification delivery before waiting for space in the request queue.

## Testing

Add a regression test that fills both queues with real requests and notifications, then verifies shutdown completes within the configured timeout budget.

GitOrigin-RevId: a2b01042fc81dd2df4affca1d6cf2ddfb64b39db
2026-10-20 17:57:12 +00:00
jif 305db3808c Make pending injections interrupt agent waits and sleep (#55644)
## Why

Input injected before `wait_agent` or `clock.sleep` begins must still interrupt the wait and reach the next model request.

## What changed

Track notifying response-item injections as pending steering activity. Reset that state when pending input is consumed or cleared so later passive context does not interrupt waits.

## Testing

Extend wait and sleep tests to cover injections queued before the wait and delivered while waiting, alongside user steering. Add queue coverage for pending injection detection and reset after consumption.

GitOrigin-RevId: 90f8d968336082c76271d1ca4f81b855bafc72c6
2026-10-20 17:56:07 +00:00
cooper-oai cb00a67569 Add runtime assertion authentication modes and an auth provider (#55636)
## What changed

Add `RuntimeAuthProvider` to resolve request authentication through the runtime auth manager. Support `dual_header` mode, which sends a bearer credential alongside `x-openai-agent-assertion`, and `assertion_only` mode, which uses `Authorization: AgentAssertion …`.

Replace stale authentication headers and sign a fresh assertion for each request attempt. Propagate registration failures without falling back to credential-only authentication, preserving policy errors and classifying transport failures, rate limits, and server errors as transient.

Add the disabled-by-default `features.runtime_agent_instances` configuration with independent `enabled` and `mode` settings, schema support, and structured override merging. Selecting a mode alone does not enable the feature.

## Testing

Add coverage for both modes with API key and ChatGPT credentials, stale header replacement, fresh assertions, credential refresh without runtime replacement, registration failures, and configuration parsing and merging.

GitOrigin-RevId: 9e93d25762600f0ff592c5248fe4c8c2c8182c8d
2026-10-20 17:29:40 +00:00
swastik-oai a13ab7e4ed Enable Decisions comparisons for Guardian V2 conversation mode (#55635)
## Why

Guardian V2 previously skipped optional Decisions comparisons in conversation mode as unsupported evidence.

## What changed

- Start comparisons from the prepared conversation input, including retained history or rebuilt evidence after a history reset.
- Extract the classifier rubric and preserve evidence message roles, content order, and boundaries. Omit retained reasoning and compaction items while continuing to reject other unsupported evidence.
- Measure baseline sampling through the usable score, before history draining and commit, and report skipped comparisons when preparation fails or the request is superseded.

## Testing

Extend coverage to both classifier modes for comparison disagreements, failures, and disabled or uninitialized comparisons without changing baseline scores. Verify conversation evidence across history reuse and resets, malformed input rejection, and budget failures before either backend sends a request.

GitOrigin-RevId: ce32cf876d15d3b82e0b83ac02c33447e7724a51
2026-10-20 17:21:31 +00:00
Henry Levy 7a152fbcf9 Treat code-mode collaboration messages as plaintext (#55633)
## What changed

Classify messages from code-mode collaboration calls as `AgentMessage::Plaintext` so they receive the context wrapper for plaintext messages. Apply this to `spawn_agent`, `send_message`, and `followup_task`.

## Testing

Add a regression test that spawns an agent through `exec` and verifies that the child receives the task as plaintext with sender and recipient attribution.

GitOrigin-RevId: 495c70ea13fd2bb06989e5aacab60beed0c19a56
2026-10-20 17:15:35 +00:00
Francis Chalissery e776b27eb0 Add frozen cloud skill snapshots to the app server (#55631)
## What changed

- Add `--cloud-skills-snapshot PATH` to load a cloud skill catalog and resource contents from JSON once at app-server startup, without contacting a live skill service.
- Expose snapshot skills through the native `skills.list` and `skills.read` interface, preserving aliases and prompt visibility. Reads remain available after the snapshot file is removed.
- Validate package boundaries, required resources, duplicate packages, and size limits; fail startup for missing or invalid snapshots.
- Keep frozen cloud catalog and read caches independent of live MCP resource changes.

## Testing

Add provider, cache, app-server, and core scenario tests covering validation, exact resource contents, authority boundaries, startup failures, and listing and reading frozen skills alongside a named executor.

GitOrigin-RevId: d438a5d678121db3e17515fc5edcd00d4e20b900
2026-10-20 17:01:52 +00:00
ben zhang 48b6a9d8e0 Reserve a sibling rollout candidate slot for the first ancestor (#55627)
## Why

Sibling rollout prefetching returns no paths when its candidate set omits the first ancestor. With more than 64 sibling rollouts, the candidate limit could exclude that ancestor and prevent prefetching.

## What changed

Pass the first ancestor ID into candidate collection and reserve the final slot for it until it is found, preserving the 64-candidate limit.

## Testing

Add a regression test that creates more siblings than the candidate limit and verifies that an otherwise omitted ancestor is included when prioritized.

GitOrigin-RevId: 130508dfb1a190af68ccf1911c7501617be79a00
2026-10-20 16:40:36 +00:00
swastik-oai aa081afb1b Refactor Guardian v2 Decisions snapshot comparison (#55623)
## What changed

- Rename the snapshot comparison entry point to `start_snapshot_comparison` and extract request spawning into `spawn_request`.
- Accept a `ContentItem` rubric and an iterator of evidence in the request adapter.
- Read the Decisions comparison feature flag once per classification and simplify the budget rejection test setup.

GitOrigin-RevId: b4a294eeecb6069db0f80ff6e4f13f558cbd7815
2026-10-20 16:31:41 +00:00
Michael Bolin 5ac9888436 Move Linux sandbox unit tests into separate files (#55620)
## What changed

Extract the inline test modules for `bundled_bwrap`, `bwrap`, `exec_util`,
`launcher`, `proxy_routing`, and `seccomp` into sibling `*_tests.rs` files.
Keep them wired through `#[cfg(test)]` and explicit `#[path]` attributes,
with existing test coverage and runtime behavior unchanged.

GitOrigin-RevId: 79b70a092a19b10716939744542415bc1dcaf0b2
2026-10-20 16:25:02 +00:00
jif 61469096fe Update rustls-webpki and webpki-roots lockfile versions (#55616)
## What changed

- Update `rustls-webpki` from `0.103.15` to `0.103.16`.
- Update `webpki-roots` from `1.0.5` to `1.0.10`.
- Refresh the corresponding entries in `codex-rs/Cargo.lock` and `MODULE.bazel.lock`.

GitOrigin-RevId: c73d2afb6ce9f8bd8756d3cbe6f8114edc461262
2026-10-20 16:12:45 +00:00
cooper-oai f29d55ff06 Propagate authentication header failures before sending requests (#55607)
## Why

Synchronous auth header construction could silently return no credentials when managed authentication became unavailable. Callers need an error to avoid sending requests with missing or partial authentication.

## What changed

- Make `AuthProvider::add_auth_headers`, `to_auth_headers`, and auth header telemetry fallible, and propagate failures through request and WebSocket setup.
- Return a transient error when managed authentication is unavailable, and preserve network policy denials through auth error conversion.
- Retry transient MCP authentication errors while treating build errors and policy denials as terminal.
- Cancel local MCP event streams before resolving authentication so cleanup still works when credentials become unavailable.

## Testing

Add regression coverage for rejected partial authentication, async header resolution, terminal auth errors without sending requests, managed account changes, MCP retry classification, and local stream cancellation after authentication becomes unavailable.

GitOrigin-RevId: 39d981e232cba1e302de502a2fa6239101114ed1
2026-10-20 15:43:19 +00:00
Benjamin Carlsson 78d4c7c7fa Extract shared TUI user prompt helpers from IDE context (#55597)
Move context prefixing and request extraction into `user_prompt`, and update
IDE context injection, thread routing, thread titles, transcript export, and
user message rendering to use the shared helpers. Preserve the request
delimiter, text element byte offsets, and input ordering.

Move the existing last-delimiter extraction test alongside the shared helpers.

GitOrigin-RevId: 3ee350506a536a6dba9575e8311188bc92fed584
2026-10-20 15:15:24 +00:00
Benjamin Carlsson fa71afc8a7 Rank $ mentions by recent selection frequency (#55596)
## What changed

Prefer frequently selected entries in the TUI's `$` picker within exact, prefix, and fuzzy match tiers, keeping stronger match tiers ahead of usage preferences.

Track the last 50 confirmed selections and persist them in `mention_usage.json` under `CODEX_HOME` when history persistence is enabled. Preserve in-memory preferences across compatible chat widget replacements, including when history persistence is disabled. Serialize background writes, merge updates under a bounded file lock, and flush pending writes on shutdown.

## Testing

Add coverage for picker ordering, preference handoff and persistence, history-disabled widget replacement, selection expiry, malformed history, and lock contention.

GitOrigin-RevId: 7efa8c1c365e23000fcda10dbbc2a7e90f4e777c
2026-10-20 15:10:26 +00:00
chess d34f104c22 Reject unpackaged Windows sandbox provisioning clients (#55593)
Remove the exception that allowed clients without a package identity to connect
when the provisioning service had one. Keep the debug foreground-mode exception.

GitOrigin-RevId: def2d22a91575477d73e3d8c6ac14808a2ff3b2b
2026-10-20 14:48:59 +00:00
ioanbudea-OAI 60d78332fc Measure Guardian approval blocking time per turn (#55591)
## What changed

Record `codex.guardian.turn.blocking_ms` when a turn completes or aborts, with an `outcome` label. Count overlapping approval waits once, exclude idle gaps, and split pending reviews across the active turns they span. Use each turn's telemetry so samples retain the servicing turn's model attribution.

## Testing

Add unit coverage for overlapping waits, idle gaps, late turn completion, and duplicate stops. Extend integration coverage to verify attribution across turns and model changes for yielded command reviews and MCP elicitation, including aborted turns.

GitOrigin-RevId: a3e6a0c32a06fe58ea93119ecd941076100fb82c
2026-10-20 14:43:08 +00:00
Rohan Mehta ab6095dde0 Allow callers to control prompt cache keys independently of session IDs (#55587)
## What changed

Expose `PromptCacheKey` through `StartThreadOptions` with three policies: retain the default session-derived key, send a custom key, or omit `prompt_cache_key` from model requests. Keep session identity headers independent of this policy.

Propagate the policy to child agents, delegated sessions, and guardian review sessions. Hosts must reapply the policy when resuming a thread from storage.

## Testing

Add coverage for all three policies across turns, including unchanged session and thread headers. Extend subagent coverage to verify inheritance of the default and omitted-key policies.

GitOrigin-RevId: f9e8ab31fcf568636f9712726760e4e9a4672428
2026-10-20 14:14:59 +00:00
jif e8aa7c1678 Avoid panics after background compaction fails before a checkpoint (#55581)
## Why

Polling a failed background compaction consumes the closed oneshot receiver.
Keeping that receiver in session state can cause a later await to panic instead
of falling back to foreground compaction.

## What changed

Remove the receiver from session state before polling it, restoring it only when
its result is still pending. Discard closed receivers so compaction can fall back
normally.

## Testing

Add a regression scenario where background compaction fails before the next
checkpoint and automatic compaction falls back successfully.

GitOrigin-RevId: 1461bb403f4b0b8b7e171d1b3cba41411f2014b4
2026-10-20 13:50:13 +00:00
jif e1b9c9457c Preserve parent history by default in full agent forks (#55548)
## What changed

Default `features.multi_agent_v2.preserve_fork_prefix` to `true`, so full-history forks retain the parent's model-visible history and append child instructions. Keep `preserve_fork_prefix = false` as an explicit opt-out for instruction filtering, and update the configuration schema documentation.

## Testing

Update coverage to verify inherited prefixes across child and grandchild forks, child instruction ordering after compaction, and explicit filtering opt-outs.

GitOrigin-RevId: f14eae5b924cdeac555d112d0aba3fbbb063b0ea
2026-10-20 11:56:17 +00:00
jif 4dbd9d30ea Ignore the basic-toml advisory in dependency audits (#55547)
`codex-secrets` pulls in unmaintained `basic-toml` 0.1.10 through the localization dependencies of `age` 0.12.1, and no patched release is available.

Add `RUSTSEC-2026-0374` to the `cargo audit` and `cargo deny` ignore lists. Document that the exception should be removed when the localization dependencies of `age` migrate off `basic-toml`.

GitOrigin-RevId: 92f31b687e91a73620e6f7f9a1b7c94790d9149d
2026-10-20 11:55:08 +00:00
jif b2aa07db8a Add scoped leases for persisted account OAuth grants (#55546)
## What changed

- Expose `AccountOAuthGrantLease` to prevent this auth manager's token refreshes from rotating account credentials during an identity-provider exchange. Releasing the lease returns an `AccountOAuthGrant` that callers can recheck before accepting asynchronous results.
- Validate grants against cached login ownership and persisted credentials, requiring OAuth provenance and complete account identity. Reject stale grants and propagate storage failures, including unavailable keyrings in `Auto` mode.
- Track `login_generation` separately from account ownership and use it to invalidate enterprise MCP authentication. Losing login metadata invalidates the login while preserving same-account network policy; a new login to the same account advances both generations.

## Testing

Extend auth refresh coverage to verify refresh blocking and wakeup on lease release, invalidation after token rotation or persisted login replacement, metadata loss and restoration, and logout while a lease is held.

GitOrigin-RevId: f51b3cd526d7ee94d5dffa16681f8ca332245ce3
2026-10-20 11:48:54 +00:00
jif 4be9cfdf30 Improve diagnostics for compressed rollout read failures (#55545)
## Why

Undecodable compressed rollouts need diagnostic details and their original bytes preserved for investigation.

## What changed

- Log compressed file size, first-frame content size, decoded byte count, and whether the open file changed when a compressed rollout read fails. Limit warnings to once per process per minute and exclude paths and contents.
- Allow diagnostic reports to attach the raw `.jsonl.zst` archive after a decoding failure when no preferred plain rollout exists. Retain attachment size limits and append `.zst` to filename overrides when needed.

## Testing

Add coverage for truncated streams, incomplete trailing frame headers, files truncated after opening, and diagnostic uploads that preserve undecodable archives with size limits and filename overrides.

GitOrigin-RevId: 76f7ee466f9bebdab5a91ce1894f4361749edc5b
2026-10-20 11:42:48 +00:00
swastik-oai 464add4958 Separate Guardian conversation preparation from execution (#55533)
## What changed

Split retained conversation scoring into `Reservation::prepare` and `PreparedConversation::run`, exposing the complete admitted input before model execution. Keep the history fork and capacity permit owned by the prepared conversation, and recheck authorization, score expiry, and backend generation before execution.

## Testing

Extend conversation tests to verify that preparation sends no model request, execution uses the prepared input, dropping a prepared conversation releases capacity, and stale prepared reviews cannot start model execution.

GitOrigin-RevId: c96cc6fac69179a78ecd7bcdb8e5a4b3087aa6e6
2026-10-20 10:52:46 +00:00
jif 46d252f8bf Make the startup migration contention test deterministic (#55524)
## Why

The maintenance-lock test relied on a 50 ms timeout to assume startup migration had encountered contention, and its completion timeout included the production retry delay.

## What changed

Add a per-store, test-only retry gate to observe lock contention and explicitly resume migration after releasing the maintenance lock. Verify that rollout metadata stays in `Legacy` mode while the lock is held and becomes `Paginated` after migration completes.

GitOrigin-RevId: 657fa6ec6f9494d9e66976560c8158fde8ffb495
2026-10-20 09:53:33 +00:00
virajrai-oai e18a20d6eb Add correlated diagnostics for Noise relay handshakes (#55498)
## What changed

- Record executor handshake rejections and pending-validation resets in promptly completed diagnostic spans, with classified reasons and registry HTTP status when available. Normalize stream IDs as UUIDs and cap diagnostics at 100 per minute per relay connection, followed by a suppression marker.
- Add elapsed time and connection identifiers to harness handshake diagnostics, including initialization timeouts, and classify WebSocket read failures from typed errors.
- Forward valid stream UUIDs to harness key validation requests through the `x-codex-noise-stream-id` header.

## Testing

Extend tests to cover diagnostic rate limits, timeout correlation, prompt span export, typed WebSocket error classification, and optional stream ID headers. Verify that diagnostic output excludes authorization secrets, registry response text, reset reasons, and invalid stream IDs.

GitOrigin-RevId: 2c224e2d2828b300164868b10806add410e148b2
2026-10-20 07:56:07 +00:00
liame-oai 014489466a Add optional MCP disablement for prediction forks and samples (#55463)
## What changed

Add `experimentalDisablePredictionMcp` to `thread/fork` and `disableMcp` to `thread/sample`. Disable MCP servers when requested and the inherited history contains incremental tools on Responses Lite. The fork option requires `experimentalPredictionMode: true`.

Apply disablement through a thread-local policy that excludes configured MCP servers and runtime contributions, including after MCP refresh. Preserve the inherited history prefix and append tool-removal instructions without changing the parent's tools.

## Testing

Add coverage for prediction forks with legacy and paginated history, flag validation, conditional disablement, MCP refresh, and sample/fork request parity. Add a request-history snapshot covering preserved history, tool removal across child turns, and unchanged parent tools.

GitOrigin-RevId: e31d602480e6550ed130d8152f538b8668280fa0
2026-10-20 05:25:43 +00:00
johnl-oai 18795fc125 Support Windows registry overrides for requirements.toml (#55456)
## What changed

Read `RequirementsPath` from the 64-bit registry view of `HKLM\SOFTWARE\Policies\OpenAI\Codex` to select the system requirements file on Windows. Require an absolute path and return an error for relative values. If the registry key or value cannot be read, retain the default `OpenAI\Codex\requirements.toml` location under ProgramData.

## Testing

Expand absolute-path validation tests to cover empty, drive-relative, and root-relative paths. Update the Windows default-directory test to remain independent of registry overrides.

GitOrigin-RevId: c31045d749e32cf266b389245ae4db2440156e8e
2026-10-20 04:49:25 +00:00
Eric Traut 8196bcdc18 Check daemon feature overrides and prompt for mismatch recovery (#55442)
## Why

A fixed feature allowlist excluded other boolean feature overrides from daemon use. Feature mismatches could also silently fall back to embedded mode, while automatic startup could persist enabled overrides without confirmation.

## What changed

- Allow boolean feature overrides without a fixed allowlist and compare explicit overrides with the daemon's reported settings. Ignore removed features, treat unreported features as disabled, and include only mismatches in restart settings.
- Preserve saved daemon settings during automatic startup. Prompt on feature mismatches even when embedded fallback is allowed, letting users run without the daemon, confirm a managed-daemon restart, or cancel.
- Detect managed daemons during recovery, mark available restarts as recommended, and limit the displayed feature list to three entries plus a remaining count.

## Testing

Update compatibility tests for mixed overrides, removed and unreported features, unreachable daemons, and required versus optional attachment. Update recovery snapshots and the TUI integration test to exercise explicit embedded-mode selection.

GitOrigin-RevId: 9204620f168ff80aaef312c88e681b754908a431
2026-10-20 03:11:07 +00:00
liame-oai a4c9194247 Add cancellation for experimental thread samples (#55441)
## What changed

Add the experimental `thread/sample/cancel` request with a `requestId` identifying a `thread/sample` request on the same connection. Cancellation returns an empty response, stops the matching sample with `sample canceled`, and cleans up its ephemeral fork. Repeated cancellation and unknown request IDs are harmless no-ops; other request types are unaffected.

## Testing

Add coverage for connection and request ID isolation, request type filtering, and repeated cancellation. Extend the sample integration test to verify cancellation keeps the parent responsive and reclaims the child thread.

GitOrigin-RevId: 92d12e5c0190e1d3b06cb482543615a3ec77bdc8
2026-10-20 03:09:44 +00:00