Commit Graph

7991 Commits

Author SHA1 Message Date
jif
a7dcd20d38 Add process diagnostics snapshots (#37434)
## What changed

- Add a `codex-diagnostics` crate that snapshots the process ID, available
  resident-memory measurements, and registered process-wide gauges.
- Provide guards that update gauges for the lifetime of measured objects.
- Track live `CodexThread` instances with the `core.threads.live` gauge.

## Testing

- Add unit coverage for gauge registration, guard lifetimes, process memory
  snapshots, and live-thread reporting.

GitOrigin-RevId: 3236b086bd4ebe31ed4768ab87a5fa288b0891b0
2026-08-07 11:30:17 +00:00
acrognale-oai
51e36d2ec2 Expose multi-agent versions in model/list (#37433)
## What changed

- Add nullable `multiAgentVersion` metadata to v2 `model/list` responses.
- Represent supported values as `disabled`, `v1`, or `v2` in the Rust API and generated JSON Schema and TypeScript exports.
- Forward the value from model catalog presets through app-server responses.

## Testing

- Extend the remote model catalog test fixture with a `v2` multi-agent version.

GitOrigin-RevId: bd3b2bbe0a3b562b4d1f03df7da2a73a35713978
2026-08-07 11:26:01 +00:00
jif
85e0661c3b Cap project instructions across environments (#37424)
## Why

Applying `project_doc_max_bytes` independently to every selected environment
allows the total project instruction payload to grow with the number of
environments.

## What changed

Treat `project_doc_max_bytes` as one shared byte budget. Consume it in selected
environment order, truncate the entry that reaches the remaining limit, and
skip later environments once the budget is exhausted.

Update the configuration descriptions to document the aggregate limit.

## Testing

Add unit and integration coverage for partial and exhausted budgets across
multiple environments.

GitOrigin-RevId: 4664bdf1f23b66986349d503f44cf51560b9024f
2026-08-07 09:50:43 +00:00
sayan-oai
95c7265e84 Add executor-local config reads to the exec server (#37408)
## What changed

- Add the `environmentConfig/read` RPC for selecting literal TOML paths from executor-local config and requirements layers.
- Return layer precedence, cloud insertion points, source and base-directory metadata, and executor home and hostname context without normalizing path-bearing values.
- Expose the operation through both remote clients and local `Environment` instances, with invalid selectors reported as invalid parameters.

## Testing

- Cover projected remote config reads and rejection of empty selectors.

GitOrigin-RevId: fee15bf833de6bcb2058d405ed5b1d5d928d7218
2026-08-07 08:32:30 +00:00
sayan-oai
957f8eedee Add a loader for executor-local config layers (#37406)
## What changed

- Add `load_local_config_layers` to return raw configuration and requirements layers with their sources, base directories, precedence order, and cloud insertion positions.
- Support projecting layer stacks to selected TOML paths while preserving non-table override blockers and adjusting cloud insertion positions when empty layers are removed.
- Reuse project discovery and trust handling for local reads, including linked-worktree hooks, without resolving relative paths or including profiles, session flags, thread layers, or cloud-provided values.

## Testing

- Cover layer ordering, raw relative paths, legacy requirements, trust filtering, projection semantics, and untrusted linked-worktree hook handling.

GitOrigin-RevId: a1098af5650ac44e5a230ba9a5fe918927986d05
2026-08-07 08:28:10 +00:00
rka-oai
c87a218bd3 Rename the tool registry metadata setting (#37400)
## What changed

Rename `features.tool_registry.include_tool_namespaces_info` to
`features.tool_registry.include_tool_metadata` across configuration parsing,
schema generation, resolved configuration locking, and tests. Update its
description to cover authoritative tool information in request metadata.

GitOrigin-RevId: 93b404483b71fed04031d767a41ac2bb70b836b2
2026-08-07 07:35:37 +00:00
rka-oai
4ee41929ea Add tool namespace metadata configuration (#37389)
## What changed

- Add `features.tool_registry.include_tool_namespaces_info` to the TOML model,
  generated schema, and resolved runtime configuration. The setting defaults to
  `false` and controls whether per-turn request metadata includes the resolved
  tool namespace inventory.
- Preserve the resolved setting in session configuration locks.
- Cover top-level and profile-scoped strict configuration, deserialization,
  resolution, and lock-file persistence.

GitOrigin-RevId: 74124086c0d7de30094b411001f0ec0af490935d
2026-08-07 06:29:09 +00:00
joshyin-oai
0bdce9f424 Restore archived sessions from the resume picker (#37371)
## What changed

- Add an Active/Archived status control to the resume picker and use it when listing sessions.
- Restore an archived session before resuming it, with inline error handling and duplicate-request prevention while restoration is pending.
- Keep directory filtering available for archived sessions and hide the archive shortcut while viewing them.

## Testing

- Add coverage for archived-session filtering, successful restoration, failure and retry behavior, toolbar rendering, and keyboard navigation.

GitOrigin-RevId: db3f5935e0f0bba12a110ba9c7aaf9d40abd4a4f
2026-08-07 03:54:23 +00:00
joshyin-oai
1efd8fcb26 Add session archiving to the resume picker (#37369)
## What changed

- Add a `Ctrl+A` action and footer hint for archiving the selected session in the resume picker.
- Send archive requests through the app server, remove successfully archived sessions from the picker, and surface failures inline.
- Prevent duplicate actions while an archive is pending, preserve configured keybindings, and direct users to `/archive` when they select the current session.
- Ignore archive notifications for untracked side threads so they do not appear in agent navigation.

## Testing

- Cover successful, repeated, rejected, and failed archive requests, shortcut conflicts, footer rendering, and untracked-thread notifications.

GitOrigin-RevId: 20ea21c804a9685e46484d67df967859f9be4651
2026-08-07 03:48:15 +00:00
Shijie Rao
6622546169 Restore approval policy when resuming threads (#37368)
## What changed

- On cold `thread/resume`, restore the latest approval policy from persisted
  thread settings instead of falling back to the current configured default.
- Preserve the precedence of an explicit request override over the persisted
  policy.
- Account for settings applied during a turn when the subsequent compacted turn
  context contains a stale policy.

## Testing

- Add unit coverage for selecting the latest persisted policy.
- Add app-server tests for legacy and paginated history, including explicit
  resume overrides.

GitOrigin-RevId: 9127a3c53a90f16d67957ded9e7430e79180fc60
2026-08-07 03:44:24 +00:00
Eric Traut
80858a8cce Add session forking to codex exec (#37367)
## What changed

- Add `codex exec fork <SESSION_ID> [PROMPT]` for creating a new thread from
  an existing session ID or thread name.
- Allow creating the fork without starting a turn, or immediately continue it
  with a prompt and optional images.
- Preserve the source thread ID in the emitted session configuration while
  leaving the source session unchanged.

## Testing

- Add CLI parsing coverage and an end-to-end test for promptless and prompted
  forks, thread naming, copied history, and unsupported promptless options.

GitOrigin-RevId: b8f28b238a1526cc486c5beb886a63f68b8e7986
2026-08-07 03:40:06 +00:00
Cam moten
9daa491f7c Harden local MCP server process tree cleanup (#37366)
## Why

A local stdio MCP server can exit while its descendants remain alive. Cleaning up
only the server process can therefore leak processes after client shutdown.

## What changed

- Contain locally launched MCP servers in non-breakaway Windows job objects and
  terminate the job during shutdown so descendants exit with the server.
- Preserve compatibility when job creation or assignment is unavailable by
  retrying without containment and terminating an owned process handle instead.
- Use the process-group member fallback when terminating piped processes on
  macOS.

## Testing

- Cover descendant cleanup and breakaway prevention for both local MCP protocol
  modes on Windows.
- Cover the Windows nested-job assignment fallback and verify the suspended
  process resumes before handle-based termination.

GitOrigin-RevId: 33d3cc122de8f7ce0ae69a649b12ea0ff64b7c6f
2026-08-07 03:34:49 +00:00
Abhinav
81b9bc2109 Recognize MCP tool hook configurations (#37363)
## What changed

- Parse `mcp_tool` hook handlers with a server, tool, JSON input, and optional timeout and status message.
- Return managed MCP tool hooks from `configRequirements/read` and include the handler in the generated protocol schemas.
- Skip MCP tool hooks during discovery with an explicit warning until execution is supported.

## Testing

- Cover MCP tool hook deserialization, including nested and null JSON input values.
- Extend the config requirements RPC test to verify the new handler shape.

GitOrigin-RevId: ff7e2d12b75b486c54d63469af547a29f9b31418
2026-08-07 03:30:29 +00:00
Eric Traut
5bdc889708 Use consistent TUI input placeholders (#37360)
## What changed

- Show `Ask Codex to do anything` in the main conversation input.
- Show `Ask a follow-up question` in side conversation inputs.
- Remove randomized example prompt selection and update the side conversation snapshots.

GitOrigin-RevId: 2f6d310cf80bfa9743b7695621892a821eda4a18
2026-08-07 02:50:32 +00:00
Eric Traut
2801d12661 Add Markdown conversation export to the TUI (#37358)
## What changed

- Add `/export` with clipboard and file destinations, including a default filename prompt and support for an explicit path argument.
- Export the complete conversation history as structured Markdown, preserving user and assistant messages, plans, reasoning, activity, image labels, file changes, and MCP tool details while honoring reasoning visibility.
- Fall back to legacy history loading when pagination is unavailable, and use the visible transcript for ephemeral sessions.
- Resolve relative and home-relative paths without overwriting an existing file, and report export or copy results in the conversation.

## Testing

- Cover Markdown rendering, hidden review prompts, activity details, complete paginated and legacy history loading, destination prompts, status messages, path resolution, and overwrite protection.

GitOrigin-RevId: c2815fc2430d7a555da75d7038cc1ac08157b82e
2026-08-07 02:45:35 +00:00
Adam Perry @ OpenAI
4d7e3e90d9 Clamp short wait_agent timeouts to the configured minimum (#37357)
## What changed

- Clamp `wait_agent` timeout requests below `min_wait_timeout_ms` instead of rejecting them.
- Include the timeout adjustment in the wait result message and document it in the tool output schema.

## Testing

- Update the handler test to verify the configured minimum is honored and the adjustment is reported.
- Update the schema test for the expanded result message.

GitOrigin-RevId: 2b4a770ed6d1e9c45b351b479f5ae50c9a3d5388
2026-08-07 02:34:46 +00:00
Anton Panasenko
b94343ab9f Support agent identity endpoint overrides (#37356)
## What changed

- Honor `CODEX_AGENT_IDENTITY_AUTHAPI_BASE_URL` and
  `CODEX_AGENT_IDENTITY_JWKS_BASE_URL` when registering and verifying agent
  identities.
- Normalize override values by trimming whitespace and trailing slashes.
- Preserve ChatGPT environment validation, while allowing a custom launcher
  configuration when its ChatGPT and JWKS base URLs match and an AuthAPI
  override is explicitly configured.

## Testing

Added coverage for explicit staging overrides, custom launcher compatibility,
and rejection of overrides that would bypass environment validation.

GitOrigin-RevId: c557c8167ec101c2993f65aad3fcb3bf25785d51
2026-08-07 02:30:18 +00:00
jif
9afb96faff Retry busy app-server test executable spawns (#37354)
## Why

App-server integration tests can encounter a transient `ExecutableFileBusy`
error while starting their server process.

## What changed

Retry that specific spawn failure up to twice with a 10 ms delay, while
returning all other spawn errors immediately.

GitOrigin-RevId: 0982a9fe66bae4c41f556c845d12fb515dbf752c
2026-08-07 02:06:40 +00:00
pakrym-oai
d0c8f422ea Configure the default code-mode exec yield timeout (#37352)
## What changed

- Add `features.code_mode.default_exec_yield_time_ms`, defaulting to 30 seconds.
- Apply the configured default to code-mode `exec` calls that omit `yield_time_ms` and reflect it in the tool description.
- Remove the `code_mode_buffered_exec` compatibility feature flag.

## Testing

- Cover config loading and tool descriptions for both default and custom yield timeouts.

GitOrigin-RevId: 581ffc737b04721c7b5fc81260b1da1cf7d87523
2026-08-07 01:41:54 +00:00
keith thornhill
9457f8f734 Allow ThreadManager to customize thread ID generation (#37350)
## What changed

- Add `ThreadManager::with_thread_id_generator` to configure ID allocation for new root, child, and forked threads.
- Keep the standard UUIDv7 generator as the default and preserve stored IDs when resuming threads.
- Add `ThreadId::from_u128` for constructing identifiers from UUID-compatible values.

## Testing

- Cover default allocation, custom IDs across roots, child agents, and forks, and ID preservation on resume.

GitOrigin-RevId: 6c38c862e30a50bad944a994bcbccf7d1e7ada24
2026-08-07 01:36:22 +00:00
viyatb-oai
912524d6fe Mount a minimal /dev in full-filesystem Bubblewrap sandboxes (#37349)
## Why

Binding the full host filesystem into a network-isolated Bubblewrap sandbox also
inherits the host's device tree.

## What changed

- Overlay `/dev` with Bubblewrap's minimal device filesystem while preserving
  the root bind's `nodev` behavior.
- Bind `/dev/shm` back into the sandbox when available so host and sandbox
  processes can continue to share memory files.

## Testing

Add a managed-proxy integration test that verifies standard device nodes remain
usable, `/dev` is not the host directory, and `/dev/shm` writes are shared with
the host.

GitOrigin-RevId: 1d91fe44affd792d2777adae8f2cce6d85d14103
2026-08-07 01:30:07 +00:00
Owen Lin
4bb7ee3472 Add rollout migration tooling and background migration (#37348)
## What changed

- Add `codex migrate-rollouts` with dry-run inspection by default, explicit `--apply`, thread filtering, optional I/O throttling, progress output, and JSON or verbose reports.
- Add the disabled-by-default `background_paginated_rollout_migration` feature to migrate legacy local sessions at startup before rollout compression begins.
- Persist a migration cursor and skipped-file fingerprints so later startups avoid full rescans while retrying changed files and recovering pending migrations.
- Coordinate migration with live writers and emit metrics for manual and startup runs.

## Testing

- Cover startup cursor advancement and lookback, pending migration recovery, live-writer coordination, changed empty rollouts, and progress reporting.

GitOrigin-RevId: 276ac506c50ebec5140fd319faca1bb998172061
2026-08-07 01:26:42 +00:00
Boyang Niu
69b6152c17 Track context windows per agent (#37347)
## Why

Forked subagents can inherit a parent's compacted history, but their context-window metadata needs to identify the child and start a distinct window lineage.

## What changed

- Always identify context windows by agent name and remove the `features.token_budget.mode` setting.
- Persist the agent path in world state and emit context-window metadata as a standalone developer message when the identity changes.
- Reset inherited compaction metadata to the forked subagent's initial context window and restore that window in session state.

## Testing

Extend the full-history subagent test to verify parent and child world-state snapshots, agent identities, distinct window IDs, and the reset child checkpoint.

GitOrigin-RevId: 6584201e57b3d2fba0ce626b89a8b3b0b3c752db
2026-08-07 01:05:33 +00:00
thorvald-oai
270d93268c Send model routing hints to the Codex backend (#37345)
## What changed

- Add an `x-codex-routing-hint` header containing the request model and, when selected, the service tier.
- Send the hint on Responses HTTP requests, remote compaction requests, and WebSocket handshakes, including prewarm connections.
- Limit the header to Codex-backend authentication with the OpenAI provider, omitting it for API-key and provider-specific credential paths.

## Testing

- Cover routing hints for HTTP, remote compaction, WebSocket streaming, and tiered prewarming, along with the credential paths where the header must be absent.

GitOrigin-RevId: d8d415d7fadddecf9a132d05920b856a35ac9960
2026-08-07 00:58:54 +00:00
jif
4ffeddcbcc Fix subagent MCP startup status settling (#37344)
## Why

Subagents can leave cached MCP servers deferred indefinitely, causing the TUI to keep showing MCP startup as running after every server that reported startup has settled.

## What changed

- Clear configured MCP startup expectations for active subagent threads so their status is driven by actual startup notifications.
- Preserve configured-server startup tracking for primary threads and side conversations.

## Testing

Add coverage for active and resumed subagents with deferred servers, plus the existing side-conversation behavior.

GitOrigin-RevId: 4d929a162dd067b4a76351652a764a79ce60f31f
2026-08-07 00:50:33 +00:00
jif
a9da0bdbac Stage Bazel app-server test binaries in TEST_TMPDIR (#37343)
## Why

Bazel test binaries can reside on a different filesystem from the default
temporary directory, forcing executable staging to fall back from hard links to
expensive copies.

## What changed

Create the app-server test install layout under Bazel's `TEST_TMPDIR` when it is
set. Continue using the default temporary directory outside that environment.

GitOrigin-RevId: 63172fbf913ddba06c7b9543b5bf0fea249c903c
2026-08-07 00:46:23 +00:00
jif
bcea6447ee Preserve foreign cwd URIs for turn-input contributors (#37342)
## Why

Converting each environment's working directory to a host-native path caused
turn-input contributors to omit environments with foreign path formats.

## What changed

- Expose `TurnInputEnvironment.cwd` as a `PathUri`.
- Pass every turn environment to contributors without host-path conversion.

## Testing

Added an integration test that submits a foreign working-directory URI and
verifies the contributor receives the environment unchanged.

GitOrigin-RevId: a122526be47f5331614381e9c6e4b85087a96bed
2026-08-07 00:42:06 +00:00
Philipp Spiess
29dce2db43 Support content references for inline visualizations (#37341)
## What changed

- Recognize structured `visualize` content references alongside the existing inline visualization directive in cached, streaming, and finalized TUI rendering.
- Resolve absolute visualization paths only when they belong to the active thread directory, and show the existing unavailable fallback for incomplete, invalid, or out-of-scope references.
- Let embedded visualizations inherit host color, typography, and radius tokens while retaining standalone defaults and legacy aliases. Keep Lucide icons at a stable size when model-authored chart styles are present.

## Testing

- Cover content-reference fallback, replay, render-cache bypass, and canonical streaming behavior.

GitOrigin-RevId: 887d13647df11c23d519e64d0958fdc41ef3f472
2026-08-07 00:37:50 +00:00
TAFOYA-OAI
f8ac8fa6c6 Consolidate deferred environment provisioning APIs (#37340)
## What changed

- Remove the separate deferred registration handle, direct readiness publisher,
  and Noise environment upsert API from `EnvironmentManager`.
- Use `report_environment_provisioning_status` and
  `materialize_pending_noise_environment` as the provisioning flow while keeping
  ordinary environments isolated from provisioning reports.
- Cover readiness updates, invalid reports, duplicate materialization, and
  conflicts with ordinary environments in the deferred environment tests.

GitOrigin-RevId: d14207c0abb0636d331be4f875fec6e53f3d2fe6
2026-08-07 00:32:59 +00:00
jif
d9eac10406 Reload app-server telemetry after account changes (#37339)
## Why

An account change can select different OpenTelemetry collector settings. The
long-running app server needs to stop exporting telemetry with the previous
account's configuration.

## What changed

- Rebuild and install the log, trace, and metrics exporters when authentication
  changes, and shut down the previous provider without blocking the app server.
- Make cached global metrics clients and the tracing layer follow the replacement
  provider so existing callers continue exporting through the current account's
  configuration.
- Clear the cached cloud configuration loader after login and logout so telemetry
  reloads from the new account context.

## Testing

- Add an app-server integration test that switches accounts and verifies logs,
  traces, and metrics reach the new collector while trace context is preserved.
- Add a metrics test covering cached clients after provider replacement.

GitOrigin-RevId: a74359777a35edbee5bbe0b2baccc155074cb172
2026-08-07 00:28:32 +00:00
yijiang12
842547640e Honor the configured ChatGPT origin in connector install URLs (#37338)
## What changed

- Build connector install URLs from `CODEX_APP_SERVER_CHATGPT_BASE_URL`, falling back to `https://chatgpt.com` when it is unset.
- Strip a trailing slash or `/backend-api` suffix before appending the `/apps/<slug>/<connector-id>` path.
- Add a test covering install URL generation with the configured origin.

GitOrigin-RevId: 854d15b7e322d2359684f974aaf27fe28205dd5a
2026-08-07 00:23:38 +00:00
jif
b3ffe3d001 Recover MCP servers after OAuth reauthentication (#37337)
## Why

An OAuth-backed Streamable HTTP MCP server can fail startup when its stored credentials are rejected. If a client then completes OAuth sign-in and replaces those credentials, the failed server needs to become available without restarting the Codex session.

## What changed

- Track the credential store and OAuth tokens used for each MCP connection, and detect replacements after authentication failures.
- Refresh affected MCP servers before the next turn and include their recovered tools in the model request.
- Classify HTTP authentication challenges and rejected refresh tokens as requiring reauthentication, with sign-in guidance appropriate to local and client-managed environments.

## Testing

- Cover recovery from expired credentials through an externally written replacement token.
- Cover authentication-error classification, startup messaging, and `Auto` store migration from file credentials to the keyring.

GitOrigin-RevId: 9b090089d4e7a44ffc182f4e25da20a18e97b70f
2026-08-07 00:17:46 +00:00
jif
7257826ab2 Use step environments for extension turn input (#37336)
## Why

Environment readiness can change between sampling requests. Extension turn-input contributors should receive the same refreshed environment snapshot used by the current step.

## What changed

Build `TurnInputContext.environments` from `StepContext` so newly ready environments are included in extension input for the current request.

GitOrigin-RevId: ee4444072162317974cd2bbfd57ffcf9a9445391
2026-08-07 00:13:31 +00:00
Felipe Coury
303a292581 Fully repaint inline viewports after history overlap (#37335)
## Why

During inline-mode resize reflow, replayed history can overlap a zero- or
one-row history region and leave stale terminal characters visible in the
composer. Resetting the previous render buffer is insufficient because
default-style spaces may still compare equal and be skipped.

## What changed

- Mark every cell in an invalidated viewport for unconditional repainting.
- Invalidate the viewport after flushing pending history when history can
  overlap it.

## Testing

Add regression coverage for repainting spaces over stale cells and a manual
`tmux` resize smoke test for preserving visible multiline draft text.

GitOrigin-RevId: 5a8a480e2fc50c801561de6a4598a3ab8c12b8d6
2026-08-07 00:05:41 +00:00
jif
57f42a8113 Avoid cloning immutable metadata on tool search cache hits (#37279)
## Why

Checking the tool search cache currently rebuilds search metadata for every deferred tool, even when an immutable tool runtime has not changed.

## What changed

- Track immutable deferred tools by runtime identity and dynamic tools by their current search metadata.
- Rebuild the search handler when the deferred registry, dynamic metadata, or source-listing mode changes.
- Keep only weak references to immutable runtimes in the cache.

## Testing

Added unit coverage for immutable handler reuse, registry and exposure changes, source-listing changes, and refreshed dynamic tool metadata.

GitOrigin-RevId: 024c6f4498d431e7bbfaecde420f77fcf8c0dba7
2026-08-06 14:11:35 +00:00
jif
e1831db7c3 Reuse MCP handlers across sampling steps (#37273)
## Why

MCP tool handlers and their Code Mode definitions are immutable for the lifetime
of a stable MCP binding, so rebuilding them for every sampling step repeats schema
construction unnecessarily.

## What changed

- Cache MCP handlers per session and reuse them while the same binding remains
  active, invalidating the cache when the binding changes.
- Lazily cache schema-free Code Mode definitions on MCP handlers while continuing
  to rebuild definitions for step-local tools whose specifications may change.
- Reapply current app enablement, tool policy, exposure, and plugin schema budgets
  whenever cached handlers are registered for a step.

## Testing

- Cover handler and Code Mode definition reuse, binding invalidation, changing app
  policy, stable continuation schemas, and step-local custom tool updates.

GitOrigin-RevId: 69c5011fb97c08580ac476e7fb2286b1e92e0359
2026-08-06 13:37:07 +00:00
felixxia-oai
bfb6a6ea22 Support plugin roots in the host skill loader (#37267)
## What changed

- Carry plugin identity, namespace, root, and discovery mode through host skill loading.
- Apply the owning plugin namespace and IDs to loaded skill metadata.
- Respect direct-child discovery for Agent Plugins and reject skills that resolve outside the plugin root or are not regular files.
- Preserve recursive discovery and symlink behavior for legacy plugin roots, and allow the full 64-character namespace plus 64-character skill name.

## Testing

Add host-loader coverage for plugin metadata, namespace ownership, direct-child filtering, path containment, recursive symlinks, shared assets, and maximum-length qualified names.

GitOrigin-RevId: cdde821643ce39bd030d0c3753b3304b75161690
2026-08-06 12:44:36 +00:00
jif
1151b23f01 Start cached MCP servers lazily for subagents (#37261)
## Why

Subagents can reuse cached MCP tool definitions without starting every optional
server before any of its tools are used.

## What changed

- Defer startup for subagent-owned, optional MCP servers when their cache has at
  least one visible, allowed tool, and trigger startup on the first operation
  that needs the live client.
- Keep root sessions, required servers, selected plugin servers, and explicit
  reconnects eager.
- Exclude empty catalogs from cache eligibility and keep dormant servers out of
  the initial startup summary.

## Testing

- Extend MCP tool-cache coverage for eager root startup, unused and filtered
  subagent servers, deferred startup status events, and startup that survives an
  interrupted first tool call.

GitOrigin-RevId: e7528ff08312583a6747cbc6550ea5b6eabda9a6
2026-08-06 11:18:24 +00:00
jif
a17da5e6e4 Fix first-turn model switching and rollback (#37260)
## Why

A model switch on the first turn has no prior turn settings to compare, and rolling that turn back could leave its model instructions in history.

## What changed

- Track the model that supplied the session's base instructions so first-turn switches inject the target model's instructions, including the selected personality.
- Preserve inherited custom base instructions when starting from an empty fork.
- Remove first-turn model-switch developer content during rollback so retries and cold resumes do not retain or duplicate stale instructions.

## Testing

Add integration coverage for first-turn switches, personality changes, empty-prefix forks, rollback retries, and cold resume.

GitOrigin-RevId: 9df532e9e337521ad3b315b77f8c98e039fb384e
2026-08-06 11:03:31 +00:00
jif
82b17bc724 Allow agent roles on full-history forks (#37252)
## Why

Multi-agent v2 rejected `agent_type` when `fork_turns` was `all`, forcing callers to choose between a configured role and the parent's full conversation context.

## What changed

- Apply an explicitly selected role to full-history forks, including its model and developer instructions.
- Preserve the parent's developer instructions when the selected role does not define its own.
- Keep the inherited conversation history and model-switch context intact.
- Update the `spawn_agent` schema to clarify that roles apply independently of history inheritance.

## Testing

- Cover full-history role overrides and developer-instruction precedence in multi-agent v2 tests.

GitOrigin-RevId: cd4f35e31d75f56289760f245bff38dd0233abe6
2026-08-06 10:27:33 +00:00
jif
74b8f8db93 Cover remote MCP discovery timeout cleanup (#37248)
## What changed

Extend the executor-backed Streamable HTTP timeout test to cover both legacy
`initialize` and MCP 2026 `server/discover` requests. Verify that each stalled
handshake times out and releases the serial executor for subsequent requests.

GitOrigin-RevId: 3493904433c95265b9f645813723e890b7610abb
2026-08-06 09:46:04 +00:00
kevinlin-openai
7a0e974e08 Harden network proxy MITM authorization (#37211)
## Why

MITM hooks authorize requests before the upstream server parses them. Paths that
can be decoded or normalized to a different resource must not match an allowed
path, and hosts that require MITM inspection must not bypass it through the
plain HTTP proxy path.

## What changed

- Reject ambiguous hook paths, including traversal segments, backslashes,
  malformed percent encodings, and encoded separators or percent signs.
- Block plain HTTP proxy requests for hosts whose policy always requires MITM,
  recording the decision as `mitm_required`.

## Testing

- Cover safe and ambiguous path forms, encoded traversal through repository
  allowlists, and absolute-form HTTPS requests sent to the HTTP proxy.

GitOrigin-RevId: 8812a980ac64a97cbac3a237376d29be5ded9220
2026-08-06 03:57:10 +00:00
Matthew Zeng
1ae82ce6a5 Fetch remote installed plugins across all scopes (#37210)
## What changed

- Fetch the paginated installed-plugin snapshot without a `scope` query instead of issuing separate requests for global, user, and workspace plugins.
- Use the combined snapshot for installed-plugin caching and bundle synchronization while continuing to reconcile each scope's marketplace independently.

## Testing

- Cover pagination across mixed scopes, request query parameters, marketplace reconciliation, stale cache cleanup, and discoverable-plugin filtering.

GitOrigin-RevId: 7428a9db81d7ec04e65cc4b236b652278b200956
2026-08-06 03:53:05 +00:00
Curtis 'Fjord' Hawthorne
0a0ebb8535 Add a unified image budget (#37206)
## What changed

- Add the gated `unified_image_budget` feature for models that support original image detail or Responses Lite.
- Apply one 6,000-pixel, 10,000-patch preprocessing limit regardless of legacy image detail hints.
- Hide detail controls from `view_image` and code mode while continuing to accept existing hints for compatibility.
- Preserve detail-based resizing and tool contracts for unsupported models.

## Testing

- Cover unified resizing limits, Responses Lite, legacy detail hints, unsupported models, and `view_image` integration in code mode.

GitOrigin-RevId: cb07bff1669a96599fdfd076b3d9ec80f2b6fff7
2026-08-06 03:15:08 +00:00
efrazer-oai
bc8b25ea02 Add durable user-message queue dispatch (#37204)
## What changed

- Add a storage-neutral queue extension for listing, adding, editing, reordering, deleting, and explicitly starting queued user messages.
- Dispatch queued messages in FIFO order when a thread becomes idle after a completed turn, while leaving them queued after interruptions or failures.
- Wait for user input to be persisted before removing its queue item, and report hook rejection, task termination, and persistence failures distinctly.
- Snapshot local image and audio attachments into validated data URLs before storing them, enforce input limits, and emit `ThreadQueueChanged` events after mutations.

## Testing

- Cover queue mutations, automatic and explicit dispatch, interruption and failure behavior, hook rejection, invalid records, input limits, and local attachment snapshotting.

GitOrigin-RevId: 14f39d7c8cbaccb767a6da84b82cced0edfcb4b9
2026-08-06 03:11:42 +00:00
Eddie Chen
70b4653232 Track thread archive analytics (#37199)
## What changed

- Emit `codex_thread_archive_event` when a thread is successfully archived or
  unarchived, including the thread ID, action, and producer timestamp.
- Route archive notifications through the analytics client while preserving
  normal app-server notification delivery.

## Testing

- Extend app-server coverage for archive and unarchive analytics, including
  descendant archives and a repeated archive request that fails without
  producing another event.

GitOrigin-RevId: 0d973c232fd795b7cd6cddd47ecc9446234c44dd
2026-08-06 02:30:18 +00:00
Brent Traut
547080e4d6 Prefer persisted cwd when reading local threads (#37198)
## Why

The `cwd` recorded in a rollout can become stale after thread metadata is
updated, causing thread reads and lists to disagree with the persisted state.

## What changed

- Overlay a non-empty state database `cwd` when reading a thread by ID.
- Apply the same overlay when reading by rollout path, but only when the
  metadata points to the requested rollout.
- Recompute the permission profile against the selected `cwd` and continue to
  fall back to rollout metadata when the persisted `cwd` is empty or belongs to
  another rollout.

## Testing

- Cover stale, empty, and mismatched persisted `cwd` metadata.
- Verify that `thread/read`, state-only `thread/list`, and `thread/resume`
  report the persisted thread `cwd` while the resumed session uses its requested
  live `cwd`.

GitOrigin-RevId: 50a3f187618ee3cadbad95196ee2976e2d5e9a5a
2026-08-06 02:26:24 +00:00
Owen Lin
aac9f84247 Preserve legacy semantics during rollout migration (#37191)
## Why

Legacy rollouts can contain historical rollbacks, compaction checkpoints, and
subagent copies of parent history. Migrating those records verbatim can change
the visible conversation or the model context used when a thread resumes, and
can retain large amounts of duplicated subagent history.

## What changed

- Plan and replay historical rollbacks by logical turn, preserving surviving
  lifecycle events and the correct compaction anchor for future resumes.
- Migrate subagent rollouts from a safe bounded replay when possible and record
  the history boundary so copied parent context is not projected as child turns.
- Include archived and compressed rollouts while keeping their storage form and
  location intact.
- Tolerate malformed, partial, oversized, and empty JSONL records during the
  migration scan.

## Testing

Add coverage for rollback and compaction combinations, subagent replay bounds,
archived and compressed rollouts, recovery, concurrent maintenance, and damaged
JSONL input.

GitOrigin-RevId: 3948e16d43f75df8571b0a92af12a181d1d08fdf
2026-08-06 00:54:14 +00:00
andrewgu-oai
f141dc77f0 Interrupt cyber model turns after one Guardian denial (#37190)
## What changed

- Add a Guardian circuit-breaker policy for models whose catalog specialty is
  `cyber`.
- Interrupt those models after the first Guardian denial while retaining the
  existing denial thresholds for other models.
- Centralize the `cyber` model-specialty identifier for use across core,
  protocol, app-server, and TUI code.

## Testing

- Cover the cyber-specific threshold in the circuit-breaker unit tests.
- Verify end to end that a denied command is not executed and the turn is
  interrupted after one denial.

GitOrigin-RevId: fad24c9e7aa280432580db1f0e39d13535779710
2026-08-06 00:37:46 +00:00
Adam Perry @ OpenAI
92b83e226d Track multi-agent usage hints in world state (#37189)
## Why

Resumed sessions need the current multi-agent usage instructions when configuration changes or the saved history predates usage-hint tracking.

## What changed

- Store multi-agent usage hints in world state and refresh changed or previously untracked hints before re-emitting the active multi-agent mode.
- Present `wait_agent` polling guidance in the overridable developer instructions only when the tool is enabled, instead of embedding it in the tool schema.

## Testing

- Cover cold resumes, changes to `wait_agent` availability, custom usage hints, message ordering, and tool-schema behavior.

GitOrigin-RevId: a9c6798d5dc2dedc8dadc49e0a80ff50a757ab83
2026-08-06 00:22:06 +00:00