Commit Graph

4087 Commits

Author SHA1 Message Date
Shijie Rao
20465d30ae Suppress empty multi-agent mode messages (#33862)
## What changed

- Treat an empty custom `multi_agent_mode_hint_text` as having no instructions to emit.
- Avoid adding an empty multi-agent mode message both on the initial turn and when the configured hint changes after resuming a session.

## Testing

- Update the empty-hint integration test to assert that no mode message is sent.
- Add resume coverage that verifies changing a custom hint to an empty string emits no update.

GitOrigin-RevId: 8033292115936fac2cf22f85141278595804ee61
2026-07-17 16:10:50 +00:00
jif
e0ac6d0ec9 Test workspace write isolation across exec servers (#33861)
## What changed

Add a Unix integration test that starts two `exec-server` environments with
separate workspace roots. Verify that each environment can write within its own
workspace while cross-workspace writes are denied.

GitOrigin-RevId: 98f2f58b97c1dcca8e103702b067c65d4eeed0c4
2026-07-17 16:07:24 +00:00
jif
41ad08c1a6 Isolate core tests from shell and rollout persistence (#33858)
## Why

The shared core test harness does not need to spawn a login shell for every
test, and approval scenarios exercise tool behavior rather than rollout
persistence.

## What changed

- Disable `ShellSnapshot` by default in `test_codex()`; snapshot-specific tests
  can continue to opt in explicitly.
- Give each approval scenario a named in-memory thread store so it does not use
  durable rollout storage.

GitOrigin-RevId: 787670857aa4f77d5fc442ec1e0bfe6d22314f63
2026-07-17 15:58:05 +00:00
jiayuhuang-openai
b03545b5b8 Stream realtime V3 Codex handoff output (#33856)
## What changed

- Stream V3 agent message deltas to `delegation.context.append` at 200 ms intervals instead of waiting for each completed message.
- Send commentary without a prefix and label final or phase-less V1/V3 output with `"Agent Final Message":`.
- Bound streamed output while preserving both its beginning and final tail when truncation is required.
- Remove `codexResponseHandoffPrefix` from `thread/realtime/start`; unknown fields from older clients remain ignored.

## Testing

- Cover incremental V3 commentary and final output, Unicode-safe truncation, V1/V3 phase labeling, and legacy request compatibility.

GitOrigin-RevId: 633c18b5eb9a4f5756a264b63b7bfc185b073951
2026-07-17 15:54:33 +00:00
guinness-oai
22f413bdbf Tag realtime transcript tail flush delegations (#33855)
## What changed

- Add `<source>transcript_tail_flush</source>` to realtime delegation payloads
  emitted when a session flushes its remaining transcript tail.
- Keep explicit realtime handoff payloads unchanged.
- Render both delegation variants through a shared contextual user fragment.

## Testing

- Update realtime conversation tests to cover tagged transcript-tail flushes and
  preserve the existing handoff format and XML escaping behavior.

GitOrigin-RevId: 33f70d16cf45b3af8068565c4cf2b1785be3f1d9
2026-07-17 15:50:13 +00:00
Bryan Ashley
08e30a2e4e Add batched executor capability discovery (#33852)
## Why

Selected capability roots can contribute plugins, MCP servers, connectors, and
skills. Discovering each contribution separately requires repeated access to the
executor filesystem.

## What changed

- Add the `capabilityRoots/discoverV1` exec-server RPC to scan selected roots and
  materialize recognized plugin manifests, configuration files, skill
  instructions, and skill metadata in one bounded request.
- Add the opt-in `executor_capability_discovery` feature, with a thread-scoped
  cache and per-step snapshot shared by MCP and skill discovery.
- Parse MCP, connector, and skill contributions from the materialized snapshot,
  including serving cached skill instructions without another filesystem read.

## Testing

- Cover discovery limits, manifest precedence, root-local failures, cache reuse,
  plugin contributions, and parity with the existing environment skill loader.

GitOrigin-RevId: f98fd2321cafb58c596db02da1f83c09d8eb375d
2026-07-17 15:45:48 +00:00
Celia Chen
315195492c Support custom transports for Amazon Bedrock (#33695)
## What changed

- Allow the built-in `amazon-bedrock` provider to override `base_url`, `auth`,
  and `http_headers` in addition to its AWS profile and region.
- Use command-based bearer authentication and configured endpoints without
  applying AWS request signing, while retaining regional endpoint resolution
  for the default Bedrock configuration.
- Replace the Bedrock account `credentialSource` enum with the
  `usesCodexManagedCredentials` boolean so command-authenticated and other
  externally managed configurations are reported consistently.

## Testing

- Cover configuration merging and validation, command-authenticated proxy
  requests with custom headers, and account reporting for managed and external
  credentials.

GitOrigin-RevId: d1acbe602060470583b5e12f8d304bee5be46f4c
2026-07-16 21:41:00 +00:00
yongjun-oai
f737605606 Reword the apply_patch tool description (#33680)
GitOrigin-RevId: 4d44f0c61578cbce04a4f6dffdba4833c39f4491
2026-07-16 19:49:32 +00:00
charleschen-oai
78ba047bda Forward thread originators from standalone extensions (#33677)
## Why

Standalone web search and image requests need to preserve the trusted,
thread-scoped originator used for billing attribution.

## What changed

- Seed extension data with the resolved thread originator and recognize
  `codex_work_cca` and `chatgpt_cca` service names as originators.
- Forward non-default originators from the web search and image generation
  extensions with the shared originator-header helper.

## Testing

- Cover originator resolution, header validation, and forwarding for web
  search, image generation, and image editing.

GitOrigin-RevId: 165dace8e4d24e4bd92f234bff5ec77a21a7ff6e
2026-07-16 19:31:26 +00:00
sayan-oai
71448a29e7 Refresh step world state for all sessions (#33665)
## Why

Changes to the selected working directory can select different `AGENTS.md`
instructions. These updates need to reach the model even when the deferred
executor feature is disabled.

## What changed

- Refresh environment readiness and `AGENTS.md` before capturing each step.
- Record model-visible world-state changes for every session instead of gating
  them on the deferred executor feature.
- Preserve the initial environment context without duplicating it.

## Testing

- Cover `AGENTS.md` replacement after a working-directory change.
- Verify that initial environment context remains unique with the deferred
  executor both enabled and disabled.

GitOrigin-RevId: ea5dbe590cc049170259e7eccb6a3346fb2ed8e6
2026-07-16 18:45:42 +00:00
rka-oai
5331d20f6e Require data URLs for code-mode image output (#33659)
## What changed

- Accept image output from `image()` and `generatedImage()` only when its URL
  uses the `data:` scheme.
- Preserve the dedicated error for remote HTTP URLs and report other malformed
  or unsupported image URLs as invalid image output.

## Testing

- Add service-level coverage for rejecting invalid output from both image
  helpers.
- Add an end-to-end code-mode test that verifies the tool call fails instead of
  returning an invalid image item.

GitOrigin-RevId: beaf8c8830574150e8166b6ff5daf7f6dc4dc0a1
2026-07-16 18:28:59 +00:00
sayan-oai
c4ce0493dc Keep active-turn environments stable across settings updates (#33658)
## Why

With deferred execution enabled, rebuilding a step context from the latest
thread environment snapshot could apply a settings update to a turn that was
already in progress.

## What changed

- Preserve each turn's captured environment selections when creating later
  step contexts.
- Refresh only the readiness of environments that were already starting, while
  retaining their original selection order.
- Apply updated environment selections to the next turn.

## Testing

Add coverage for changing the selected workspace while a turn is paused,
verifying that the active turn keeps its original working directory and the
next turn uses the new one.

GitOrigin-RevId: c6f4388c843384ef045b7abdbc303dcfca11d230
2026-07-16 18:23:43 +00:00
jif
b7983c2a07 Restore agent roles when reloading v2 sub-agents (#33657)
## Why

Durable v2 sub-agents can be lazily reloaded after their root session resumes. The reload path restored the agent identity but did not reapply the agent's selected role configuration.

## What changed

- Recover the agent role from the resumed session source and apply it before reloading the sub-agent.
- Preserve the runtime approval policy, approval reviewer, working directory, and permission profile while applying the role.

## Testing

Extend the cold-resume integration test to verify that the reloaded worker retains its role-defined instructions, model, provider, reasoning effort, and permission profile.

GitOrigin-RevId: a26dbbd2599838ca317326a1223a6a0a9cb2a2ed
2026-07-16 18:20:14 +00:00
jif
8a7c854bff Validate reasoning effort after applying spawn roles (#33656)
## Why

Agent roles can override the model or reasoning effort after the initial
`spawn_agent` configuration is validated, leaving an unsupported combination
unchecked.

## What changed

- Validate the final reasoning effort against model metadata whenever a role
  changes the spawned agent's model settings.
- Preserve independently configured subagent defaults when a role does not
  override them.
- Apply the same role validation in both multi-agent spawn implementations.

## Testing

Added coverage for independent model and reasoning defaults, instruction-only
roles, and rejection of a reasoning effort unsupported by a role-selected
model.

GitOrigin-RevId: 1885314e9380f778603f067fc04a6225ee963428
2026-07-16 18:16:44 +00:00
pakrym-oai
f64233d142 Run write_stdin concurrently across terminal sessions (#33645)
## What changed

- Allow parallel `write_stdin` tool calls to interact with independent terminal sessions.
- Serialize reads and writes within each session so its output buffer and process lifecycle remain consistent.
- Prevent active sessions from being pruned while a `write_stdin` interaction is in progress.

## Testing

- Added unified exec and code mode coverage that uses two terminal sessions concurrently and verifies output from both.

GitOrigin-RevId: 618f5503f4c4670421f680c0f0c27414bc6b2ddd
2026-07-16 16:58:41 +00:00
sayan-oai
aff7c69659 Clarify when to wait for starting environments (#33636)
## Why

An execution environment marked `starting` is not yet usable, but unrelated work can continue while it becomes ready.

## What changed

- Add developer guidance that explains execution-environment isolation and the resources that become available after startup.
- Tell the model to wait only when the current task needs the starting environment.
- Retain the guidance across world-state updates without duplicating it in request history.

## Testing

- Cover world-state transitions, history retention, rollback handling, and deferred-environment request deduplication.

GitOrigin-RevId: f12f9204d4cbddce50a70eb0998beb6b66cd2fa9
2026-07-16 16:27:22 +00:00
sayan-oai
41efc6333e Clarify when to wait for starting environments (#33633)
## What changed

- Tell the model to call `wait_for_environment` only when a task needs the selected environment's files, commands, or installed capabilities.
- Document that waiting can take several minutes and blocks other tool calls, and direct the model to continue if startup fails.
- Require the exact `starting` environment ID shown in `<environment_context>`.

GitOrigin-RevId: 6b434b835d379318879d5499c365c70598673afd
2026-07-16 16:17:43 +00:00
pakrym-oai
5a85351dfe Remove generated-default filesystem path variants (#33632)
## What changed

- Represent built-in filesystem policy entries with the same `Path` and
  `Special` variants used by other entries.
- Remove generated-default filtering from Windows sandbox policy resolution and
  simplify elevated deny-write handling to rely on direct-runtime enforcement
  and the legacy policy projection.
- Update protocol conversions, policy transforms, and profile expectations for
  the reduced filesystem path model.

GitOrigin-RevId: a65793e6855a03d52a575e82cb3d4b9b2e32db5c
2026-07-16 16:13:53 +00:00
jif
21c37fb374 Honor configured model defaults for spawned agents (#33631)
## What changed

- Apply `agents.default_subagent_model` and
  `agents.default_subagent_reasoning_effort` when a spawn request does not
  provide explicit values, including agent job workers.
- Allow full-history forks to use configured defaults or explicit model and
  reasoning-effort overrides while retaining the parent conversation context.
- Preserve the selected model and reasoning effort when an agent role does not
  override them.

## Testing

- Cover configured defaults, explicit override precedence, full-history forks,
  role application, and agent job workers.

GitOrigin-RevId: b1efa8c9abeee82355088fceef57560433144595
2026-07-16 16:08:43 +00:00
jif
9ff47868eb Expose spawn agent types only when roles are configured (#33572)
## Why

The `agent_type` argument is only useful when agent roles are configured. Avoid
advertising an inapplicable override in the model-visible `spawn_agent` schema.

## What changed

- Include `agent_type` in the V1 and V2 spawn tools only when configured roles
  are available.
- Clarify that `agent_type` is an explicit override and document its interaction
  with context forking.
- Remove the unused `agents.support_agent_type` configuration field.

## Testing

- Add coverage for hiding `agent_type` without roles and exposing it when a role
  is configured.

GitOrigin-RevId: 32e0f123b15f317e9cdb71774029375bc073d9ad
2026-07-16 10:28:36 +00:00
jif
03bb3b1236 Unify multi-agent settings under agents (#33550)
## What changed

- Add `agents.enabled` as a user override for multi-agent tools while keeping an enabled `features.multi_agent_v2` authoritative.
- Rename the shared spawned-thread limit to `agents.max_concurrent_threads_per_session`, retain `agents.max_threads` as an alias, and apply the setting to both multi-agent backends.
- Add reserved subagent model, reasoning effort, and agent-type settings to the config surface and persist all resolved agent settings in config locks.
- Show the resolved `[agents]` values in TUI debug-config output.

## Testing

- Cover config loading, legacy alias normalization across merged layers, backend-selection precedence, V2 concurrency, and debug output.

GitOrigin-RevId: 2957c954a2e1aef51592768dbbccd56c4bf8f118
2026-07-16 09:00:51 +00:00
rka-oai
cbc83d961e Preserve encrypted content in MCP tool outputs (#33509)
## What changed

- Convert MCP text content marked with `_meta["codex/encryptedContent"] = true`
  into `encrypted_content` function call output items.
- Prefer the content-item payload whenever encrypted content is present so that
  `structured_content` does not replace the encrypted output.

## Testing

- Add a stdio MCP integration test that round-trips mixed plaintext and
  encrypted tool output.

GitOrigin-RevId: c3997a16b06ad38ff22b21016ede35b97974d9ec
2026-07-16 05:38:36 +00:00
Martin Au-Yeung
800715d201 Remove template IDs from MCP tool call metadata (#33467)
## What changed

- Remove `template_id` from MCP tool call items and lifecycle events.
- Remove `templateId` from app-server `McpToolCallAppContext` responses and generated schemas.
- Update protocol conversions, documentation, and existing test expectations for the revised metadata shape.

GitOrigin-RevId: f2b1304eadff661eec3966673ea71206b1542b98
2026-07-16 01:23:52 +00:00
Dylan Hurd
be39aab9f4 Strengthen forced rm command detection (#33464)
## Why

Forced `rm` commands can appear inside complex shell syntax or use option and wrapper variants that the existing dangerous-command heuristic does not recognize.

## What changed

- Detect literal forced `rm` invocations in control flow, substitutions, pipelines, traps, nested shells, and `sudo` or `env` wrappers.
- Recognize combined, separate, and long-form force options, including when they follow operands.
- Require approval for these commands, or reject them with a safer-alternative explanation when approvals are disabled, even when the sandbox is disabled.
- Preserve existing rejection reasons for other dangerous commands and explicit policy rules.

## Testing

Add unit, policy, and end-to-end coverage for forced `rm` variants, complex shell scripts, approval requests, and rejection messages.

GitOrigin-RevId: e1fabc55324e788bae00ab24aae50d089eb7b058
2026-07-16 01:12:14 +00:00
Eric Traut
2edad72de3 Track prompt cache write token usage (#33454)
## What changed

- Parse `cache_write_tokens` from response input token details and carry it through token usage aggregation.
- Expose `cache_write_input_tokens` in protocol, app-server, exec, and TypeScript SDK usage events, defaulting it to zero for compatibility with older payloads.
- Report cache-write usage in analytics, metrics, traces, and rollout data alongside existing cache-read usage.

## Testing

- Add coverage for response parsing, usage event output, aggregation, analytics, metrics, and telemetry fields.

GitOrigin-RevId: 634e4fbe3086a8923c0ee13b622573e7d9d221bd
2026-07-16 00:22:53 +00:00
Charlie Marsh
78d4a563f9 Remove the unused network proxy loader (#33446)
## What changed

- Remove the standalone network proxy config loader, its mtime-based reloader, and their tests.
- Remove the helper exports and MITM action-reference validator used only by that loader.

GitOrigin-RevId: 60895fb4e3461e8c3f19db70869050410a4f5f07
2026-07-15 23:24:37 +00:00
iceweasel-oai
4bc2c723ef Select the elevated Windows sandbox for network proxies (#33445)
## Why

Windows firewall enforcement is tied to the logon-user sandbox identities. Proxy-enforced commands therefore need the elevated backend even when the configured sandbox mode is the default restricted-token mode.

## What changed

- Select the elevated Windows sandbox backend whenever a command uses the managed network proxy.
- Remove configuration and startup checks that required users or managed requirements to select the elevated sandbox explicitly.
- Start and expose managed network proxy state consistently on Windows.

## Testing

- Verify that proxy enforcement selects the elevated backend for the restricted-token sandbox mode.

GitOrigin-RevId: e01ac052587721c468a8fbcf4e2c7c5a185a3e05
2026-07-15 23:19:00 +00:00
charlesgong-openai
7d1218a997 Add external agent memory migration (#33444)
## What changed

- Add a feature-gated `MEMORY` migration item to the app-server protocol and TUI.
- Discover project memory Markdown files, preserve their project scope, and copy selected projects into the Codex memory extension workspace.
- Detect changed, renamed, and removed source projects, report per-project import failures, and enqueue memory consolidation after workspace changes.

## Testing

- Cover memory discovery, selection, synchronization, scope validation, feature gating, protocol results, and TUI rendering.

GitOrigin-RevId: 9b17b2e9a639a064dba8aaffbec6345ae419018e
2026-07-15 22:49:52 +00:00
jif
08924bca00 Shut down Codex threads after approval scenarios (#33441)
## What changed

- Explicitly shut down and wait for each approval scenario's Codex thread.
- Preserve and return the scenario verification result after shutdown, so cleanup also runs when verification returns an error.

GitOrigin-RevId: 78dfbe657700a47b457ea9abd5efec4edd8f8a25
2026-07-15 22:27:36 +00:00
jif
365d70203d Warn on conflicting capability root locations (#33435)
## Why

Selected capability roots are deduplicated by ID. When ready environments
report the same ID with different locations, silently dropping later roots
hides the conflict.

## What changed

Track each selected root's location while combining thread and ready-environment
roots. Keep the first root for a duplicate ID and emit a warning when a later
root uses a different location.

## Testing

Add a regression test with two ready environments that verifies the first
location is retained and the conflict warning is logged.

GitOrigin-RevId: e51692ae9cd2c3a7f3c1ac50bb8446846f314929
2026-07-15 21:32:45 +00:00
Owen Lin
2be648ba4a Preserve paginated history for spawned subagents (#33432)
## What changed

- Inherit paginated history mode when spawning or forking a subagent from a paginated parent.
- Load the parent's model context when forking and persist it as an inherited rollout prefix, while excluding that prefix from the child's projected turns, items, and metadata.
- Record the boundary between inherited context and child history, and reject partially initialized paginated subagent rollouts on resume.
- Resume paginated subagents from their stored model context instead of legacy rollout history.

## Testing

Added coverage for fresh and forked paginated subagents, compacted-history forks, model-context resume, inherited-prefix projection, metadata isolation, and incomplete-prefix detection.

GitOrigin-RevId: e57dc37c29aa4aaaf57b052b991be591d730e5ba
2026-07-15 21:25:24 +00:00
iceweasel-oai
cb79b3cdf9 Avoid creating metadata paths in the Windows sandbox (#33430)
## Why

Elevated Windows sandbox setup could turn the built-in read-only protections
for workspace metadata into deny-write paths, creating metadata directories
that did not already exist.

## What changed

- Track whether filesystem permission entries come from a built-in profile or
  were explicitly configured.
- Exclude generated metadata defaults from direct Windows deny-write overrides
  while continuing to enforce explicit read-only carveouts for the same paths.
- Preserve the distinction while materializing and normalizing permission
  paths, without exposing generated defaults as user configuration.

## Testing

Added Windows coverage confirming that elevated sandbox setup leaves missing
workspace metadata absent and still produces overrides for explicit metadata
carveouts.

GitOrigin-RevId: 701bcb229f631b18ab5ced22f3edf6f303d932f3
2026-07-15 21:19:14 +00:00
jif
79177c3e20 Propagate deferred environment capability roots to MCP (#33427)
## What changed

- Let deferred environments provide selected capability roots with their ready signal.
- Validate that those roots have unique, non-empty IDs, belong to the registering environment, and stay within the root limit.
- Include roots from ready turn environments when resolving MCP contributions, and refresh the MCP runtime when the selected root set changes.
- Expose the exact ready root set to MCP contributors so executor plugins become available with their environment.

## Testing

- Cover ready-root propagation, validation failures, replacement isolation, reconnection, and MCP plugin availability refresh.

GitOrigin-RevId: ec3498aab1164824025094e96a9b1063b7b731ad
2026-07-15 21:07:43 +00:00
jif
0f2321f244 Refresh host skill catalogs through world state (#33425)
## Why

Host skills can change after a thread starts. Subsequent turns need the updated
catalog without reinjecting an unchanged catalog on every turn.

## What changed

- Register the host skill provider in app-server and project its catalog through
  a dedicated World State section.
- Render host skills with the existing metadata budget and usage instructions,
  including skill-root aliases when available.
- Suppress the legacy host catalog and contextual fragment when World State owns
  the catalog, while preserving host skills for explicit and shadow selection.

## Testing

Added an app-server test that installs a host skill at runtime and verifies the
catalog updates once and remains stable on the following turn.

GitOrigin-RevId: 4cacc6b2258fc3cab8499fbdf9aa6ab0324ec10d
2026-07-15 20:59:21 +00:00
pakrym-oai
8530440b91 Refactor world-state rendering tests into snapshots (#33412)
## What changed

- Add a shared test helper that renders before-and-after section states alongside the resulting role and content.
- Convert the agents, environment, apps, and plugins world-state tests to snapshot tables covering absent, unknown, unchanged, changed, and removed states.

GitOrigin-RevId: 03372a5f925d2019f37bf5a5a2f060261899026c
2026-07-15 20:01:33 +00:00
jif
c28770a42f Respect final-answer boundaries for queued agent mail (#33367)
## Why

Queue-only child-agent updates that arrive around a final answer should not
restart sampling, but they must remain available to the next turn. Explicitly
injected response items still need to reopen the current turn.

## What changed

- Defer queue-only inter-agent mail after a final answer without treating it as
  same-turn pending input.
- Re-enable current-turn mailbox delivery when the model requests a follow-up,
  a stop hook continues the turn, or a response item is explicitly injected.
- Check for turn-triggering mailbox work after clearing the completed active
  turn so pending work can start safely.

## Testing

Added coverage that queued child mail waits for the next user turn and that an
injected response item after a final answer triggers a follow-up request.

GitOrigin-RevId: aa81d00707943284b7ab069b60970e547908c895
2026-07-15 15:48:12 +00:00
jif
1bbdb32789 Expand MCP tool catalog cache regression coverage (#33308)
## Why

Cached MCP tool catalogs must not substitute stale session state for the live
server connection.

## What changed

- Verify `mcpServerStatus/list` waits for replacement stdio server metadata
  before combining it with cached tools.
- Verify configurations with remotely sourced environment variables bypass the
  tool catalog cache.
- Assert that calls made from cached definitions return output from the live
  replacement process.
- Make the stdio test server available to Windows Bazel integration tests.

GitOrigin-RevId: 0e518cd46f0d89af28e3a4e256023b5872e6e2fb
2026-07-15 10:18:51 +00:00
jiayuhuang-openai
2e1607ee2f Add Frameless Bidi support for realtime conversations (#33261)
## What changed

- Add realtime conversation version `v3`, which preserves the V1 Codex Voice behavior while using Frameless Bidi `delegation.*` events.
- Translate audio, transcripts, handoffs, session context, and lifecycle events between the app server and the Frameless Bidi wire protocol.
- Support `v3` over WebSocket and WebRTC, including the Frameless `/live` endpoint, session configuration, headers, and default model selection.
- Update the app-server protocol schemas and documentation for the new version.

## Testing

- Add unit coverage for Frameless event parsing, outbound messages, context chunking, URL construction, and call creation.
- Add app-server end-to-end coverage for WebSocket delegation and WebRTC session startup.

GitOrigin-RevId: 79a3307bc209e1a54582ebd2febc07c909fca016
2026-07-15 05:59:37 +00:00
rka-oai
768330dd6c Add a fallback phase before automatic context rollover (#33255)
## Why

Token-budget sessions need a final opportunity to preserve important state before the current context is compacted.

## What changed

- When `auto_compact_fallback_prompt` is configured, reserve `auto_compact_fallback_buffer_tokens` beyond the base auto-compaction limit.
- At the base limit, inject the fallback prompt once as a developer message while keeping the normal tool surface available. Continue reporting zero base-window tokens during this reserve.
- Roll over when the reserve or full model context is exhausted, and skip the fallback when a new context was already requested.

## Testing

Added coverage for using the fallback reserve, rolling over after it is exhausted, and bypassing the fallback for an explicit `new_context` request.

GitOrigin-RevId: 32983ecadc5cb4927e15ecd7b1e896cb52a9ad3b
2026-07-15 05:45:43 +00:00
sayan-oai
3afbd8dd45 Report selected environment connection transitions (#33251)
## What changed

- Track connected and disconnected states across initial remote exec-server connections and reconnection attempts.
- Emit experimental `thread/environment/connected` and `thread/environment/disconnected` app-server notifications for each thread selecting the environment. Each payload identifies the thread and environment; current state is not replayed when a thread starts.
- Stop forwarding connection events when an environment selection is removed or replaced.

## Testing

- Cover connection, disconnection, reconnection, shared-environment notifications, and replacement of a selected environment.

GitOrigin-RevId: 5dd767372363c4a2a8319fc16164be117d5bd20c
2026-07-15 05:21:13 +00:00
rka-oai
8aae858958 Add auto-compaction fallback token-budget settings (#33243)
## What changed

- Add `auto_compact_fallback_prompt` and
  `auto_compact_fallback_buffer_tokens` to `features.token_budget` and the
  generated configuration schema.
- Trim empty fallback prompts, limit prompts to 2,000 bytes, require a buffer
  when a prompt is configured, and reject non-positive buffer values.
- Preserve the new settings when locking resolved session configuration.

## Testing

- Cover config resolution and validation for overlong prompts, missing
  buffers, and non-positive buffers.
- Extend the configuration-lock test to cover both settings.

GitOrigin-RevId: 6463f963ba1dbd633d76601b8344360a8c85cf8b
2026-07-15 04:48:45 +00:00
rphilizaire-openai
35b33e4304 Instrument environment and plugin resolution paths (#33223)
## What changed

Add named tracing spans around step environment snapshots, capability and
executor plugin resolution, `AGENTS.md` refreshes, and MCP runtime projection
and refresh operations. Skip recording function arguments to keep these spans
focused on timing and execution flow.

GitOrigin-RevId: 73a452ef1b5da6f7f2b00d24421a815c5d514eaf
2026-07-15 03:27:16 +00:00
Felipe Coury
d88db19144 Preserve thread context when retrying or editing turns (#33211)
## What changed

- Add experimental `beforeTurnId` support to `thread/fork` for copying history strictly before a turn, including an in-progress turn.
- Use before-turn forks for TUI backtracking and safety retries so the replacement prompt retains thread context instead of recreating the branch from the preceding turn or a new thread.
- Add experimental `deferGoalContinuation` support so safety-retry forks can inherit an active goal while waiting for the replacement turn before automatic continuation resumes.
- Hide duplicated nested-review prompts when replaying history or selecting a prompt to edit.

## Testing

- Cover before-turn truncation, fork validation, active-goal inheritance, TUI safety retries, backtracking, and nested-review replay.

GitOrigin-RevId: 4915d85ae1929a0b8c40f3ed7dca29c7a5bdcdf3
2026-07-15 02:35:49 +00:00
pakrym-oai
e4711f2a3b Separate session state from session I/O (#33209)
## What changed

- Replace the combined `Codex` wrapper with an `Arc<Session>` and a dedicated
  `SessionIo` handle for submissions, events, status, and loop termination.
- Make `Session::spawn` return the session and I/O handle separately, and have
  `CodexThread` own both.
- Update thread management, delegated sessions, guardian reviews, and agent
  control to use the appropriate session or I/O interface.

GitOrigin-RevId: 8523bad7e7366e2969fd0cc3849b4247b141427a
2026-07-15 02:16:53 +00:00
Adam Perry @ OpenAI
72b41c55fb Separate exec permission paths from core models (#33200)
## Why

Core filesystem permission models operate on native absolute paths, while exec
sandbox contexts must serialize paths as portable URIs.

## What changed

- Make the core filesystem permission and profile types concrete over
  `AbsolutePathBuf` instead of generic over their path representation.
- Add exec-specific permission types that convert native permission paths to
  `PathUri` values at the sandbox protocol boundary.
- Replace the legacy read/write-roots tuple with a named
  `LegacyReadWriteRoots` struct.

## Testing

- Add coverage that exec sandbox permission paths serialize as URIs and round
  trip through the filesystem protocol.

GitOrigin-RevId: a0ef5f8aba9bbfdf00a00fcc4f199314836bc85d
2026-07-15 01:31:40 +00:00
stefanstokic-oai
4df8027a97 Honor workspace spend controls in rate-limit handling (#33187)
## Why

Sparse and out-of-order rate-limit updates can omit account metadata or let an
older full read overwrite a newer workspace hard stop. Credit availability also
does not always include a displayable balance.

## What changed

- Propagate the backend's `spendControlReached` state through rate-limit
  snapshots and the app-server protocol, preserving it across sparse updates.
- Keep workspace hard-stop classifications for error routing and ignore stale
  full-read results after a newer hard-stop notification.
- Base TUI warnings and model-switch prompts on credit availability and hard-stop
  state, and show `Credits: Available` when a finite balance is hidden.

## Testing

Added coverage for spend-control mapping, snapshot merging, out-of-order reads,
workspace error routing, warning and prompt behavior, and credit status display.

GitOrigin-RevId: 18b09d493d5a620a7c079fb721ec50b38dd5b04c
2026-07-14 22:43:26 +00:00
Adam Perry @ OpenAI
be0e0d791a Keep approval test targets in the temporary home (#33185)
## What changed

Resolve approval test targets outside the workspace relative to the test's
temporary home instead of the process working directory. This keeps the targets
outside the test workspace while containing them in the test environment.

GitOrigin-RevId: 871e840d658468c56d603afc10cc226f918bba5a
2026-07-14 22:31:57 +00:00
jif
42c5d3c80d Reuse MCP tool catalogs across sessions (#33184)
## Why

Starting a new session should not have to wait for an unchanged stdio MCP
server to initialize before its tools can be presented to the model.

## What changed

- Cache recent tool catalogs for matching stdio MCP server configurations and
  use them while a new live connection starts in the background.
- Bound the process-wide cache to 32 entries with a 30-minute TTL, and key
  entries by the server configuration, environment, working directory, and
  elicitation capabilities that affect the catalog.
- Keep connection-specific instructions and tool annotations out of cached
  catalogs. Resolve tool calls against the live connection so tools that are
  unavailable or hidden in the new session cannot be invoked from stale data.
- Publish only the newest completed catalog fetch and do not cache HTTP servers
  or stdio configurations that depend on remotely sourced environment values.

## Testing

- Add coverage for cache expiration, environment changes, catalog sanitization,
  and out-of-order refreshes.
- Add an end-to-end test that starts inference from cached definitions while a
  replacement MCP process initializes, then verifies calls and visibility
  against the live process.

GitOrigin-RevId: 2ed0f29ba53ace12532730f951b175c588aa3ae7
2026-07-14 22:25:39 +00:00
rhan-oai
68c6e5df2b Support model catalog templates for Guardian policy prompts (#33177)
## What changed

- Add an optional `policy_template` field to auto-review model messages.
- Build Guardian instructions from the catalog template when present, while
  preserving the existing precedence for managed and catalog policy content.
- Fall back independently to the bundled template and bundled policy, and
  preserve explicit empty catalog values.

## Testing

- Cover missing and empty template deserialization, policy precedence, bundled
  fallbacks, and Guardian prewarm instructions.

GitOrigin-RevId: 93116dadbc9bf40527882844a428caed4159fff6
2026-07-14 22:01:11 +00:00
iceweasel-oai
a2fb3f048d Document the Windows exec yield time range (#33167)
## What changed

Document that `exec_command.yield_time_ms` has an effective range of
2,000–30,000 ms on Windows, and update the tool specification test to match.

GitOrigin-RevId: aa20bbb2ad82d162d29d93f3bfbe1b970445f44e
2026-07-14 21:11:32 +00:00