Commit Graph
6638 Commits
Author SHA1 Message Date
Charlie Marsh 69477b3a77 Specialize blocking OTLP/HTTP providers for single-signal export (#63406)
## Why

The code-mode host only exports traces, and Windows sandbox setup only
exports metrics. Selecting the required exporter and HTTP client at compile
time lets the linker drop unused exporter and custom client code.

## What changed

Use `BlockingHttpService` for OTLP/HTTP JSON traces in the code-mode host
and Statsig metrics during Windows sandbox setup. These providers use the
OpenTelemetry SDK's default HTTP client. Traces use the dedicated batch span
processor even inside a Tokio runtime.

Move `codex_home` from `OtelSettings` to `OtelHeadersHelper`, where it
supplies the working directory for user-configured header commands.

## Testing

Exercise the blocking providers in HTTP loopback tests for trace export
inside a current-thread Tokio runtime and cumulative metrics temporality.

GitOrigin-RevId: 21bacbdb18b603f5f536532812ce7643e4eb36d6
2026-11-23 18:44:09 +00:00
jif 70e009974c Remove the empty plugin list rendering test (#63401)
GitOrigin-RevId: 0b695079580e257f8de014c50d6797b2ff91a908
2026-11-23 18:27:38 +00:00
jif 1b6ef00d25 Consolidate Responses WebSocket v2 continuation tests (#63398)
Fold the duplicate prompt-prefix case into the provider WebSocket support
test. Assert that both requests use `response.create` on the same
connection and that the follow-up sends the `previous_response_id` and
only the new input.

GitOrigin-RevId: 6d4c88aa4d8babf44b295ec9a1c8a1d4f6956adc
2026-11-23 18:16:40 +00:00
jif e7cde429e1 Consolidate Responses WebSocket streaming coverage (#63393)
The test for omitting the timing metrics header already streams through
a WebSocket-capable provider with no feature flags enabled. Assert that
it sends exactly one request over a single WebSocket connection and
remove the separate test that exercises the same setup.

GitOrigin-RevId: 15aa2d2b503c3e1accfdf0de80eddd91e0b982e4
2026-11-23 18:02:47 +00:00
jif ed02716c09 Omit final-answer schemas from legacy remote compaction (#63381)
## Why

Legacy models such as `gpt-5.2` emit compaction summaries on the final
channel, where the turn's JSON schema can constrain the summary.

## What changed

Remote V2 compaction omits the final-answer schema for the legacy
`gpt-5`, `gpt-5.1`, `gpt-5.2`, and `gpt-5.4-nano` model families,
with an exception for `gpt-5.2-codex`. It recognizes the same model names
with Bedrock's `openai.` prefix. Other models retain the schema in
compaction requests to preserve the cached prompt prefix.

## Testing

Integration tests check schema handling across model variants and verify
that compaction retries use the schema rules for the model handling each
attempt. Regular sampling retains the configured schema.

GitOrigin-RevId: f2ebaa7f3e272cb18ccb879dc7f67973ba1642cc
2026-11-23 17:11:57 +00:00
chess 113e0c6d5e Allow per-subagent service tiers in spawn_agent (#63376)
## Why

Subagents can inherit the root session's service tier or get one from their
role. A per-spawn override lets a caller choose a tier for an individual
child without changing those defaults.

## What changed

Enable the optional `service_tier` argument for v1 and v2 `spawn_agent`
with `multi_agent_v2.expose_spawn_agent_service_tier`. The setting is off by
default, and tool schemas expose the argument alongside model selection.

Omit the argument to use normal inheritance, pass `default` to request
the default tier, or specify a tier available for the child's model and
provider. Unavailable explicit tiers return a spawn error.

Persist the child's choice across eviction and reload. Parent, sibling,
and descendant agents continue to use their usual tier selection.

## Testing

Extend coverage for tier selection in model requests, rejection of
unadvertised Flex on Bedrock, and restoration after eviction without
passing the override to grandchildren.

GitOrigin-RevId: 2e9b92af44232b6a5682fe2cd97980f17cbb5d97
2026-11-23 16:52:47 +00:00
ioanbudea-OAI 177c406276 Include completed audio transcripts in Guardian review context (#63368)
## Why

Guardian review can use spoken context when history supplies completed
transcripts for user recordings and tool results. Source labels distinguish
transcribed speech from typed user messages and identify the originating turn
or tool call.

## What changed

- Collect completed transcripts alongside their source history items so they
  participate in review delta selection. Respect tool output filtering.
- Preserve source labels when truncating transcript text. Quote and escape
  speech in line format so it cannot introduce a new role header.
- Support an optional `transcript_audio` elastic budget for synchronous and
  asynchronous reviews. Without it, user and tool audio use the message and
  tool budgets respectively.

## Testing

Add coverage for loading the audio budget in both reviewers, enforcing it in
line and JSON transcripts, and preserving the delta cursor as history grows.

GitOrigin-RevId: fa7e130b1212692e71a996528d8397826837a644
2026-11-23 16:14:06 +00:00
jif 22c1681aec Clean up network approvals when command startup is interrupted (#63365)
## Why

Interrupting `exec_command` while startup is pending can leave a stale
network approval registration. When the next command makes an untagged
request through the shared proxy, the stale entry makes request
attribution ambiguous and prevents an approval prompt.

## What changed

Tie the registration to the command's approval handle from startup
through completion. Remove the active entry and its stored outcome on
explicit completion or when the last handle is dropped. Cache the outcome
so that all deferred completion observers can report the same denial.

## Testing

Add a regression test that interrupts a pending launch and checks that
an untagged proxy request for the next command prompts for approval and
returns HTTP 403 when denied. Cover cleanup when the last deferred handle
is dropped and denial reuse across cloned handles.

GitOrigin-RevId: 257a32695c487a92d15937772b09085a49533fd3
2026-11-23 15:59:10 +00:00
felixxia-oai 223b61a9a8 Refresh Guardian v3 evidence before retrying an approval review (#63363)
## Why

A user's authorization can change while Guardian is reviewing a tool call.
A retry could reuse the original evidence cutoff and miss a revocation
that arrived during the first attempt.

## What changed

Capture the root thread's history position when the action is bound and
defer evidence routing until Guardian prepares the review. Capture a fresh
position on retries or if authorization changed before the first attempt.
Use bounded history reads to catch up through the selected position and
wait for routing to reach it before submitting the assessment.

## Testing

Extend the app-server test to revoke authorization through a paused user
goal while an MCP tool call's approval is pending. Verify that Guardian
discards the stale allow, sees the revocation on retry, and denies the
tool call. Cover bounded history reads and shared routing progress in
unit tests.

GitOrigin-RevId: d7cf6f03412c4aa5399700427f40710da3123e52
2026-11-23 15:57:15 +00:00
ioanbudea-OAI 02390c8d8e Refresh managed MCP requirements in place (#63348)
Update the retained configuration stack during session refresh. Copy only
the MCP server, plugin, and feature requirements in both the parsed and
TOML representations, avoiding a clone of the entire stack.

GitOrigin-RevId: 1bae8cc86a59b4638f9f6cd48ee9eb17de31fef2
2026-11-23 14:26:56 +00:00
Charlie Marsh 2c77888b21 Share config-loading future poll code across callers (#63336)
Return a `BoxFuture` directly from `Config::load_config_with_layer_stack`
so callers share the future's poll code. Keep the large config-loading
future on the heap to limit stack use on small test threads.

GitOrigin-RevId: 50cf5c27983b38044ecd25dd9be4316c4fdf36ba
2026-11-23 13:07:19 +00:00
Charlie Marsh 00315bb12a Box the session startup cleanup future (#63333)
## What changed

Return a `BoxFuture<'_, ()>` from `SessionStartup::cleanup` and move the teardown logic into the private async `cleanup_inner` method. Callers continue to await `cleanup()` at the same points.

GitOrigin-RevId: 5c263027fb93d64f1872f4f3d5b732df4b4427e5
2026-11-23 12:55:29 +00:00
jif 790ecc338a Log probe results when Guardian V3 prepares a review (#63327)
## What changed

Carry the serving probe result from the tool step into the review context.
Include `tool_call_id` and `probe_review` in the Guardian V3 preparation
log so the result can be correlated with the tool call. Record the probe
as `required`, `not_required`, or `not_reported`. Approval decisions
continue to follow the review verdict.

## Testing

Extend the pending MCP action integration test to check the logged tool
call ID and probe status for all three cases while exercising the same
revocation and reapproval flow.

GitOrigin-RevId: 43cd3691ae20af29f690ee2697d3d46bcc3bd8ce
2026-11-23 12:36:40 +00:00
jif 9ee4539162 Preserve structured output format during remote compaction (#63320)
## Why

Remote compaction v2 dropped the turn's final-answer schema, so its
request could lose the cached prompt prefix shared with sampling even
when both requests used the same cache key.

## What changed

Carry the turn's JSON schema and sampling strictness into compaction
requests, including the non-strict guardian verdict format. The Responses
API still generates compaction summaries independently of that schema.

## Testing

- Check that automatic compaction on Bedrock and GCP uses the same
  `text.format` and `prompt_cache_key` as sampling, with and without a schema.
- Check that guardian reviews retain their verdict format across compaction
  and retries, and that an approval after compaction allows the command to run.

GitOrigin-RevId: 2cb5df2539358e3d74f1dce51baac2806b6219eb
2026-11-23 12:17:37 +00:00
jif ca891cecdc Wake idle root threads on persisted agent messages (#63312)
## Why

Plaintext agent messages injected through `thread/inject_items` could
be saved to root-thread history without waking the thread, even when
agent-message wakes were enabled.

## What changed

After persisting a batch of plaintext agent messages with unspecified
retention, let the native multi-agent v2 root thread's mailbox scheduler
apply its usual wake and turn-admission rules. Use the recorded history
sequence to skip a wake if another turn already read the messages and
to deliver the mail directly from history without re-enqueueing it.

## Testing

Cover app-server injection with wakes enabled and disabled, wake a
reloaded sleeping root with its previous turn context, and verify that
a paused turn-admission gate defers the wake and the eventual model
request contains the message once.

GitOrigin-RevId: 5fde8062a179fd7a7919d240373592f2dbb4a389
2026-11-23 11:16:31 +00:00
dozaki-openai 5f645d732c Batch filesystem metadata checks for instruction and skill discovery (#63266)
## Why

Discovering project instructions and repository skill directories can
require several metadata checks per ancestor directory. Batching those
checks reduces remote executor round trips and sandbox helper launches.

## What changed

Add bounded metadata batches that return a result or error for each
path in input order. Remote executors advertise support for
`fs/getMetadataBatch`, and sandboxed filesystems can process a batch in
one helper invocation.

Check project root markers alongside the first working-directory
instruction candidate, then batch the next candidate across unresolved
directories in filename priority order. Batch checks for
`.agents/skills` directories between the project root and the working
directory. Fall back to individual checks when batching is unsupported.

## Testing

Extend tests to assert batch counts for shallow and nested `AGENTS.md`
discovery and verify that metadata batches preserve result order and
per-path errors.

GitOrigin-RevId: 6cb04202a905d783454908348d008def95b9a5d6
2026-11-23 05:39:53 +00:00
Charlie Marsh ae6c0c8ac1 Exclude per-item usage attribution by default (#63219)
## What changed

Add `usage.attribution` to the `x-codex-exclude` header for Responses HTTP
requests and WebSocket handshakes by default. Threads started with
`experimentalRawEvents` keep receiving per-item attribution in raw responses.
Subagents inherit the policy, and the app server restores it when a thread
resumes with an existing raw-event subscription.

## Testing

Cover the default exclusion, raw completion events with upstream usage,
subagent inheritance, and resuming a closed subagent after both its runtime
and its parent's runtime have unloaded.

GitOrigin-RevId: 0dad92f97606300907f1294f09dd7845d1e6476f
2026-11-23 01:06:41 +00:00
cooper-oai 7085656b5e Reuse runtime-authenticated Responses WebSockets (#63175)
## Why

Reconnecting for every runtime-authenticated request adds a WebSocket
handshake and forces Codex to resend the full input instead of continuing
from the previous response.

## What changed

Allow requests to reuse an open WebSocket when the request headers,
connection key, runtime ID, and parent routing affinity still match.

## Testing

Cover reuse within and across turns, including incremental input through
`previous_response_id`, and verify that credential replacement and account
switches open new connections. Verify that a paused runtime is rejected on
reconnect after the server closes its WebSocket.

GitOrigin-RevId: cb89b9712f43027482147077a60d5c78fbdfd753
2026-11-22 19:12:31 +00:00
Eric Traut e1ecb5c8fc Fix linked worktree hook loading when the root .codex is a file (#63088)
## Why

When `.codex` in the root checkout is a regular file, reading
`.codex/config.toml` returns `NotADirectory`. That error aborts project
configuration loading for the linked worktree.

## What changed

Treat `NotADirectory` like a missing config when reading project hook
configuration from the root checkout.

## Testing

Cover a linked worktree that keeps its local project settings and inherits
hooks from the matching subdirectory in the root checkout even when the
root checkout's top-level `.codex` is a file.

GitOrigin-RevId: 2cb7fcb340ce85253641c016dace5177096ba205
2026-11-22 07:01:32 +00:00
Adam Perry @ OpenAI 357fe240c9 Share truncation logic for environment startup errors (#63077)
## What changed

Use `ErrorContextBudget` to truncate model-visible startup error details in
environment world state and `wait_for_environment` responses. Keep the
existing 256-byte limit per detail and 512-byte total for world state error
details, with truncation at UTF-8 character boundaries.

## Testing

Extend the world state test to cover a multibyte error that cannot fit in
the remaining budget, followed by an ASCII error that uses the last two bytes.

GitOrigin-RevId: a6296fc854a383186dacaec5576e9f02e179d34c
2026-11-22 02:54:25 +00:00
Won Park 8653ca9e99 Add an async user messaging opt-in for spawned subagents (#63069)
## Why

Async user messaging was limited to root agents. Spawned subagents need
their own opt-in so they can send messages without requiring the root
feature flag.

## What changed

Add independent `root_agent` and `subagents` settings under
`features.send_message_to_user_async`. For example, this opts spawned
subagents in and turns off the root feature flag:

```toml
[features.send_message_to_user_async]
root_agent = false
subagents = true
```

The existing boolean shorthand still sets the root feature flag, and the
model catalog can still enable the tool for the root agent. Config layer
merges, CLI overrides, and feature toggle edits preserve the separate
`subagents` setting when changing the root flag.

## Testing

Extend coverage for tool availability across root agents, spawned
subagents, and compaction helpers, and for preserving the subagent
setting when applying boolean overrides.

GitOrigin-RevId: 5f34f182bc107d32797143a58f0d79395767ed49
2026-11-22 01:25:05 +00:00
Alex Kira 704ffed1c5 Refresh the Code Mode exec catalog when helper signatures change (#63046)
## Why

Incremental updates to nested tools can leave the model with a stale
`functions.exec` declaration when a global helper changes. For example,
resuming a session with unified image budgeting can change the advertised
signature of `image`.

## What changed

Track the signatures of global helpers supplied by the description renderer
and redeclare the full `functions.exec` catalog when they change, including
when an override removes those helpers. Send the configured incremental
tools hint once before the first namespace declaration in an update,
including updates that only redeclare `functions.exec`.

## Testing

Cover helper removal and session resume with bundled helpers, an
`{{ image_helper }}` override, and a helper-free override. Verify that a
changed signature triggers one refresh and subsequent turns reuse the
refreshed declaration.

GitOrigin-RevId: a1c216879be8eb5b331485984c86bf872b0b7a17
2026-11-21 21:40:05 +00:00
rhan-oai 1145028ae4 Skip empty permissions messages in the initial context (#62933)
## Why

When the resolved permission and approval guidance is blank, the initial
context still includes a developer message containing only the permissions
wrapper.

## What changed

Omit that message when the guidance is empty or whitespace-only. Keep a
permissions checkpoint so later turns can report newly saved command
prefixes. Continue sending bundled approval guidance when it applies.

## Testing

Cover blank and bundled approval guidance and later command-prefix updates
with and without per-environment context. Update Guardian request snapshots
to reflect the omitted empty message.

GitOrigin-RevId: b1e2b6377733ec34b875b51d800922e15c267571
2026-11-21 08:39:16 +00:00
Adam Perry @ OpenAI 43d8b78241 Fix reasoning summary config lookup and request snapshot (#62932)
## What changed

Pass `None` for the resumed working directory when the TUI reads
effective reasoning summary settings, so the call matches the
`startup_config_cwd` signature.

Update the indexed search rollout snapshot to expect
`stream_options.reasoning_summary_delivery` set to `sequential_cutoff`.

GitOrigin-RevId: 66225aa15dcfe5da43b397a96a7da4b4712f0b55
2026-11-21 08:38:44 +00:00
Eric Traut 58952e0c39 Enable concurrent reasoning summaries by default (#62903)
## What changed

Mark `concurrent_reasoning_summaries` as stable and enable it by default.
When requesting reasoning summaries from OpenAI, Codex now sets
`stream_options.reasoning_summary_delivery` to `sequential_cutoff` by
default.

## Testing

Exercise summary rendering with the default configuration and update
request assertions and snapshots to expect `sequential_cutoff`. Explicitly
disable the feature in tests that exercise legacy reasoning events.

GitOrigin-RevId: 04310fd271ced11c3a22e8ff6275a387c9c22fc2
2026-11-21 05:42:40 +00:00
Dylan Hurd e3a398d3e4 Allow model catalogs to set initial collaboration guidance (#62896)
## Why

Model catalogs could provide guidance for Plan and for Default after Plan,
but had no field for the turns before the first Plan turn.

## What changed

Add optional `collaboration_modes.initial` guidance. Codex uses it in
Default before the first Plan turn when the field is nonempty and no
caller-supplied instructions take precedence.

## Testing

Add a request snapshot test that covers initial guidance on a new thread,
retains it after resume, and verifies the switch to Plan guidance and then
to Default guidance when leaving Plan.

GitOrigin-RevId: bb9e83aeb60af54fc2ee1bf9ce5acbb8a354ffb8
2026-11-21 04:18:31 +00:00
Winston Howes 4739e94260 Add an opt-in indexed web search default (#62894)
## What changed

Add `features.web_search_indexed_default` to let restricted turns use
`indexed` search in place of the implicit `cached` default when the
provider and managed requirements allow it. Full-access turns still
prefer `live` search when allowed, and an explicit `indexed` selection
retains its existing precedence.

Forward the flag through the TUI and keep the default implicit when
launch overrides disable legacy search flags.

## Testing

Cover mode selection across permission profiles, explicit settings, and
managed requirements. Verify that the first model request advertises
indexed search and that permission changes take effect on the next turn.

GitOrigin-RevId: 08a6279c447c517c50b9e6a544ecdf681b81bf50
2026-11-21 04:05:41 +00:00
cassirer-openai 8a1a476659 Use a shared ToolCallId for dispatched tool invocations (#62888)
## Why

Dispatched invocations, model-visible Responses calls, and Code Mode's
per-cell runtime calls use IDs with different roles. A dedicated Rust type
makes the dispatch identity explicit in APIs that carry it.

## What changed

Add `codex-tool-call-id` and use its `ToolCallId` across core tool dispatch,
nested Code Mode calls, and rollout tracing. The type wraps a string and
continues to serialize as a string.

GitOrigin-RevId: 119de57a9af840c4de72895adc9acdd0ed15b4fd
2026-11-21 03:14:33 +00:00
Winston Howes 7edf91b13c Track explicit web search modes and expose indexed in the SDK (#62884)
## What changed

Record whether an explicit `web_search` setting matches the effective
mode after applying configuration requirements. Mark the thread manager
sample's disabled mode as explicit.

Accept `indexed` in the TypeScript SDK's `WebSearchMode` type.

## Testing

Extend the SDK test to verify that both `cached` and `indexed` are passed
to `codex exec` as `web_search` config overrides.

GitOrigin-RevId: 0cf98c9a32f4da31fecc50da71acb601f6043b47
2026-11-21 01:40:15 +00:00
Alex Kira 619d36f810 Tag user reports with the latest reasoning removal status (#62883)
## What changed

Set the `cot_removed` tag from the latest completed sampling
request on the live thread. Use `true` for reported reasoning removals
and `false` for an explicitly empty report. Omit the tag when no report
is available and discard any caller-supplied value.

Clear the stored result when thread history is replaced. A resumed
session starts without a stored result.

## Testing

Cover tag values in saved reports across tool calls, compaction, and
session resume. Verify that failed compaction preserves the last
sampling result.

GitOrigin-RevId: f1568567a6b4a62685569478fc7194f4357cb605
2026-11-21 01:30:29 +00:00
viyatb-oai bb1037ba04 Compose managed domain rules across network config layers (#62882)
## Why

Managed requirements from different sources could not be combined when one
used `[permissions.network]` and another used `[network_proxy]` or
`[experimental_network]`.

## What changed

Allow these tables to compose across sources. The highest-priority list of
each kind replaces lower lists of that kind, while keyed `domains` entries
update individual selectors by source priority. A deny wins when a selector
appears in both surviving lists. A surviving `allowed_domains = []` clears
lower-priority grants, while an empty `domains` map contributes no updates.

Require mirrored domain declarations to agree on how they compose with other
domain sources. Unix socket path rules still require a single network table
spelling across sources.

Carry equivalent denied selector spellings into the effective proxy policy.
When local binding is disabled, an attached executor's explicit local grant
must also satisfy the controller's allowlist constraints. The standalone
proxy can still narrow a wildcard to an explicit local grant.

## Testing

Cover mixed table spellings, list replacement and clearing, conflicting
mirrors, equivalent IPv6 spellings, and local grants in standalone and
attached proxy modes.

GitOrigin-RevId: b3d550d9f462564c89663ea4b15e723f0ea76881
2026-11-21 01:28:12 +00:00
Ned Howley 566020b724 Allow new threads to opt out of Daybreak propagation (#62879)
## Why

App-server clients that prepare threads for later use need to be able
to skip Daybreak propagation for an individual thread when the server
configuration enables it.

## What changed

With `experimentalApi`, pass `daybreakProgramPropagationEnrolled: false`
to `thread/start` to opt a new root thread out. Managed requirements
take precedence. Omitting the field or passing `null` or `true` uses the
configured enrollment rule.

The same field on `Thread` reports actual enrollment for the live
session, including in the start response and `thread/started`
notification. Reusing a live session preserves its enrollment. A thread
returned from stored metadata alone reports `null`, and resuming it
from storage in a new session reports `false`.

## Testing

App-server tests cover enrollment under enabled, required, and disabled
configuration, as well as reporting across live reads and resumes,
unload, and resume from storage. A core test checks that opting out
prevents native helpers from inheriting the root's saved Daybreak choice.

GitOrigin-RevId: f9aae9ff76702b1e5a38d45120cd889a26f8ece5
2026-11-21 01:14:17 +00:00
Jay Chen 66618f0512 Prewarm MCP servers during cloud catalog refresh (#62876)
## Why

A slow cloud skill lookup can delay MCP startup even after the plugin
catalog is ready. If the refresh is canceled while waiting for skills,
it can miss the chance to prewarm those servers before the first turn.

## What changed

Queue MCP prewarm as soon as plugin discovery changes or clears the
catalog. Skill discovery alone leaves the MCP server set unchanged.

At the end of the refresh, queue a retry for eligible MCP startup
failures. If discovery is canceled, check for those failures the next
time the catalog lock is acquired. Reuse pending handshakes and leave
authentication failures and Apps-managed reconnects to their existing
recovery paths.

## Testing

Add regression tests for first-turn tool availability after cancellation,
startup recovery with cloud plugins disabled, and a single retry for a
persistent startup failure.

GitOrigin-RevId: f92162d1629358953d8810d20244e55f07416a01
2026-11-21 00:54:05 +00:00
Sidharth Lakshmanan 0bfb8467da Preserve per-image metadata in app-server image generation items (#62871)
## Why

App-server clients lose metadata supplied by the image backend when
Codex turns the response into a completed image generation item.

## What changed

Expose the backend's `image_metadata` as optional `imageMetadata` in
app-server items and preserve nested values through thread persistence,
resume, and legacy history replay and migration. Keep this metadata out
of model tool output.

Omit empty metadata and discard non-object, oversized, or deeply nested
metadata without dropping the generated image.

## Testing

Extend coverage for per-image parsing, metadata limits, and round trips
through app-server completion, persisted history, and thread resume.

GitOrigin-RevId: 7211a9db1149cb05e6176b08b0462ca173ac72d5
2026-11-21 00:23:59 +00:00
rhan-oai 663358f98d Keep agent concurrency guidance when native tools are disabled (#62864)
## Why

Disabling native multi-agent tools also dropped the default guidance about
how many agents can be active in a session. That limit still matters for
agents running on a host that handles turn admission.

## What changed

When `multi_agent_v2.disable_native_tools` is set, root agents and
subagents receive only the configured
`multi_agent_v2.max_concurrent_threads_per_session` in their default role
guidance. Explicit role overrides retain precedence, and empty role text
still suppresses the guidance.

## Testing

Cover both roles with bundled and catalog-provided role text. Update the
request snapshots for explicit and proactive delegation to show the
concurrency hint with native tools hidden.

GitOrigin-RevId: e940e7a7886b69888002307c021607b19bb87cd0
2026-11-20 23:44:47 +00:00
Charlie Marsh 8ecb4c9d0f Ask the Responses API to omit the echoed tool catalog (#62863)
Set `x-codex-exclude: tools` in the shared Responses API request headers.

GitOrigin-RevId: 6d46bf95fd1b88a4e01e7d0d3b3d995b4a3f6545
2026-11-20 23:43:31 +00:00
Dylan Hurd 941e1dcade Defer built-in Default mode instructions until after Plan mode (#62857)
## Why

Threads that stay in Default mode carry a collaboration-mode prompt even
though they have no Plan mode instructions to supersede.

## What changed

Omit bundled and model-catalog Default mode instructions until a thread
uses Plan mode. Emit Plan mode instructions on entry and Default mode
instructions when switching back. Preserve eligible caller-provided
instructions and carry the active mode through compaction and resume.

## Testing

Cover prompt contents before, during, and after Plan mode in core and
app-server tests, including compaction and resume in the core tests.

GitOrigin-RevId: b734767da15be53c4eccae71994e46eba63a9ecc
2026-11-20 23:12:16 +00:00
Charlie Marsh 63598243af Limit guardian response resampling to one retry (#62852)
## Why

When the retried response also meets the guardian's resampling criteria,
it can trigger another model request and keep the turn from finishing.

## What changed

Consume the original prompt when scheduling the retry. The second
verdict stays buffered until completion and is replayed after usage
accounting, even if it also meets the resampling criteria. Usage from
the discarded first response still counts toward spending.

GitOrigin-RevId: f8ded8f31bd7d9e440c0c92a92a80480acec61d2
2026-11-20 22:24:30 +00:00
Dmitriy Kovalenko 4c153c26c0 Reduce allocations when preparing tool schemas and catalogs (#62849)
## Why

Tool schema budget checks cloned the schema and allocated a JSON buffer
just to measure its size. Building a Responses Lite catalog also cloned
tool definitions before serializing them.

## What changed

- Deserialize schemas from borrowed JSON during compaction, count
  serialized bytes without allocating a buffer, and reuse the parsed
  schema when it fits the budget.
- Serialize borrowed tool specs and namespace members directly, and pass
  filtered specs as an iterator. Preserve the serialized namespace field
  order because the bytes contribute to the `additional_tools` item ID.

## Testing

- Compare the exact serialized Responses Lite catalog against the
  expected namespace layout.
- Add a `tool_catalog` benchmark for connector schema preparation and
  Responses Lite catalog encoding with 1 and 64 tool specs.

GitOrigin-RevId: 6bd03a12fcedd4abfa8c3a03f298243483e98c63
2026-11-20 22:10:45 +00:00
swastik-oai 9735367e18 Return an assessment for explicit Guardian reviews (#62846)
## Why

An explicit `thread/guardianReview` request could return a null assessment when live execution would skip approval, leaving callers without a verdict on the recorded action.

## What changed

Require `assessment` on every successful `thread/guardianReview` response. Review eligible recorded calls even when a command is allowlisted, an MCP tool is configured for automatic approval or has a remembered approval, or the policy disables permission requests. The review runs without executing the call or granting permissions.

Include the MCP server's owning environment permissions in the review context, matching live review.

## Testing

Cover allowlisted commands, permission requests with prompting disabled, and automatically approved MCP tools. Compare live and recorded MCP review input for a server whose owning environment has denied paths.

GitOrigin-RevId: 54689dc043d77f940e10d29842308340f6937980
2026-11-20 21:58:11 +00:00
rhan-oai 2b5111917c Tag all multi-agent role instructions consistently (#62842)
## Why

Only catalog role instructions carried the `<multi_agent_role>` tag,
so the same guidance appeared in different formats depending on its source.

## What changed

Render bundled, catalog, and configured root and subagent guidance as
`multi_agent.role_instructions` developer messages. Wrap the guidance in
`<multi_agent_role>` tags and preserve configured text that's already tagged.
Match untagged parent guidance by its body when filtering forked history.

## Testing

Update prompt and session assertions for tagged role instructions, and keep
the cold-resume test exercising a rollout with legacy untagged guidance.

GitOrigin-RevId: 60c55b5d7227811b92bd1bf125f1cd3a965720fd
2026-11-20 21:42:17 +00:00
tigrantsat-openai 1c0c806028 Record MCP tool call outcomes in traces (#62833)
## Why

A successful JSON-RPC exchange can still return a failed tool result.
MCP error metrics count that failure, but the trace span can lack an
error status. Dropped calls can also leave spans without an outcome.

## What changed

Record `codex.mcp.call.outcome` on `mcp.tools.call` spans and mark
failures with OpenTelemetry error status using the same classification
as the metrics. Record `interrupted` when the call future is dropped
before completion, including before its first poll.

Capture the numeric JSON-RPC error code in `rpc.jsonrpc.error_code`
when available, leaving server error messages and data out of the span.

## Testing

Extend in-memory telemetry tests to check that spans and metrics agree
on error classification and that span attributes omit sensitive test
values. Cover success and cancellation before the first poll and while
the call is pending.

GitOrigin-RevId: 57fcdc36f19cfc2f227c1ec964a932f3cf7eaa04
2026-11-20 20:38:01 +00:00
Ryan Taylor a1afa12273 Let required hooks block continuation on failure (#62831)
## Why

A required hook check can fail to run or return a usable result. Continuing
after that failure can let an action proceed without a completed check.

## What changed

Add per-handler `onFailure` for command and MCP tool hooks. The default
`continue` preserves existing behavior. On supported synchronous hooks,
`block` applies the event's blocking behavior and reports the reason while
preserving failure diagnostics. For example, a failed `PreToolUse` check
prevents the tool from running, while a failed `PostToolUse` check withholds
the result of a tool that already ran.

Expose the policy in the app-server's `configRequirements/read` response.

## Testing

Add tests for command and MCP failures under both policies, and scenario
coverage for blocked tool execution, withheld results, and completion after
a `Stop` hook recovers.

GitOrigin-RevId: 20d6ebda0094382fe052bbf34338edb994cc7bd3
2026-11-20 20:24:34 +00:00
ioanbudea-OAI 0a0b1021f0 Apply elastic Guardian budgets to retained user and sender evidence (#62829)
## Why

Fixed retention limits could discard long user instructions or leave
older sender messages out of Guardian review even when the configured
elastic budget had room for them.

## What changed

- Apply the configured retained-instruction entry limit when capturing
  and restoring user messages. Fixed-budget reviewers use the fixed
  retention window for both user and assistant messages.
- Build elastic sender snapshots at delivery using the receiver's sender
  evidence budget. Give recent user messages first claim on space, then
  include preceding assistant context where it fits. Mark omitted
  evidence and save the snapshot for review and rollback.

## Testing

Add coverage for cross-host delivery after compaction, large sender
snapshots through checkpoint restore and rollback, and how synchronous
and asynchronous reviewers read saved or empty sender snapshots.

GitOrigin-RevId: f0b01a2d558e3286335efac85a4f8645dd9b954b
2026-11-20 20:11:57 +00:00
ioanbudea-OAI ab7a93771e Honor Guardian retention settings for assistant messages (#62828)
## Why

The fixed retention window can discard assistant messages before elastic
Guardian reviews can use them as context for a user's reply.

## What changed

Apply the thread's Guardian retention policy when recording assistant messages,
including confirmed messages sent through the user messaging tool. Keep full
text within the configured record limit and the overall assistant history byte
budget. Preserve an incomplete marker when a confirmed delivery exceeds the
record limit.

Recover the thread's retention settings from saved history and compaction
checkpoints. Fixed-budget reviews continue to use the fixed retention window.

## Testing

Add coverage for record limits during capture and restore, thread-owned
settings recovery, and replay of oversized confirmed deliveries.

GitOrigin-RevId: e828f06824ce6712910a9cc5ef42a438d1ddf27e
2026-11-20 20:10:51 +00:00
ioanbudea-OAI 7fcb825b46 Persist Guardian retention limits in thread settings (#62827)
## What changed

At session startup, derive `assistant_record_bytes` from the Sync Elastic
per-entry token limit for retained user instructions. Use the default
section limit when the configuration omits that section.

Store the resolved byte limit in the optional `guardian_retention` field
of `ThreadSettingsSnapshot` and update the app-server schema. Fixed-mode
snapshots omit the field, and older snapshots can still be read.

GitOrigin-RevId: a8de88c5bd0e35c4a114577e70fb0c858acb13c9
2026-11-20 20:08:33 +00:00
yitaoh-oai 4360c5f813 Remove model-selected Search MCP routing (#62808)
## What changed

Use the turn's effective `web_search` mode for standalone and hosted
web search. Remove model-selected Search MCP discovery, fallback, and
provider tracking across thread resumes.

Remove `web_search_provider` from model metadata, the
`tools.client_search_provider` hint from configuration, and the
`hosted_search_policy` feature flag. Update the app-server schemas and
generated SDK types to match.

GitOrigin-RevId: 59e3371f4a43d532a484db52d5998f6770292028
2026-11-20 17:46:32 +00:00
cassirer-openai 076ac7856b Link agent tool calls to delivered messages in rollout traces (#62709)
## Why

Matching messages by text can link a tool call to an earlier message
with the same content. A recipient can also accept a message without
ever including it in a model request.

## What changed

Record the originating tool call ID when the recipient adds a spawn,
task assignment, or message to its history. On replay, use that ID to
link the accepted message to its sender even if the recipient records
it before the sender tool finishes.

Keep the interaction edge pointed at the recipient thread until the
message appears in a model request. Track distinct conversation items
across history resets and count repeated prompt prefixes only once.

## Testing

Replay tests cover identical message text, receipt before tool
completion, and messages observed again after compaction.

GitOrigin-RevId: ccab7c33993ba5fce7fceb733dc90c9d428ec78f
2026-11-20 08:49:07 +00:00
Eric Traut 0f3a4756f9 Let administrators disable Codex daemon updates (#62690)
## Why

The daemon's automatic update preference still permits manual updates.
Administrators need a policy that covers both paths.

## What changed

Set `features.daemon_updates = false` in managed `requirements.toml` or
local MDM policy to block scheduled updates and manual daemon package
replacements. Updates are allowed by default. User configuration cannot
override the policy, and cloud-delivered requirements reject the setting.

When policy blocks updates, the TUI hides update actions in `/daemon`,
suppresses update offers in version notices, and directs users to their
administrator where a newer daemon is required.

## Testing

Add coverage for the default, disabled, and invalid policy cases,
rejection of the setting in cloud requirements, and the TUI with daemon
updates disabled.

GitOrigin-RevId: de9e50c4acc4dc8e83bbd2b9a5e902deb8c6f477
2026-11-20 07:14:27 +00:00
Anthony Tafoya 2fb728da7d Retry executor discovery V2 failures with backoff (#62679)
## Why

Discovery could retry transport failures on successive lookups while
caching server errors until invalidation. That could repeat requests
against an unhealthy executor or leave a session without an inventory
after the server recovered.

## What changed

Cache failed discovery loads per context and return the cached error
during cooldown. The first lookup after cooldown retries, with delays
doubling from 1 second up to 30 seconds on consecutive failures.
Successful inventories are reused, canceled loads add no cooldown, and
explicit refresh clears the cooldown for the next lookup without
interrupting in-flight readers.

Compare discovery snapshots to detect inventory changes so recovered
plugins and MCP capabilities can become available without an explicit
refresh.

## Testing

Cover backoff timing, shared results for concurrent callers,
cancellation, and refresh bypassing cooldown. Exercise recovery after
failed prewarming and verify that MCP inventory updates after recovery.

GitOrigin-RevId: 6de34bb8957a0b24ee874e2447157bd3af562430
2026-11-20 06:05:04 +00:00