Commit Graph
12381 Commits
Author SHA1 Message Date
Celia Chen 835707e3d8 Release 0.164.0-alpha.6 rust-v0.164.0-alpha.6 2026-10-19 20:55:09 +00:00
johnl-oai c6e29b4fcb Migrate the Windows MXC sandbox to mxc-sdk (#55378)
## What changed

- Replace the separate MXC crates with `mxc-sdk` and adapt request construction to its policy and optional environment fields.
- Preserve the native availability probe by caching successful process security environment creation and startup attribute initialization without launching a process.
- Use the SDK's native denied-path support check and configure Bazel resource compilation for Windows GNU targets.

## Testing

Extend the request construction test to verify that nonempty environments use `Some` and empty environments use `None`.

GitOrigin-RevId: 2765c8fd19ee60661b0ce7cb3cba51acadda201a
2026-10-19 20:54:41 +00:00
jif e389b2444c Add configured thread environment inheritance for subagents (#55375)
## Why

Temporary environment attachments for a parent turn should not become a
subagent's persistent environments. Children also need to retain their
configured executor bindings when their runtime is evicted and reloaded.

## What changed

- Add the disabled-by-default `subagent_thread_environments` feature flag.
  When enabled, both subagent implementations inherit configured thread
  environments captured with the invoking step, excluding turn-only attachments.
- Track configured bindings separately from active turn attachments, preserving
  pending configuration ownership and sharing completed executor startup.
- Retain configured selections and bindings across idle eviction. Reload children
  using retained bindings when the parent changes workspace, while continuing to
  validate current parent roots and permissions for matching workspaces.

## Testing

Extend regression coverage for configured, empty, forked, pending, and legacy
inheritance; temporary attachment removal across eviction; and reload behavior
with changed workspaces, deferred startup, and restricted permissions.

GitOrigin-RevId: 15692ecd99deb38002014b44fd859d793bd54373
2026-10-19 20:30:44 +00:00
Joe Savona 0d337e5fe7 Fix recall of command-line initial prompts in the TUI (#55372)
## Why

Command-line initial prompts bypass the composer and were missing from local recall history, so pressing Up could skip them and retrieve cross-session history instead.

## What changed

Record accepted initial prompts in local recall history with their draft metadata. Add image placeholders where needed so recalled local attachments survive resubmission. Leave synchronously rejected prompts out of recall history.

## Testing

Add regression tests for recall order before cross-session history, ordering after transcript replay, queued prompts appearing once, rejected submissions, and image attachment recall and resubmission. Add a snapshot of the recalled initial prompt.

GitOrigin-RevId: 0a12221ae285f01bff4b5860e546c8f7ee3c71e3
2026-10-19 20:21:30 +00:00
Alex Kira c953dacb42 Enable incremental tools by default for Responses Lite (#55368)
## What changed

Mark `incremental_tools` as stable and enable it by default. Responses Lite sessions now append tool catalog updates to request history without requiring an explicit feature opt-in.

## Testing

Run the incremental catalog scenario with the default configuration. Update assertions and snapshots for empty Responses Lite prewarm input, tool declarations on the first turn, preserved compaction history, and tool changes across model switches and child agents.

GitOrigin-RevId: 27aa6b8499d76ab12167470748452f47e14dd900
2026-10-19 20:01:37 +00:00
Dylan Hurd d9a36f6ec7 Support catalog templates for approved command prefixes (#55366)
## What changed

Add `approved_prefixes` to catalog permission messages, with `{{ approved_prefixes }}` substitution for the approved command list. An empty template suppresses the section; missing or null values retain the bundled template.

For `on-request` approvals, append an explicitly supplied prefix template even when the catalog also supplies approval instructions. Use the template for bundled `on-request` and granular approval instructions as well.

## Testing

Extend the remote model catalog integration test to cover custom prefix rendering alongside catalog approval instructions and suppression with an empty template.

GitOrigin-RevId: 82dd6f83caa56cab0a2f6343bf912efe2cb97d64
2026-10-19 19:55:39 +00:00
jgrodman-arch ee8b4ea181 Import only the continuation of backgrounded Claude sessions (#55365)
## Why

Backgrounding a Claude session creates a continuation that includes its history. Offering both sessions for import duplicates that history.

## What changed

Skip sessions containing a `continued-in` record with a nonblank `continuedInSessionId` during import detection, leaving the continuation available for import.

## Testing

Add detection and app-server regression tests covering continuation-only detection, importing the full history into one thread, and no remaining import candidates afterward.

GitOrigin-RevId: bf8383faadce984ae3c41a0b8e8b3072680fd4b2
2026-10-19 19:53:58 +00:00
Dmitriy Kovalenko 18d09e1eda Add a shared cleanup lock guard for local log directories (#55358)
## What changed

Export `LocalLogsDir` from `codex-file-system` to create a caller-selected diagnostic directory and retain a shared directory lock on Unix. Clones share the lock so callers can keep it held until all log connections close.

New directories use mode `0700` on Unix; existing permissions are preserved. Initialization checks that the locked directory still matches the selected path and returns an error if it changed.

GitOrigin-RevId: fc870d7ee0997d67ba1a23f72ba4ac3cf89fd31a
2026-10-19 19:33:42 +00:00
Anthony Tafoya 9b865ab31e Prepare skill catalogs before building step tools (#55357)
## Why

Skill tools depended on World State rendering to initialize their catalogs and could return `skill catalog is not ready for this step` before rendering completed.

## What changed

- Add an asynchronous `ToolContributor::prepare_for_step` hook and await all contributors before constructing tools.
- Prepare immutable skill catalogs, aliases, plugin policy, and configuration for each step. Tools, invocation detection, and World State rendering consume the prepared state without relying on rendering to perform discovery.
- Apply configuration reloads to subsequent steps while preserving live authorization checks for skill reads.

## Testing

Add coverage for preparation completing before tool construction and World State rendering, skill tools working before rendering, catalogs remaining stable across steps, and configuration reloads during discovery.

GitOrigin-RevId: 1fb95c58c412488353f3bd4403824d6d1476d3d0
2026-10-19 19:33:11 +00:00
asohrabi-oai 49df716ba9 Remove the long-thread accuracy warning after compaction (#55355)
## What changed

Stop emitting the warning about long threads and repeated compactions after successful context compaction. Update compaction, resume/fork, and window-header tests to wait for turn completion without expecting the warning.

GitOrigin-RevId: 707dc2dd21765ec46522276715c96cf7a112654d
2026-10-19 19:24:26 +00:00
Charlie Marsh aeec726de8 Reduce path storage in the file-search index (#55351)
## What changed

Reuse the matcher column for ASCII paths instead of storing a separate full path for every indexed entry. Store the selected search root and entry type alongside each entry so snapshots can build results without resolving the root again.

Retain the original relative path for Unicode entries because matcher columns keep only one code point per grapheme.

GitOrigin-RevId: 1e931482c9a656970e2eeaaade02f19063464f12
2026-10-19 19:10:58 +00:00
ioanbudea-OAI 941b32bf57 Add Guardian retry metrics and preserve turn attribution (#55347)
## What changed

- Record review attempt counts and final outcomes with a `retried` tag.
- Measure retry waits by failure reason and whether the wait ends in a retry, cancellation, or deadline; count retries only when another attempt will run.
- Count required synchronous reviews with the `required_sync` route.
- Use the originating turn's telemetry for Guardian reviews so metrics retain that turn's model attribution.

## Testing

Add metric assertions for attempt counts, retry outcomes, and waits interrupted by cancellation or deadlines. Extend the delayed cached-score integration test to verify route and retry-wait metrics use the originating turn's model after a model override.

GitOrigin-RevId: 681a719ad5dd9e4436cb37b6f5f972cb11a5c890
2026-10-19 18:49:48 +00:00
Konstantine Kahadze 982695cdbc Consolidate cached and fetched Codex manual handling (#55342)
Share outline generation and status construction in `fetchCodexManual` after
loading a verified cached manual or fetching and validating a fresh copy.
Preserve cache status reporting and SHA-256 checks while removing the duplicated
cache-hit return path.

GitOrigin-RevId: 2dd2046a65e9a3adbca4d269827501d5ab175f36
2026-10-19 18:27:21 +00:00
liame-oai 8f8e7a6e09 Add experimental thread/sample requests to the app server (#55339)
## What changed

Add `thread/sample` to collect one model response on an ephemeral fork that inherits a loaded thread's context and configuration. Return the source turn ID, response ID, assistant text, and available token usage without modifying the source conversation.

Require an idle, persistent root thread and an `expectedTurnId` matching its latest completed turn. Reject results if the source history changes during sampling. Keep the parent responsive while sampling, hide sample forks from `thread/loaded/list`, and reclaim them after completion or timeout.

Intercept responses before tool execution or Stop hooks can run, returning null text for tool calls or responses without text. Apply optional reasoning-effort updates only when the provider and model support cache-preserving updates.

## Testing

Add integration coverage for inherited context and reasoning effort, source preservation, tool and Stop hook suppression, invalid requests, stream errors, parent responsiveness, and timeout cleanup.

GitOrigin-RevId: 08f4867e53ec7f6c8f4428d5542eeea4e6dadd0b
2026-10-19 18:25:07 +00:00
jif 1569abc5dc Enable enterprise-managed authorization for MCP connections (#55334)
## What changed

- Connect directly configured MCP servers using account-scoped enterprise grants stored in the keyring, with token exchange and authenticated HTTP requests.
- Retain authorization for the thread across MCP refreshes and revoke it when the account owner changes, cloud configuration becomes invalid, or an enterprise login replaces the grant.
- Negotiate the enterprise-managed authorization extension with the `2026-07-28` protocol, bypass shared tool catalog caching for enterprise servers, and report credential status with enterprise sign-in guidance.

GitOrigin-RevId: c0f96d37194212758a211ae6a4107205df96df26
2026-10-19 17:57:35 +00:00
jif fbb2f9dbec Use step environment snapshots for subagent inheritance (#55331)
## What changed

- Remove `subagent_thread_environments` and the separate configured environment bindings. Spawned agents inherit the invoking step's environment snapshot.
- Retain environment selections across child eviction without retaining executor bindings. Reload V2 children against the parent's captured environments, requiring matching environment IDs, working directories, and workspace roots while preserving permission validation.

GitOrigin-RevId: d820c63ea20f5834ed88071d16c60683f2545406
2026-10-19 17:43:31 +00:00
Anthony Tafoya 03478b4b92 Expose skill installations and stabilize package aliases (#55330)
## Why

A skill can be available from Cloud and multiple executor environments. Reading its instructions needs to expose where supporting files live and allow discovery of locations omitted by response limits. Package aliases also need to keep identifying the same roots as catalogs change.

## What changed

- With executor capability discovery V2, add `skills.installations` to list enabled locations with source filtering and pagination, without reading skill contents.
- Let `skills.read` select Cloud or a specific executor environment through `source`. Return bounded installation metadata and an `installations_truncated` flag so callers can retrieve omitted locations.
- Share bounded, append-only alias assignments between catalog rendering and tools within a live thread. Preserve each step's alias snapshot and render only root mappings used by its catalog entries.
- Use discovery-root metadata when constructing executor skill locators, with a fallback when it is absent. Preserve the legacy read response and tool set outside discovery V2.

## Testing

Add coverage for installation filtering and pagination, response budgets, source-specific reads and cursors, and alias stability across catalog and plugin changes. Add an end-to-end scenario that discovers an omitted installation and reads its instructions from the selected environment.

GitOrigin-RevId: a04e51e8242b21288d9d7b822780f9f1e093151d
2026-10-19 17:37:49 +00:00
jif d70c2c2cdf Add configured thread environment inheritance for subagents (#55327)
## Why

Temporary environment attachments for a parent's turn should not become a child's persistent environment configuration or survive child eviction.

## What changed

- Add the default-disabled `subagent_thread_environments` feature flag. When enabled, subagents inherit configured thread environments captured with the spawning step instead of active turn selections.
- Track configured bindings separately from turn attachments, preserving pending configuration ownership when turn selections change.
- Retain configured bindings across child eviction and reload, excluding temporary attachments. Preserve the child's workspace when the parent switches workspaces, while enforcing current roots and permissions when the parent still configures the same workspace.

## Testing

Extend coverage for both multi-agent versions, forked children, empty configured environments, pending configuration, and legacy inheritance. Add eviction and reload cases covering temporary attachments, workspace changes, deferred executor startup, and permission validation.

GitOrigin-RevId: 4533645503d5f863a9ccc064386ed7ca169d98b7
2026-10-19 17:16:22 +00:00
Channing Conger 8dd6099e26 Remove thread title generation spinners from the TUI (#55324)
## What changed

Stop showing title-generation spinners in the footer, status line, and terminal title. Remove the associated UI pending state and animation refresh logic while retaining background title generation.

## Testing

Add a snapshot covering the footer and terminal title while automatic naming is pending. Update status-surface snapshots to cover thread names and ID fallbacks without progress indicators.

GitOrigin-RevId: 061456929149c216f0a98d7214179ec69cdaeee4
2026-10-19 17:09:36 +00:00
Anthony Tafoya a309f9206a Integrate discovery V2 with step-scoped skill catalogs (#55322)
## What changed

- Build executor skill catalogs from discovery V2 inventories without reopening host paths or falling back to legacy discovery.
- Merge Cloud and executor skills by remote plugin identity and skill name, retaining Cloud metadata and accepted provider read routes. Apply plugin selection and disablement before merging.
- Share a stable catalog across each step's rendering, list/read tools, and explicit and implicit skill invocations.
- Preserve unmatched executor entries when Cloud catalogs are unavailable or partial; only complete Cloud catalogs disable unmatched remote entries.
- Bind discovery caches to captured environments and executor sessions, and refresh MCP when V2 inventories change. Preserve pending invalidations when forced MCP refreshes fail.

## Testing

Add regression coverage for V2 inventory sharing and refresh, environment isolation, catalog merging, partial Cloud results, disabled plugins, and catalog consistency across steps and read routes.

GitOrigin-RevId: 842bdcbc9e19364dd69a9abf9e48330b7425a76c
2026-10-19 17:02:20 +00:00
ee 57560e9d53 Enable GitHub Actions OIDC authentication in the Responses API proxy (#55320)
## Why

GitHub Actions workflows can use short-lived OpenAI credentials instead of storing a long-lived OpenAI API key in GitHub secrets.

## What changed

- Add `--github-oidc` with required audience, identity provider, service account, and GitHub token-request URL settings. Read the GitHub request credential from stdin and connect it to the existing federated authentication flow.
- Require the default OpenAI Responses endpoint in OIDC mode before reading credentials, and complete the initial token exchange before publishing server info.
- Close the npm launcher's copy of stdin after the native child starts.
- Document OIDC setup, credential handling, renewal behavior, and caller responsibilities. Keep API-key authentication as the default.

## Testing

Add tests for required OIDC flags, upstream restrictions before credential reads, rejection of unsafe or empty settings without exposing sensitive input, and failure when a configured custom CA cannot be loaded in the CLI blocking context.

GitOrigin-RevId: 7de6fd4c3491e7ccd6a2c2ccdee0bc2eedd0e642
2026-10-19 16:56:42 +00:00
Benjamin Carlsson e4568a3538 Reject TUI events from a different backend (#55304)
## Why

Events from another backend must not mutate the current backend's thread or connection state, even when native thread IDs collide.

## What changed

Attach the session's `BackendId` to incoming app-server events and check it before dispatching to thread caches or UI handlers. Apply the same check when waiting for a thread revert notification.

## Testing

Add regression tests covering ignored foreign notifications, approval requests, lag and disconnect events, accepted events from the current backend, and preservation of backend identity on transport events.

GitOrigin-RevId: 2577ab78e0592726f5f05e3426772899e6cb7c7e
2026-10-19 15:20:42 +00:00
Anthony Tafoya f6e03d4eac Route skill reads by alias source (#55303)
## Why

Skill aliases already identify their source, but `skills.read` searched the cloud catalog before the executor catalog even for executor aliases.

## What changed

Parse package locators to recognize cloud (`c0/...`), executor (`e0/...`), and host (`r0/...`) aliases. Restrict cloud and executor alias lookups to the matching catalog, while retaining the existing search order for other package strings.

Share the source-to-prefix mapping between alias generation and parsing, and preserve the string representation and tool schema for package locators.

## Testing

Extend alias tests to cover source recognition, JSON round trips, and malformed alias strings, including leading zeros, missing suffixes, non-ASCII prefixes, and overflowing indices.

GitOrigin-RevId: f835e47a244aa0cf9eb95980ea23f4d7fcedd511
2026-10-19 15:19:47 +00:00
jif cc1a4ec763 Stop the closest remote SHA search at zero distance (#55302)
Return immediately from `find_closest_sha` when a remote-backed branch has
zero distance from `HEAD`, avoiding Git commands for the remaining candidates
once the minimum possible distance is found.

GitOrigin-RevId: d329ec6b5d655ad401249357e6e83ba7bb130a69
2026-10-19 15:15:41 +00:00
Anthony Tafoya f7a135ec61 Reconcile V2 executor plugins with cloud catalogs (#55301)
## What changed

- Use V2 discovery inventories for plugin MCP contributions when supplied, including empty or failed inventories; retain legacy discovery when no V2 snapshot is supplied.
- Merge plugins by canonical identity, using cloud metadata and enablement for remote plugins and attaching executor installations only when versions match. Preserve configured executor-local plugins and executor enablement when cloud data is unavailable.
- Keep installation order stable across refreshes and run merged MCP declarations on the first retained executor installation while preserving attribution for the others.
- Carry local and remote identities through selected-plugin snapshots, skill attribution, and active-plugin telemetry. Track disabled plugin IDs alongside disabled roots.
- Preserve a complete cloud catalog when a partial refresh arrives, and cap tool-description plugin attribution at 1,024 bytes while retaining all plugin associations.

## Testing

Add coverage for catalog parsing and reconciliation, enablement and discovery-mode selection, installation refresh ordering, executor-specific MCP normalization, selected-plugin snapshots, and bounded UTF-8 attribution text.

GitOrigin-RevId: a8ad352de6a2b8dc4bfd1ff6a5c62ee8ed1d1664
2026-10-19 15:15:17 +00:00
acrognale-oai 1277bcfddc Add one-shot app-server startup configuration discovery (#55300)
## What changed

Add `codex app-server --print-startup-config` to validate local and cloud-backed configuration and emit the app-server version and configuration requirements as JSON without initializing environments, thread storage, or plugins. Configuration failures produce structured JSON errors and a nonzero exit status.

Support `--startup-sign-out` to remove account credentials and reload signed-out requirements, including recovery when cloud policy is unavailable. Reject sign-out for host-owned external authentication. Accept `--startup-client-info` to identify configuration and authentication requests.

Reuse configuration loading and account cleanup logic between startup discovery and the running app server.

## Testing

Add CLI integration coverage for configuration validation, project login restrictions, managed cloud requirements and failures, sign-out recovery, external authentication protection, and independence from locked or invalid history databases.

GitOrigin-RevId: 636ccb095b684b6136cf9e408f3f8613cb776e16
2026-10-19 15:13:44 +00:00
ee 54f99017f2 Refresh rejected proxy credentials and back off failed renewals (#55299)
## Why

The Responses API proxy could reuse a federated credential after an upstream `401`, and concurrent requests could each retry a failed token exchange.

## What changed

- Invalidate the rejected credential so the next request obtains a fresh token. Forward the `401` without replaying the request or waiting for an ongoing renewal; leave credentials intact on `403`.
- Track rejection per token issuance so a late `401` cannot invalidate a newer credential.
- Back off failed exchanges exponentially from 1 to 30 seconds, starting when the exchange fails. Reject requests during backoff without reusing the old token, and reset the delay after a successful exchange.

## Testing

Add tests for response forwarding without replay, late and concurrent rejections, shared renewal failures, backoff timing and reset, and credential-safe renewal errors without following redirects.

GitOrigin-RevId: eb1ed6848d74fdba1534919cace5126f4a0595cf
2026-10-19 15:08:50 +00:00
ee 8cac68328a Add renewable federated auth primitives to the Responses API proxy (#55298)
## What changed

Add a federated `Auth` variant that exchanges JWT subject tokens for OpenAI access tokens using identity provider and service account IDs. Serialize concurrent exchanges, cache credentials, and renew proactively with a fresh subject token.

Validate token types, bearer credentials, payload sizes, and lifetimes. Bound caching by both relative and absolute expiry, discard cached credentials before renewal, and disable redirects for federated requests. Keep credential buffers zeroizing and diagnostics free of secrets.

## Testing

Add HTTP fixture tests for concurrent cache reuse, renewal with fresh subjects, expiry across host suspension, failed renewal, oversized payloads, invalid subjects, and unsupported or missing issued token types.

GitOrigin-RevId: e7e6dacd4a834fb73166caf146d4cdc50a895f56
2026-10-19 15:08:17 +00:00
ee a91b0bf1bf Add GitHub Actions OIDC token acquisition to the responses API proxy (#55297)
## What changed

Add a `GithubOidc` implementation of `SubjectTokenSource` that requests a fresh token using a bearer credential read from stdin. Validate HTTPS request URLs and replace the audience query parameter while preserving other parameters. CLI integration is not included.

Add a token HTTP client that disables redirects and request logging, applies timeouts, and bounds response bodies. Keep token response buffers in zeroizing storage and exclude credentials, request URLs, and response bodies from errors.

Generalize the locked stdin credential reader for bounded OIDC bearer tokens while preserving API key validation.

## Testing

Add tests for fresh token acquisition, short reads, credential size limits, injection rejection, redirect refusal, and credential-safe errors and logs. Extend API key tests to retain the stricter character restrictions.

GitOrigin-RevId: fd7767178f475b8161734f29d29108c795839185
2026-10-19 15:07:37 +00:00
ee f6e8ca3fc1 Encapsulate Responses API proxy authentication (#55296)
## What changed

Introduce a shared `Auth` abstraction that supplies sensitive authorization headers and the client's redirect policy. Preserve the existing static API key allocation and default redirect behavior, and return an empty `502` response if header acquisition fails.

Unify the stdin authentication entry point around platform-specific `read_from_stdin` helpers.

## Testing

Add a test verifying that both compact and pretty `Debug` output redact API keys.

GitOrigin-RevId: 6a924534f00c1b209b24e8b0af117091cfa3ec07
2026-10-19 15:06:10 +00:00
felixxia-oai 7c073196a1 Keep only the latest adjacent reasoning effort update in requests (#55293)
## Why

Turn recovery and retries after a server overload can leave consecutive reasoning effort updates in history when settings change without an intervening message. Requests should use the latest update in each consecutive run.

## What changed

Coalesce adjacent `configuration_update` items when building Responses requests with reasoning effort overrides enabled, retaining the latest update. Preserve saved history and updates separated by other input items.

## Testing

Extend integration coverage for recovery with unchanged or changed effort, retries after a server overload, and WebSocket continuation and replay after coalescing. Verify that requests retain the latest adjacent update while saved history keeps all updates.

GitOrigin-RevId: bcf97db4c93dac5f466bd276176ac9d238329ecd
2026-10-19 14:34:11 +00:00
jif 4e7b9e285b Recheck EMA request authority at HTTP boundaries (#55288)
## Why

Authorization can change during token renewal before a revocation watcher runs. Requests must check that their authority is still current before dispatch.

## What changed

- Let `EmaRequestAuthority` accept a cancellation token and a synchronous authority check, revoking itself when the check fails.
- Recheck authority after authentication and after receiving HTTP responses for both regular and streaming requests.
- Add `CloudConfigBundleBinding::invalidated()` to wait until a captured policy binding is no longer current.

## Testing

Update tests to cover ownership changing during token renewal without explicit revocation, preventing HTTP dispatch, and parent-token cancellation ending an existing response stream.

GitOrigin-RevId: a142d6bcd0cd7a3d2e9d438a45dc640d93235656
2026-10-19 14:08:49 +00:00
jif cca40e57a4 Track MCP enterprise auth cancellation across config reloads (#55287)
## Why

Configuration loading can finish before a pending startup is visible to the thread manager. Reloads need a cancellation scope that also covers these configuration snapshots.

## What changed

- Capture an enterprise managed authentication (EMA) cancellation token before loading configuration and carry it through config layers, role overrides, runtime refreshes, and `McpConfig`.
- Cancel the previous scope on MCP or user configuration reloads and cloud config loader changes, then create a fresh scope for subsequent loads.
- Cancel the session's token when enterprise MCP authentication is disabled or a refresh leaves it unavailable.

## Testing

Extend the MCP reload test to verify that existing thread and pending startup tokens are cancelled while a fresh startup receives an uncancelled token.

GitOrigin-RevId: 5fc0658b74c360e7dc9ab3488339fcf19bfe9fae
2026-10-19 14:07:10 +00:00
Charlie Marsh b1fd48c48e Avoid cloning events in the app-server thread listener (#55283)
Record whether an event is `ShutdownComplete` before moving it into
`apply_bespoke_event_handling`, preserving shutdown drain notification without
cloning the event.

GitOrigin-RevId: 9e4ca8c657d4d5b98056de8c7aba1391233994c1
2026-10-19 13:27:16 +00:00
Chris Hayduk bb8f5304fc Fall back when macOS rejects high stdio descriptors (#55278)
## Why

On macOS, spawn file actions reject valid descriptors at or above `OPEN_MAX` even when `RLIMIT_NOFILE` permits them. This can prevent child processes from starting when their stdio descriptors exceed that limit.

## What changed

Use the compatibility backend when `posix_spawn_file_actions_adddup2` returns `EBADF` for stdio setup and `SpawnFallback::Compatible` is enabled. Preserve the error for `SpawnFallback::ReturnError`.

## Testing

Add a macOS regression test that forces high stdio descriptors and checks strict-mode errors, fallback stdio and exit status, process groups, and descriptor isolation without changing the parent's descriptor.

GitOrigin-RevId: b2a65a53403035df97831393a4f0eb77107b996e
2026-10-19 13:10:35 +00:00
jif 4635d48925 Stabilize daemon reconnect and Rosetta package startup tests (#55274)
## Why

A replacement daemon PID can appear before the TUI observes the disconnect, allowing stale UI content to make the startup test advance too early. Cold Rosetta translation can also consume the startup deadlines for freshly extracted Intel macOS packages on Apple Silicon.

## What changed

- Wait for the reconnect transcript clear before sending `/status` in the daemon startup test.
- Warm both packaged CLI and app-server entrypoints with `--help` when testing `x86_64-apple-darwin` packages on `arm64` hosts. Give each warmup 180 seconds and fail fixture setup if either entrypoint cannot run.

GitOrigin-RevId: ce75201a7773ebb55cc060ca04b09ec2d0ccf303
2026-10-19 12:57:15 +00:00
jif d28be12577 Honor per-thread unload delays in app-server (#55270)
## Why

Thread unload timing used the server-wide delay, ignoring per-thread configuration overrides. Clients need to control how long individual idle, unsubscribed threads remain loaded.

## What changed

- Resolve unload timing from each loaded thread's `thread_unload_delay_secs` configuration. Setting it to `0` allows immediate unloading once the thread has no subscribers or activity.
- Allow this runtime retention override in `experimentalPredictionMode` forks while continuing to reject other configuration overrides. Reject negative values and delays too large to schedule.
- Replace the source-specific immediate-unload behavior with explicit configuration.

## Testing

Extend integration coverage for per-thread delays, unloading after active turns finish, fork overrides, and invalid prediction-fork delays. Verify that immediate unloading preserves persistent history and that cold resumes and ordinary nested forks use their default delay instead of retaining the previous runtime's override.

GitOrigin-RevId: fcb82bd73a101260c51e2a8476f94320c23ac929
2026-10-19 12:30:33 +00:00
Charlie Marsh 1b89beea82 Avoid cloning the full catalog for model metadata lookups (#55265)
## Why

`get_model_info` clones the entire model catalog before selecting metadata for a single model.

## What changed

Look up metadata directly in the active catalog for both remote and static model managers. Share catalog selection across remote catalog accessors and metadata lookup, preserving auth identity checks, API-key discovery policy, provider matching rules, and configuration overrides.

## Testing

Extend coverage for custom catalog configuration overrides, metadata fallback after disabling API-key discovery, and fallback after an auth identity change.

GitOrigin-RevId: 7d0bc4c1ccd2b56e16c7a17c1dbdca05a5c14a7b
2026-10-19 11:51:02 +00:00
Charlie Marsh cc44ffb3e2 Start dormant MCP servers for hook calls (#55263)
## Why

MCP tool hooks need to invoke model-hidden tools even when a subagent's cached server has not started. Their timeout must also cover server startup.

## What changed

- Let cached servers with allowed model-hidden tools remain dormant until called.
- Wait for the selected server when executing an MCP hook, leaving unrelated cached servers dormant, and apply the hook timeout to the entire operation.
- Capture tool namespace attribution after startup and retain it only while catalog revisions remain unchanged.
- Validate the server, environment, and tool filter before starting a server or capturing attribution.

## Testing

Extend integration coverage for cached subagent hooks under both startup readiness modes, startup timeouts without context injection, and namespace attribution for hook and token-budget context while keeping tools hidden from the model. Verify that a direct call starts a cached server whose tools are hidden from model exposure.

GitOrigin-RevId: 7a54b69aa2515722aeb925e03e1667bf63aa67ca
2026-10-19 11:40:15 +00:00
jif 71ab2ea77b Stop memory dual-write when v2 is selected (#55262)
## Why

Dual-write prepares v2 memories while v1 is selected. Once v2 is selected, running the v1 pipeline is no longer needed.

## What changed

Run both memory pipelines only when `memories.dual_write` is enabled and `memories.version` selects v1. Run only v2 when it is selected, even if dual-write remains enabled. Update the configuration documentation and schema to describe this behavior.

## Testing

Extend the startup test to cover both selected versions, checking model request counts, versioned extraction and consolidation state, and the absence of v1 rollout summaries when v2 is selected.

GitOrigin-RevId: 1eb85bd67d7b32883b4ff086514a2acfb6b18f3a
2026-10-19 11:36:21 +00:00
Charlie Marsh c0ce901923 Share dynamic tool specifications across turn snapshots (#55261)
## What changed

Store dynamic tool specifications in an `Arc<[DynamicToolSpec]>` so session configuration and turn snapshots share the list fixed at thread startup instead of copying it on each clone.

Keep the `dynamic_tools()` accessor returning a `Vec<DynamicToolSpec>`, but copy the specifications after releasing the session state lock.

GitOrigin-RevId: 092c5f9ea6cc390d948c27cd11340aeb12bd6037
2026-10-19 11:35:08 +00:00
jif 9032fc7683 Unload idle ephemeral composer prediction threads without delay (#55255)
## What changed

Set the app server's unload delay to zero for ephemeral threads whose `thread_source` is `composer_predictions`, excluding subagent sessions. These threads unload once they are idle and have no subscribers, while active turns continue to completion.

## Testing

Extend integration coverage to check immediate unloading after an active prediction turn finishes and after unsubscribing from a fork that inherits the prediction configuration. Verify that persistent threads and ephemeral threads without the prediction source retain the configured delay.

GitOrigin-RevId: 04a0e405b666c689ccf6f482055d24692b18ead0
2026-10-19 11:09:48 +00:00
jif 5fe32c0001 Preserve rollout access metadata across compression and restoration (#55252)
## Why

Replacing rollout files can lose Unix ownership or macOS ACLs, changing who can read or append to a transcript. An ACL can also permit appending while denying explicit timestamp updates.

## What changed

- Preserve Unix ownership, permissions, modification times, and macOS ACLs before publishing compressed or restored rollouts, and verify the replacement can be reopened.
- Abort replacement on metadata failures, reject macOS delete-deny ACLs to keep temporary files removable, and detect Unix access metadata changes through `ctime` checks.
- Use managed restoration temporary files whose names avoid stale `*.tmp` cleanup.
- Allow appending when refreshing the rollout's modification time returns `PermissionDenied`.

## Testing

Add regression coverage for macOS ACL preservation, inherited ACL removal, deletion-protected rollouts, append access despite denied timestamp changes, Unix group preservation, and restoration temporary files surviving stale-file cleanup.

GitOrigin-RevId: 23f3de6e35c0b2e19f3491170e320159ea3bdb6f
2026-10-19 11:02:40 +00:00
jif 47db419304 Batch thread history materialization into SQLite (#55244)
## Why

History catch-up collected the entire durable rollout prefix before applying it in one SQLite transaction. Large rollouts therefore required buffering all projection steps and committing them together.

## What changed

Stream projection batches through a bounded queue and commit each batch with its checkpoint. Flush between complete records after reaching 1 MiB of source data or 256 projection steps, keeping ordinal gaps with their following records and allowing oversized records to remain intact.

Wait for batches before opening SQLite transactions so an idle reader does not hold the writer. Preserve committed progress across later failures or cancellation, allowing retries to resume from the last checkpoint.

## Testing

Add coverage for reader and writer failures under backpressure, atomic batch rollback, retries without replaying committed records, and unrelated writes while projection is paused. Verify that producer disconnection and consumer cancellation retain committed progress.

GitOrigin-RevId: 06e79fa4cf273de9abd95faf7eed370f18cedc33
2026-10-19 10:48:13 +00:00
ioanbudea-OAI eb354a928b Add Guardian review routing and cached score metrics (#55237)
## What changed

- Count adaptive reviews and record synchronous review routes as `async_fallback` or `required_sync`, with the review reason in snake case.
- Record cached score readiness and score age in milliseconds, measured from input sampling time and including inference time.

## Testing

Extend approval tests to assert fallback routing, adaptive review counts, score readiness, and sampled score age.

GitOrigin-RevId: 1200b3297add6c4467e460de87b4a6d8d31e1fc4
2026-10-19 10:22:38 +00:00
ioanbudea-OAI 9dc3a1ce7e Record Guardian sampling retries, attempts, and delivery outcomes (#55234)
## What changed

- Add sampling retry counters that distinguish transport retries from authentication recovery, with failure reasons.
- Record attempt counts and final outcomes for successful, failed, cancelled, and superseded sampling requests.
- Carry retained-score telemetry until the consumer accepts or discards the score, so queued scores that expire are recorded as superseded and accepted early scores remain successful even if response draining fails.

## Testing

Add metric assertions for transient recovery, retry exhaustion, authentication recovery, cancellation, supersession, and retained-score acceptance or discard, including expiry while a score is queued.

GitOrigin-RevId: 36babd6f431f22cf15b73355e6e026a256a81004
2026-10-19 09:48:19 +00:00
swastik-oai 770ed6dcea Allow plus signs in metric tags (#55227)
## Why

App versions containing build metadata use `+`, which metric tag validation previously rejected.

## What changed

Accept `+` in metric tag keys and values so these versions can be included in the `app.version` session tag.

## Testing

Extend the session metric tag test to cover a version with build metadata, verifying that its value and tag ordering are preserved.

GitOrigin-RevId: 62ad732b8d280c2d0c4e1b0de8cab26ff87c9d47
2026-10-19 09:09:25 +00:00
ioanbudea-OAI 99f617bf74 Bucket admitted Guardian request metrics by input size (#55226)
## Why

Guardian request counts grouped by input size should reflect admitted sampling inputs without counting synchronous transport retries more than once.

## What changed

- Add a shared `token_bucket` label to admitted total-input observations in `codex.guardian.context.request_tokens` for synchronous and asynchronous reviews. Use inclusive upper bounds in 20k-token steps through 240k, followed by 256k and overflow buckets.
- Record synchronous request tokens after budget admission, once per sampling step, including the complete input. A fresh step counts again even when its input is identical.
- Preserve asynchronous component histograms for oversized classifications, but omit `token_bucket` so rejected inputs do not contribute to counts grouped by that label.

## Testing

Add coverage for bucket boundaries, synchronous retry deduplication and budget rejection, asynchronous retained-history reuse and reset, and admitted versus oversized classification metrics.

GitOrigin-RevId: fac2f102a4c48c5fd21d56bfa701b95a1ff852d0
2026-10-19 09:03:12 +00:00
Eric Traut 89461ea683 Prune unused standalone releases after successful installation (#55149)
## What changed

Clean up older standalone releases after verifying the installed command, while holding the install lock. Retain the current and previously selected releases, along with releases used by running Codex processes or bundled helpers.

Record selection history for all standalone installs and preserve it on no-op installs. Only remove validated, installer-owned release directories; skip cleanup when filesystem or process inspection cannot establish that removal is safe. Recheck process usage after moving a release aside and restore it if it is in use.

## Testing

Add installer regression coverage for running helpers, helpers started during cleanup, repeated installs, failed installs, downgrades, and preservation of unowned directories and symlinks.

GitOrigin-RevId: 8fb363750ace14b4f804fdcfcdb210540f49c928
2026-10-19 00:13:28 +00:00
Vivian Fang 70b3bb6d88 Add observation-only model request lifecycle hooks (#55144)
## What changed

- Add `PreModelRequest` and `PostModelRequest` hooks around model request attempts, including retries. Pass model, session, turn, and optional subagent context; report completion, failure, or cancellation with errors and token usage when available.
- Treat hook output as diagnostic data without allowing it to veto requests or alter model context. Wait for synchronous post-request hooks before dispatching tools, while asynchronous hooks allow streaming tool dispatch to continue.
- Apply memory-consolidation hook filtering and expose the new events through configuration, protocol schemas, generated clients, and the hooks browser.

## Testing

Add integration coverage for failures and retries, ignored control directives, cancellation, synchronous and asynchronous tool ordering, interrupted-turn resume and token accounting, and memory-consolidation filtering. Update hook schema fixtures and hooks browser snapshots.

GitOrigin-RevId: 6ed7b39fc8bb94cf467e350d07d97fcc729c21ce
2026-10-18 22:43:56 +00:00