Commit Graph
2817 Commits
Author SHA1 Message Date
Adam Perry @ OpenAI 9a3c131eb4 Deduplicate model catalog strings in memory (#63735)
## Why

Identical instructions and tool descriptions can appear in multiple
model catalog records. Each decode or clone previously allocated its own
copy of that text.

## What changed

Use `CodexCachedStr` for catalog instructions, messages, and tool
overrides. It stores short strings inline and interns longer strings so
independent decodes and clones can share storage. Resolved incremental
tool messages also reuse cached text from overrides and bundled defaults.
JSON and generated TypeScript still represent these values as strings.

## Testing

Add tests for shared storage across catalog fields, independent decodes,
clones, and incremental tool defaults. Cover plain JSON string round
trips and borrowed access to short inline UTF-8 strings.

GitOrigin-RevId: 6f53b4e19f01f6ed52a8fd364279b924cf794be2
2026-11-24 20:21:47 +00:00
ioanbudea-OAI 77acaa207f Keep rejected audio file IDs out of protocol events (#63667)
## Why

Codex needs rejected audio file IDs when reconstructing a session so
later model requests can omit those attachments. Clients only need the
turn error.

## What changed

Store rejected audio file IDs as rollout metadata and restore them from
that metadata when replaying history. Keep the existing JSONL layout
under `error.rejected_audio_file_ids` so older versions can still read
newly written rollouts.

## Testing

Add a regression test that round-trips a legacy rollout entry and
verifies that serializing the protocol event omits the rejected IDs.

GitOrigin-RevId: 982dd85d0037cebee056caf61d70988762e42767
2026-11-24 16:14:00 +00:00
Charlie Marsh 3e6daebb48 Avoid model lookups for thread metadata and goal updates (#63655)
## Why

A slow model lookup can delay thread metadata reads and goal updates even
though both operations have the settings and data they need locally.

## What changed

Use locally configured settings for app-server thread reads, enrichment,
and direct-input checks. The effective configuration snapshot still
validates the service tier against the selected model.

Record goal updates and emit their raw response events using an internal
submission ID without constructing a turn context.

## Testing

Add a regression test that gates model lookup and checks that the local
snapshot and goal recording complete without requesting model info. It
also checks that the goal event matches the history item and that the
effective snapshot filters out an unsupported service tier.

GitOrigin-RevId: 7d008edd775ae459a1fd1e3db79f38f2d9b5ca30
2026-11-24 14:52:00 +00:00
swastik-oai 53fe98bdc2 Accept an explicit tool call in Guardian review requests (#63654)
## Why

Selecting the final item in an idle thread's history ties Guardian review
to what was recorded. For example, a client may record an `exec` script
and need an assessment of an individual `exec_command` from that script.

## What changed

Require `toolCall` in the experimental `thread/guardianReview` request.
Guardian assesses the supplied `function_call` or `custom_tool_call`
against the idle thread's full history without appending or executing it.

## Testing

Cover rejection of requests missing `toolCall` and verify that Guardian
sees the recorded script alongside each command submitted for review.
Check that only the original script call is persisted in the thread.

GitOrigin-RevId: a1ce61e10e98107b38db60071dd63f189ef33ad1
2026-11-24 14:35:46 +00:00
jif 75df5098a6 Route in-memory message board notifications through app-server (#63641)
## Why

The SQLite message board can queue native agent mail through app-server.
In-memory boards previously relied on the host's notification callback
for delivery.

## What changed

Add `launch_in_memory_with_app_server` so runners can opt into the same
bounded, queue-only delivery as SQLite via `thread/inject_items`. The
host still resolves agent membership, and the shared notification client
queues post previews without starting a turn.

## Testing

Extend the app-server integration test to check that, after an
app-server restart, a post from each backend reaches an idle worker
exactly once on its next turn. The test also checks that app-server
delivery bypasses the in-memory host's notification callback.

GitOrigin-RevId: fc01b5e3f43dcfca5f43366f0b184c41dc07f9eb
2026-11-24 13:50:12 +00:00
jif a0d5b0a661 Let idle child threads unload while the message board is connected (#63621)
## Why

The message board connects to the app server to inject messages. Automatically subscribing it to new threads keeps idle child threads loaded after their last other subscriber leaves.

## What changed

Skip automatic subscriptions to newly created threads for clients that initialize with the shared `codex_message_board` client name.

## Testing

Add a WebSocket regression test that unsubscribes the parent thread's client from a completed child thread, checks for `thread/closed`, and confirms through the original message board connection that only the parent remains loaded.

GitOrigin-RevId: 73af9e370b90c59f984c4bc804140febb0308d9b
2026-11-24 11:57:55 +00:00
JonLuca De Caro abc92e6bd4 Report per-server MCP startup durations (#63613)
## Why

Required MCP servers can finish at different times even when their startup
notifications arrive together. Notification arrival times cannot show how long
each server took to start.

## What changed

Measure each startup attempt and expose its elapsed milliseconds as
`durationMs` on `ready` and `failed` updates from
`mcpServer/startupStatus/updated`. Successful Codex Apps reconnects report
their own duration. Reused connections, `starting`, and `cancelled` updates
carry `null`. The protocol accepts notifications from older servers that omit
the field.

## Testing

Cover distinct durations for fast and slow required servers, timing through
lease registration for newly opened shared connections, and a fresh duration
after Codex Apps recovery.

GitOrigin-RevId: 39c0c418149dd2b220828be04d998085f57acf2d
2026-11-24 11:05:19 +00:00
jif c3186b5d95 Test thread previews through the app-server rollout path (#63603)
## Why

The existing preview test exercised a summary extractor used only in
tests, leaving the app-server rollout preview path without that check.

## What changed

Remove the test-only summary extractor and test
`preview_from_rollout_items` directly. Verify that the preview skips
`AGENTS.md` instructions and strips the preceding context to return
`Count to 5`.

GitOrigin-RevId: 123f0db2807cd2d95d85b3f99da9152f24cd50ff
2026-11-24 10:33:10 +00:00
verma-oai 37aeac06b3 Add opt-in deferred image generation in code mode (#63594)
## What changed

Add `features.defer_image_generation` so code mode can discover the image
generation tool through `ALL_TOOLS` without including its definition in
the initial model request. Direct exposure remains the default and
applies when `image_gen` is excluded from code mode.

## Testing

Update the app-server GIF edit test to discover and invoke the deferred
tool through code mode. Verify that the initial request omits the tool
definition, the discovered definition includes the GIF option, and the
edit preserves animation and API defaults.

GitOrigin-RevId: 899f689bae0b86099a0ca3736d1cd2576bc3a7a9
2026-11-24 09:52:16 +00:00
jif d4b84f9bb0 Remove legacy thread summary test helpers from the app server (#63593)
## What changed

Delete the test-only helpers for converting state database metadata into
a `Thread`, along with the unit test that checked whether those helpers
preserved subagent nicknames and roles.

GitOrigin-RevId: 0218372fd82f9efd4d79a1a44f662d781bc5df5a
2026-11-24 09:49:12 +00:00
Dylan Hurd 74f208237b Avoid exec-server port races in selected capability tests (#63588)
## Why

Releasing the fixture's loopback port before starting `exec-server`
lets another process claim it before the server binds.

## What changed

Keep the configured endpoint bound without serving WebSocket handshakes,
so it stays unavailable even across app-server restarts. Let each live
`exec-server` bind an ephemeral port and use the URL it prints to update
the same environment ID via `environment/add`.

GitOrigin-RevId: eedfecee40b410b32b2d62774b0a46d1ef5575f6
2026-11-24 09:34:21 +00:00
marksteinbrick-oai baf9b39b16 Report workspace kind on TUI composer turns (#63545)
## Why

A TUI composer prompt does not supply `workspace_kind`. The app server
can derive it from the thread's current project assignment.

## What changed

Use the staged assignment until the thread is saved, then read the
persisted assignment on each new composer turn. Use `project` or
`projectless` as a fallback for model request metadata and turn analytics.
Explicit client metadata takes precedence, and the inferred value stays
with the originating turn.

## Testing

Cover the model request header and analytics event on the first turn,
on a follow-up, and after removing the project assignment. Unit tests
cover explicit metadata precedence and verify that MCP requests,
extensions, and child agents do not inherit the inferred value.

GitOrigin-RevId: 62b88484dd4028a6b72584999e0fa9b84e6e3b03
2026-11-24 05:33:38 +00:00
Brent Traut 6aaf2a86b1 Connect Codex Desktop MCP over Unix sockets (#63497)
## Why

An SSH forward can replace its Unix socket listener while the old
keep-alive connection remains open. Reusing that connection can leave
MCP requests waiting on the old listener.

## What changed

Route `codex-desktop://<uuid>` endpoints to the corresponding Unix socket
for local `codex_app` servers with explicit HTTP authorization. Allow
`http_headers_helper` to supply supplemental headers while preserving the
configured authorization. Socket requests bypass proxies, strip
`Proxy-Authorization`, and disable redirects.

Reuse pooled connections while the socket is unchanged and discard them
when the listener is replaced or the socket disappears.

## Testing

Add coverage for authenticated Desktop startup, rejection of helper-only
authorization and other server names, and reconnection after socket
replacement while the previous connection remains open.

GitOrigin-RevId: a38e55d8cd726299506b487d1223fe64bd856e80
2026-11-24 02:20:22 +00:00
Alex Ionescu e173e7b9b2 Verify signed remote plugin archives before extraction (#63489)
## Why

Remote plugin downloads need to check that the archive matches the digest
and signature supplied by the release before using its contents.

## What changed

Use the shared archive verifier for remote installs, installed-plugin
updates, shared plugin checkouts, and measurement reference downloads.
Fetch signing keys through the authenticated plugin service transport.
Reject malformed signing metadata and failed verification before extraction,
and continue accepting releases that omit signing metadata.

## Testing

Extend runtime authentication coverage to check that signing-key requests
include the product SKU header and that a prepared request fails after its
network policy is revoked.

GitOrigin-RevId: 27322921cd2778a3f06d1dee124dd8a5037c2f00
2026-11-24 01:28:15 +00:00
arnavpatidar-OAI 8bb8ed6bab Add gateway enrollment to local managed requirements (#63476)
## Why

Administrators who use one gateway for managed configuration and model
requests need to configure the gateway URL and OAuth settings in two
places. A single enrollment keeps those settings together.

## What changed

Accept `[gateway]` with a base URL and `[gateway.auth]` in system
`requirements.toml` or MDM. Use the same OAuth settings for the config
server at the gateway root and the required Responses API provider at
`/v1`, with model discovery at `/v1/models`.

MDM enrollment replaces system enrollment as a unit. Requirements
composition rejects remote enrollment, conflicting config server or
provider settings, and empty or reserved provider names.

## Testing

Add composition tests for MDM precedence, remote enrollment and
rerouting attempts, and invalid or conflicting enrollment settings.

GitOrigin-RevId: 35f04481dc2b592e25afa4ac9235481cd90cf915
2026-11-24 00:14:14 +00:00
vishnu-oai 83077214a4 Reuse config server discovery when loading managed policy (#63473)
## Why

CLI login and interactive TUI startup could look up the same config server's
OAuth metadata again when loading managed policy, even after resolving it
for sign-in.

## What changed

- Carry the resolved config server settings in memory from sign-in to policy
  loading and through TUI startup and worktree setup. Reuse them only when
  the configured server, outbound proxy policy, and system proxy fallback
  setting match.
- Rediscover anonymous servers after onboarding so the TUI can pick up a
  newly enabled OAuth requirement.
- Use discovered OAuth settings to classify app-server startup errors as
  config server errors when applicable.

## Testing

Add a regression test that blocks discovery requests and checks reuse for
matching OAuth and anonymous resolutions, as well as cache misses when the
server or either proxy setting changes.

GitOrigin-RevId: 28b5c8ffdb80db09dd8bbae3c1e187189ea393bf
2026-11-24 00:11:35 +00:00
Matthew Zeng d4af2452f7 Honor explicit plugin disablement without a global default (#63468)
## Why

Without `plugins._default`, the activation policy ignored a plugin's explicit `enabled = false`. The CLI also reported remote plugin enablement directly from the marketplace, so its output could disagree with the effective state.

## What changed

Apply per-plugin enablement before falling back to `plugins._default.enabled`. The `codex plugin list` command now applies that policy to remote plugins, so an installed plugin can appear as disabled while retaining its installation and account settings. Plugins disabled at their source stay disabled.

## Testing

Cover explicit disablement without a global default in config and remote plugin loading tests, and check that the CLI reports the plugin as installed and disabled in both JSON and table output.

GitOrigin-RevId: ab9f5a5b36150d7350c2d11a8421f9e14524a1ad
2026-11-23 23:39:54 +00:00
jif aae9db9f5f Test subagent metadata on stored thread conversions (#63422)
Remove the app server's test-only rollout summary reader and cover
subagent nicknames and roles through the conversions from `StoredThread`
to a thread and a summary. Keep the summary assertions for millisecond
timestamp precision.

GitOrigin-RevId: f7481fd3c2d4d332ee094a62ec7cad8997903cdb
2026-11-23 20:06:57 +00:00
jif 964fdd565e Remove the empty-preview rollout summary test (#63414)
## What changed

Delete the app-server unit test that reads a rollout containing only
session metadata and expects an empty preview when there is no user
message.

GitOrigin-RevId: fd033dec4e938b0352620ca76c448ae9e650493f
2026-11-23 19:13:12 +00:00
jif 9c7103216f Remove the app-server's test-only thread summary helper (#63408)
Delete `summary_from_thread_metadata` and the unit test that checks its
second-precision timestamp formatting.

GitOrigin-RevId: 917c0d28bb486c69baba8142ac84cc9057c6d5ee
2026-11-23 18:57:13 +00:00
ioanbudea-OAI 74efed3bf3 Apply current approvals reviewer policy after thread revert (#63390)
## Why

If Guardian policy changes while `thread/revert` is in progress, restoring
the saved effective reviewer can carry an outdated policy decision into
the replacement runtime.

## What changed

Resolve the saved reviewer request against the current Guardian policy
when the replacement runtime starts. Use the previous effective reviewer
as the request if no explicit request was saved.

## Testing

Extend the revert regression test to switch the reviewer allowlist from
`auto_review` to `user` after the settings snapshot and verify that the
replacement honors the original `user` request.

GitOrigin-RevId: a66fceb19e201b921d111f7a299c2be2c8a451ad
2026-11-23 18:00:50 +00:00
Charlie Marsh af81d2770f Avoid cloning turn history in thread/fork (#63382)
Move the turns into the fork response and clone only the thread metadata.
The `thread/started` notification already omits turns.

GitOrigin-RevId: 8ffcefa3b6ed0908b511a58b53d034674ee8b668
2026-11-23 17:13:13 +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
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
jif c983e8d171 Deliver detached message board notices to native agents (#63354)
## Why

The detached SQLite message board could store posts but could not notify
the agents named in `agents_to_notify`.

## What changed

Add an optional `--app-server ws://127.0.0.1:PORT` flag to
`codex-message-board-mcp`. When configured, the board uses
`thread/inject_items` to queue notices in native agent mailboxes without
starting a turn. The board and app-server must share the same Codex
registry.

Delivery is best-effort. Posts stay stored if a notice fails, and the
next notice can reconnect without replaying the failed one.

## Testing

Cover concurrent requests, notice size limits, and reconnect after a
timeout without replay. Exercise the detached executable against a
restarted app-server and verify that a native child receives the queued
notice once when it resumes.

GitOrigin-RevId: 8b890b30df94590686d91921d814887eda5d9c9b
2026-11-23 15:13:44 +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 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
Eric Traut a1604a8c05 Tag goal creation metrics with reasoning effort (#63281)
## Why

The `codex.goal.created` counter cannot distinguish goals created at
different reasoning efforts. A tool call can also run at a different
effort from the thread's default after a turn settings update.

## What changed

Add a `reasoning_effort` attribute to `codex.goal.created`. For goals
created by `create_goal`, read the effort from the invoking step's
metadata. For goals created outside a turn, use the thread's configured
effort or fall back to the model default. Label custom values `custom`
and unavailable values `unknown`.

## Testing

Extend the thread resume integration test to check that the exported
metric records `medium` for a goal set before the first turn and `high`
for a goal created by a tool after a turn settings update.

GitOrigin-RevId: 83b3c8c1073551b67453314eb559c5e648af3521
2026-11-23 07:45:08 +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
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
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
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
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
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
arnavpatidar-OAI cf8992e940 Enable configuration server OAuth during app-server startup (#62867)
## Why

When an organization's configuration server requires a new OAuth grant,
clients need a way to sign in before the app server starts so they can
load and validate the required settings.

## What changed

- Have `--print-startup-config` return the `configServerLogin` action
  when browser sign-in is required, and verify that the required server
  settings were applied before returning startup requirements.
- Add `codex app-server --startup-oauth`, a dedicated stdio mode that
  resolves the configuration server from local managed requirements,
  sends the client a browser authorization URL, and handles the callback,
  token exchange, and credential storage. Clients can cancel a pending
  sign-in or rerun `--print-startup-config` after it succeeds.

## Testing

Add a test that checks the browser handoff URL and verifies that
cancellation completes the pending login request with `LoginFailed`.

GitOrigin-RevId: 00f10d28befe33539882f4f3c0d2baf868ceb4a1
2026-11-21 00:03:42 +00:00
arnavpatidar-OAI b392250f48 Define the startup OAuth protocol for config servers (#62859)
## What changed

Add the optional `target` field to `account/gatewayOAuth/login`.
The startup protocol defines `{"kind":"configServer"}` as a target
for `--startup-oauth`, mutually exclusive with `modelProvider`.
The regular app-server login handler rejects explicit targets.

Define `StartupGatewayOAuthChangedNotification` with the target,
status, and authorization URL for the browser handoff. Export the
new types in the JSON schemas, TypeScript bindings, and Python SDK.

## Testing

Update the TUI device login regression test to expect `target: null`
when signing in to a resumed thread's saved gateway.

GitOrigin-RevId: fb3ce66a143cad9ad56c93f3ac37f8b6f1abdb0e
2026-11-20 23:24:10 +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
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
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 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
vishnu-oai 60fc55bb69 Enable OAuth discovery by default for config servers (#62824)
## Why

Config servers that publish OAuth metadata still required administrators
to configure OAuth endpoints explicitly for Codex to use them.

## What changed

- Discover OAuth metadata when `config_server.oauth` is omitted. Use
  explicit settings when provided, and fetch managed configuration
  anonymously when discovery finds no metadata.
- Have the Git credential helper resolve the config server before
  fetching managed configuration. It refuses explicit or discovered
  OAuth so it can apply workspace policy without opening the OS keyring.
- Apply local network policy to discovery during `codex logout`.

## Testing

Cover app-server recovery after a discovery failure, Git credential
helper rejection of explicit OAuth without a network request, and
logout discovery blocked by local network policy.

GitOrigin-RevId: 1ad84effef48fd9b56371ee177bd53c54f3e87b8
2026-11-20 19:16:07 +00:00
jfoo-oai 51f4b8af01 Include native USD in ChatGPT turn cost telemetry (#62810)
## Why

When a turn incurs usage priced directly in USD, reporting only the
credit-converted estimate understates its cost.

## What changed

Sum `estimated_usage_usd_micros` and `native_usage_usd_micros` for
settled turns. Default an omitted native USD field to zero for legacy
responses. Suppress the total when either component is unavailable
(including explicit null), either is negative, or their sum overflows.

## Testing

Cover omitted and null native USD values, zero costs, negative amounts,
and overflow in backend client tests. Verify that the combined amount
reaches the OTLP exporter in the app-server integration test.

GitOrigin-RevId: 8709e48329db813cd66baf270ee3f1bcfd87cb03
2026-11-20 17:59:03 +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
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
Vivian Fang a0a30c40e8 Add thread and child retention policies for injected items (#62654)
## Why

The `always` policy ties retention across context windows to inheritance by
spawned agents. Callers need to control those behaviors independently.

## What changed

- `alwaysInThread` carries items across context windows in the current thread
  and excludes them from spawned agents, including full-history forks.
- `alwaysInChildren` passes items still in the parent's context to spawned
  agents and leaves each thread's context-window retention to the usual rules.
- `always` continues to apply in both scopes, including for items saved by
  older versions. Retained tool calls and outputs must be adjacent, with the
  call first and the same retention policy on both items.

## Testing

Extend integration coverage for retention across remote compaction, inheritance
by spawned agents, and injection through the app server.

GitOrigin-RevId: aafede69cfbe149aa52292e6029d248d4bdf6401
2026-11-20 02:59:58 +00:00
Felipe Coury e787cf7024 Return file sizes from fs/getMetadata (#62653)
## What changed

Add `sizeBytes` to the app server's metadata response so clients can
read a file's size in bytes from its metadata. The field reports the
target file's size for symlinks to regular files and is `null` for
paths that resolve to directories or other non-regular files. The
protocol schemas and generated Python SDK model accept responses from
older servers that omit the field.

## Testing

Cover byte counts for regular files and symlinks to files, explicit
`null` for directories, and decoding responses that omit `sizeBytes`.

GitOrigin-RevId: fcc7bda9e55bd0584c1eff4af059422af282da9f
2026-11-20 02:42:43 +00:00
Owen Lin 10ca17496f Pass inherited history visibility to the thread store (#62644)
## What changed

Add `InheritedHistoryVisibility` to `CreateThreadParams` and pass it through
prepared forks. `Full` is the default and remains the mode used by app-server
forks. `ModelContextOnly` requests that `list_turns` and `list_items` omit
inherited history. The local thread store rejects that mode as unsupported.

## Testing

Add a regression test that requests `ModelContextOnly` through a prepared fork
and checks that the local store's unsupported-operation error reaches the caller.

GitOrigin-RevId: de675d6b83ca610eca5a304b9622b312d64828f6
2026-11-20 02:02:55 +00:00
Brent Traut 7642e80723 Release persisted MCP tool results from active-turn memory (#62641)
## Why

Active turns in paginated threads retain completed MCP tool results in
memory even when history can supply the same payloads. History can also
store a truncated preview, so dropping a result requires checking that
the full payload is recoverable.

## What changed

For persisted paginated threads, check successful MCP calls in batches
and release an active-turn result only when the stored result matches
it exactly. When resuming with full history, fetch released results by
item ID so a stale history page cannot supply an older result.

## Testing

Add a regression test that restores the latest result despite a stale
page and checks that truncated, metadata-mismatched, missing, and failed
results remain in memory.

GitOrigin-RevId: 49f6f1414201e4327433043050d65a1f4adc9720
2026-11-20 01:49:15 +00:00