Commit Graph
12987 Commits
Author SHA1 Message Date
jif 9a3303253b Remove unused standalone connector listing helpers (#63692)
## Why

The app server already passes its environment and MCP managers to
connector discovery, leaving the standalone listing helpers unused.

## What changed

Remove the unused listing wrappers and re-exports from `codex-core`
and `codex-chatgpt`, including the setup that created temporary managers.
Move `tokio` to the dev dependencies of `codex-chatgpt` and enable only
the features its tests use.

GitOrigin-RevId: 757b32afeb6e46dddb46d507c5af07bf8ff7a2a3
2026-11-24 17:32:08 +00:00
jif f67868d050 Align sandbox retries with the permissions reviewed for them (#63683)
## What changed

Build the retry from the initial sandbox attempt. When policy permits an
unsandboxed retry, clear the sandbox settings and mark the command as
`RequireEscalated` for approval. When policy requires the sandbox to stay
in place, reuse the initial attempt so a network retry preserves file read
restrictions.

## Testing

Cover both Guardian verdicts after a sandboxed attempt. An approved retry
reaches the exec server without a sandbox, and a denied retry is blocked
before it reaches the executor.

GitOrigin-RevId: 5bf36dd4f43b7c0379457b88b8ddbf3dbd482b87
2026-11-24 17:19:40 +00:00
jif a009fc6a4e Remove unused core config loading wrappers (#63682)
Drop the deprecated `load_config_as_toml_with_cli_*` helpers and
`Config::load_with_cli_overrides_and_harness_overrides`. Existing callers
can use `ConfigBuilder` to apply harness overrides and
`load_config_toml_with_layer_stack` to inspect raw config during startup.

GitOrigin-RevId: 4901d876cf4d87094055f9907bd761525057fa99
2026-11-24 17:18:29 +00:00
jif 5e857c65a5 Remove unused spawned-thread lookups by agent path (#63678)
GitOrigin-RevId: 2bb6d0d64df0cfeed79a08e55ed437db864dd1d6
2026-11-24 17:03:35 +00:00
Felipe Coury 39c6485cb7 Fix Home and End navigation in the agent center (#63677)
## Why

The agent center's `Home` and `End` shortcuts skipped the **Show more**
row, so pressing `End` could stop before the last selectable row.

## What changed

Jump to the first or last selectable row and preserve whether **Show
more** is selected across view refreshes. Reconcile selection when
toggling search on and let the cancel shortcut dismiss search even when
the view cannot return to chat.

## Testing

Add a regression test that presses `End`, `Home`, and `End` across
view refreshes and verifies that `Enter` on **Show more** requests
another page.

GitOrigin-RevId: e508c7926ce83b68c229d638364e6e41f671490e
2026-11-24 17:02:17 +00:00
felixxia-oai 9863043881 Wait for pending history writes before Guardian v3 reviews (#63675)
## Why

A root-thread instruction can be visible in memory while its history append is still pending. Guardian v3 reads persisted history, so a review can miss a newer instruction that revokes permission for an action.

## What changed

Track pending appends for review-relevant root history and wait for confirmation before capturing the evidence cutoff for an initial review or retry. Confirm the append when the thread store accepts the history batch, before updating thread metadata.

If an append goes unconfirmed, fail review preparation and prompt the user to reload the root thread and resend any missing instructions.

## Testing

Add regression coverage for initial and retry cutoffs waiting on a pending revocation, failed appends of forwarded instructions, and history remaining readable after an acknowledged append followed by a metadata failure.

GitOrigin-RevId: b83ca178ca7b58dbc23b1f064b402df30f9689e1
2026-11-24 16:46:52 +00:00
felixxia-oai e713c4c302 Batch Guardian review history cutoffs by root thread (#63673)
## Why

Concurrent Guardian reviews of the same root thread can repeat history
flushes and reads to establish how far to route evidence.

## What changed

Share one flush and durable history position across binding and catch-up
requests queued before capture begins. Requests arriving during capture get
a fresh position so they can account for newer records. A lone catch-up reads
unread records and their end position together, skipping the separate tail
read. Catch-up still waits for evidence to be routed through its cutoff.

## Testing

Cover shared cutoffs and read failures, separate capture for late arrivals,
and a lone retry that picks up a newer revocation without a separate tail
read when another queued request is canceled.

GitOrigin-RevId: ef07231d66bc38d8b244b6ee37ec3d483b54bc0f
2026-11-24 16:45:39 +00:00
jif 6b7a16fe76 Remove unused HTTP client APIs (#63669)
## What changed

- Remove the deprecated `build_with_transport_default_proxy` method and
  inline its shared helper into the remaining caller, `build_direct`.
- Remove the unused `has_chatgpt_cookies` accessor, `with_raw_body`
  setter, and `with_chatgpt_cloudflare_cookies_without_redirects` pool
  constructor.

GitOrigin-RevId: 9dd19b7a28b1aac6f196968b53160ffbc7443b8a
2026-11-24 16:15:13 +00:00
jif 1a6c8514cc Make the remote MCP timeout test expire during discovery (#63668)
## Why

The discovery test used a 15-second deadline, which let RMCP fall back to
`initialize` after 10 seconds. The test needs to cancel a stalled
`server/discover` request to verify that discovery cancellation releases
the remote executor.

## What changed

Warm up the executor's HTTP connection with a successful `GET /ready`
before starting a 5-second discovery deadline. Keep the 15-second
deadline for the legacy handshake test.

GitOrigin-RevId: cbf299fc264c2635e0ea471545010bccbdcee94d
2026-11-24 16:14:36 +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
jif cba3c40cf7 Defer parsing response items until completion when streaming is suppressed (#63666)
## Why

Mailbox preemption can discard partial response items, and turn item
contributors can rewrite completed items. Parsing those items as soon as they
arrive does extra work before their final contents are known.

## What changed

During mailbox draining or when turn item contributors are registered, track
new response items as deferred, suppress their text and reasoning deltas, and
wait for `OutputItemDone` before parsing them. Rely on the response client to
carry the added item's ID forward when the completion omits it.

## Testing

The mailbox preemption tests check that a buffered reasoning item completes
exactly once under its original ID when the completion omits it, and that raw
reasoning deltas for a discarded item stay hidden.

GitOrigin-RevId: 940e062c8c44faa6670945262ee8c8f16abf4e20
2026-11-24 16:12:32 +00:00
jif ebd5c2fddc Make unified exec output closure race-safe (#63664)
## Why

The output collector could miss a closure notification while starting its
post-exit wait. It could also see an empty buffer just before the producer
appended its final chunk and closed the stream.

## What changed

Use a dedicated `CancellationToken` to signal when the output producer is
done. The collector samples closure before draining the buffer so that
closure during the drain wakes it for another pass. The streaming watcher
flushes queued chunks when it observes closure, and sandbox denial checks
can proceed immediately when output is already closed.

## Testing

Update the bounded collection test to verify that closure alone wakes
the post-exit collector and that the final bytes survive repeated drains.

GitOrigin-RevId: 4b94a018d784664031f326ec360d27fcf166bbda
2026-11-24 15:53:55 +00:00
jif 3781b6c627 Remove no-op rate limit polling hooks from the TUI (#63661)
## What changed

Remove `ChatWidget`'s prefetch and poller shutdown hooks from widget
creation, teardown, and the transition to background voice mode.
Prefetch only called the empty shutdown hook.

GitOrigin-RevId: c25c33a53d63be982d8cfebf405401a4c4f0e0c4
2026-11-24 15:35:38 +00:00
jif 5a2cb73580 Remove the unused codex-utils-readiness crate (#63660)
GitOrigin-RevId: 68ea46742c3c08a2dda097bb385f91e388b8bba4
2026-11-24 15:17:36 +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 5f2bd3342f Remove unused SQLite thread-listing helpers from rollout (#63652)
Delete `list_archived_threads_from_state_db` and the `list_thread_ids_db`
helper for parity checks.

GitOrigin-RevId: cfcd7b24dd0dfbc97c7b245ef00390c0aded872b
2026-11-24 14:34:38 +00:00
jif a2c17b833c Frame pending native agent calls as Guardian approval requests (#63649)
## Why

A pending native agent call can appear alongside historical tool calls in
Guardian's review context. Explicit request boundaries identify the exact call
Guardian should judge.

## What changed

Add the off-by-default `guardian_native_action_framing` feature for Multi-Agent
V2 reviews with native multi-agent history enabled. Wrap the pending call and
its evidence-only output in approval request markers, and point the transcript
entry to the current request.

Keep the call-ID reference when reviewer history already contains the call.
Reserve room for the approval markers when budgeting screenshots so a retry
can replay the framed call if reviewer history changes.

## Testing

Cover call deduplication, replay after compaction, and screenshot admission at
the token limit. Update the incremental review scenario to show the framed
`send_message` call alongside encrypted parent reply history.

GitOrigin-RevId: dd99cd4ad4cf3451afe30d2e93aa3e47b493a4c4
2026-11-24 14:20:14 +00:00
jif 9acdf80aaf Remove the unused agent extension crate (#63648)
## What changed

Delete `codex-agent-extension`, whose `AgentRunner` submitted resolved
agent prompts in forked legacy threads and was used only by the crate's
integration test. Remove the test, the Bazel target, and the crate's
Cargo workspace and lockfile entries.

GitOrigin-RevId: 1e966ccb7b7f37f6cdd68882975bb1e940ae85db
2026-11-24 14:19:35 +00:00
jif 264f7d60f5 Return startup timing with MCP connection attempts (#63647)
## What changed

Have the MCP connection pool return an optional startup measurement
alongside the connection result. For a new connection, measure through
lease registration when required, including when registration fails.
If a chat falls back to opening its own connection, start the timer at
the fallback. Joining an existing connection produces no startup
measurement.

## Testing

Pool tests cover timing a lease-open timeout on a new connection,
omitting timing for the same timeout on a reused connection, and
recording timing when a chat falls back to its own connection.

GitOrigin-RevId: 364963ca2f4e7bd8338c8acc9a7869e3a7a6e9c4
2026-11-24 14:18:12 +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 e351ffa4b6 Remove the legacy test-only /mcp renderer (#63639)
## Why

The TUI renders `/mcp` from app-server `McpServerStatus` responses.
The legacy renderer's snapshot still exercises grouping by qualified tool
name, a path the command no longer uses.

## What changed

Delete the legacy renderer, its hyphenated-server-name snapshot test and
fixtures, and the TUI's `codex-mcp` dev-dependency.

GitOrigin-RevId: 69f1601f19b34576ea2d9dcebdd2bfb30f414d99
2026-11-24 13:29:54 +00:00
jif 50aeac27d8 Test plugin MCP tool approval overrides in the plugin cache (#63635)
## What changed

Extend the plugin manager's cache test to verify that a per-tool
`approval_mode = "approve"` takes effect after the cache is warmed with
other configurations and is still returned after `.mcp.json` is removed.
Remove the core test for this scenario and its test-only approval lookup.

GitOrigin-RevId: f99d18b435f2c1f3e0574ec2ffedbe24249e6346
2026-11-24 13:01:14 +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
jif 8b096dce07 Remove the TUI snapshot test for /mcp secret masking (#63619)
## What changed

Remove the snapshot test for masking environment variable and HTTP header
values in `/mcp` output, its saved snapshot, and the HTTP server fixture
helper used by the test.

GitOrigin-RevId: d42092505760639776a779e93837a675ac14dece
2026-11-24 11:36:36 +00:00
jif cd97e717de Bump etherparse to 0.21.1 in the Linux sandbox (#63618)
GitOrigin-RevId: cceacdb2dc203de1edd6dbabf4db985d3e002b3e
2026-11-24 11:35:24 +00:00
jif 1f43c02f3f Simplify plugin MCP approval policy tests (#63614)
## What changed

Use a manifest default of `writes` and a user override of `prompt`
in the plugin manager test to verify that the user setting takes
precedence. Remove the standalone tool-call approval test and keep
the regression test that checks a per-tool override after the plugin
cache has been warmed.

GitOrigin-RevId: 667e613729e47507030308646d5adc5b5794e2c2
2026-11-24 11:19:24 +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 32119bac26 Remove the test-only plugin guidance renderer (#63605)
The turn context renders generic plugin guidance through
`AvailablePluginsInstructions`. Remove `render_plugins_section` and its sole
caller, a test that checks the bundled guidance through that helper.

GitOrigin-RevId: 30e2b7aaab9432b7a29b8124676907b8dc1228e9
2026-11-24 10:47:15 +00:00
jif 92a34573a0 Remove the custom MCP tool approval precedence test (#63604)
## What changed

Remove the test that checked whether a tool-level approval setting
overrides the MCP server default, an unconfigured tool uses the server
default, and an unknown server falls back to `Auto`.

GitOrigin-RevId: 68df73cbefe79772d75cdc35abe42d4de3cf991d
2026-11-24 10:46:06 +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
Anton Panasenko 8e757686c1 Let users retry a failed TUI reconnect with Ctrl+R (#63599)
## Why

When automatic reconnect failed in a remote conversation, users had to
relaunch Codex to try again and copy any unsent draft they wanted to keep.

## What changed

Press `Ctrl+R` in an eligible disconnected conversation to start a fresh
reconnect attempt while keeping the draft editable. In Vim mode, the
shortcut works in Insert mode and leaves Normal mode redo intact.

Show the retry shortcut in the chat footer, direct users back to the
conversation from the agents overview, and show a fresh timer only while
a reconnect attempt is running.

Clear stale MCP startup activity on disconnect while preserving the busy
state of an active turn. Check whether a selected slash command is
available before submitting it from the offline completion menu.

## Testing

Extend coverage for retry after timeout, draft preservation, Vim Normal
mode, reconnect status, and offline slash-command handling. Verify that
disconnect clears stale MCP startup activity while an active turn stays
busy.

GitOrigin-RevId: 0742219e891be89a78418c9b8bbc789cd660cec5
2026-11-24 10:02:49 +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
Eric Traut 7ce4437488 Scope resume --approve-for-me to the initial conversation (#63589)
## Why

An already-loaded conversation can ignore permission overrides sent with
a resume request. Applying the preset to the TUI's launch configuration
can also carry it into later conversations.

## What changed

Resolve the preset using the selected conversation's workspace and
managed requirements. Apply it only to the initial resume, so `/new`
and later resumes use the regular launch configuration.

If an already-loaded conversation needs a settings update, read back
its approval and sandbox settings before submitting the initial prompt.
Stop the resume when the server cannot confirm the requested settings
or when workspace or managed restrictions cannot be verified.

## Testing

Regression tests cover CLI flag precedence, updating an already-loaded
conversation, rejecting unverifiable restrictions, and keeping the
preset out of new and subsequently resumed conversations.

GitOrigin-RevId: 6a09097dfc64fdeb890c03cd3e56bb404e5199c8
2026-11-24 09:35:28 +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
Charlie Marsh f64f003d98 Release unchanged prompt image buffers when callers drop them (#63563)
## Why

The prompt image cache keeps original image bytes in memory after the
last caller releases them. A later request already supplies those bytes,
so the cache only needs to remember that they decoded successfully and
could be used as-is.

## What changed

Cache the format and dimensions of validated, unchanged images with a
weak reference to the source buffer. Matching requests share the buffer
while it is live. After it is released, a cache hit takes ownership of
the new input buffer without copying or decoding it again. Concurrent
misses reuse the first live result when inserting into the cache.

Key entries by a BLAKE3 hash of the input, image mode, and decoder
choice. Keep transformed outputs in the cache and apply the byte budget
using source length for unchanged images and allocation capacity for
transformed outputs.

## Testing

Cover buffer sharing and release, reuse after release, concurrent cache
misses, and byte-budget eviction. Verify that a warm cache still rejects
a PNG with corrupt pixel data.

GitOrigin-RevId: b830ecaf8af713bdcc4d1c7782675ad77db74229
2026-11-24 06:52:29 +00:00
Abhinav 9038698ffa Use the active thread's provider in the TUI model picker (#63553)
## Why

A resumed thread can use a different model provider from the app server's
default. A single catalog can show models from the wrong provider when the
user opens `/model` in that thread.

## What changed

Fetch and cache model lists by provider on servers that support provider
selection, and clear cached lists when the account changes. Keep the server's
default catalog available for new threads.

Apply model choices for alternate providers to the current session only.
When a non-Cloud server's catalog cannot be scoped to a provider, show the
server's default models and limit changes to the current session as well.

## Testing

Cover provider-scoped requests, fallback to unscoped lists, session-only
picker actions, and preservation of new-thread defaults after refreshing an
alternate provider's catalog.

GitOrigin-RevId: 9e82c99613dba5de73cb2210dc61835b812cedf5
2026-11-24 06:15:04 +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
zm-oai a90526e8a7 Avoid keyring unlock prompts on headless Linux (#63544)
## Why

Reading a locked Secret Service credential can trigger a graphical unlock
prompt even when Codex is running without a display.

## What changed

When both `DISPLAY` and `WAYLAND_DISPLAY` are unset or empty, read Secret
Service credentials with the default target only if they are already
unlocked. Preserve legacy lookup for missing entries and ambiguity errors
for multiple matches.

GitOrigin-RevId: d7f347edc05dcaaa12847f5e1a4aff5ea7f69cf9
2026-11-24 05:32:26 +00:00
Charlie Marsh 96681d86f0 Deduplicate MCP text fallbacks in Code Mode output (#63540)
## Why

MCP tools can return structured data alongside a JSON text fallback for
clients that need it. Printing the whole result in Code Mode can show
the same data twice.

## What changed

Enable `features.code_mode_mcp_result_dedup` to let `text()` omit
`content` when it prints an original, successful MCP result whose only
content block is a plain text fallback that parses to the same JSON as
`structuredContent`. The JavaScript result retains both fields.

Carry the result format through gRPC so the host can distinguish MCP
results from ordinary JSON. The feature is off by default.

## Testing

Add coverage for both feature flag settings, for printing original MCP
results and copies through gRPC, and for comparing equivalent JSON.

GitOrigin-RevId: a8b0b42f5375d9744c235a0e663090dd5982e37e
2026-11-24 04:49:27 +00:00
Charlie Marsh 714bc44f0d Reap idle local code-mode hosts after five seconds (#63537)
## Why

The local code-mode host could stay running after its last session
closed. A short grace period allows nearby sessions to reuse the same
process while releasing it after sustained inactivity.

## What changed

Keep the host active while session leases or operation RPCs are in
flight. Once they drain, start a five-second idle timer. New activity
cancels retirement and starts a fresh grace period when it drains.
Process metrics only sample an existing host and leave the idle timer
untouched. Opening a session after retirement starts a fresh host.

## Testing

Add a lifecycle test that covers overlapping sessions, reuse during the
grace period, retirement despite metrics polling, and startup on the
next session.

GitOrigin-RevId: 2ebf7f7b3b3bf2d5a602b0e5b9085195eee13446
2026-11-24 04:29:16 +00:00
Kenny Yi 1985925638 Refresh the model catalog from Responses WebSocket handshakes (#63533)
## Why

The model catalog can stay stale when a server advertises a new
`x-models-etag` only in the WebSocket handshake.

## What changed

Save the handshake ETag through warmup and emit it as a
`ResponseEvent::ModelsEtag` at the start of the first generation on each
connection. Emit it once so reusing the connection cannot replay an old
ETag after response metadata advertises a newer one.

## Testing

Add regression tests for ETag delivery with and without warmup, across
connection reuse and reconnects, and for a single catalog refresh when
the handshake is the only source of the ETag.

GitOrigin-RevId: f8fcaae4aaa0f245f01435b665cecb105c261852
2026-11-24 04:08:59 +00:00
zeno-oai 7c5b5098fa Let extensions supply per-request authentication for MCP servers (#63532)
## Why

An extension that manages its own credentials needs to refresh them
without restarting an MCP session, while keeping each session tied to the
identity that opened it.

## What changed

Add `McpServerContribution::SetWithAuthProvider` for host-local Streamable
HTTP servers. Codex asks the provider for fresh headers on each request.
It reuses the connection across credential refreshes for the same owner,
rejects requests whose owner differs from the session owner, and rebuilds
the connection when the active owner changes.

Provider-backed servers reject conflicting credential configuration,
disable HTTP redirects, and bypass the shared startup tool catalog.
Rebuilding the catalog disables a provider-backed registration if its
transport changes.

## Testing

Add coverage for credential rotation, owner changes, conflicting auth
configuration, transport changes, and tool discovery for the current
owner.

GitOrigin-RevId: 409cbb2237ff306932491335461e87cf5a9ec890
2026-11-24 04:08:23 +00:00
Alex Ionescu dc9e1478fb Verify eval plugin archives with scoped signing keys (#63528)
## Why

The archive verifier counted keys returned in `eval_keys` but ignored
them during key lookup, so it could not verify archives signed with
those keys.

## What changed

Accept eval signing keys from `eval_keys` and release signing keys from
`keys`. Enforce each list's signing purpose and reject duplicate key IDs
across both lists. Reuse the existing cache scoped by endpoint and
authentication headers.

## Testing

Cover rejection of legacy eval keys in `keys`, successful verification
with a scoped eval key, and cache isolation across endpoints, accounts,
and tokens. Add an app-server test that checks local installation
precedes the remote install request for a valid eval archive and that
tampering prevents both operations.

GitOrigin-RevId: e8b6132f204c7e4e5f30d1dcb30357bac4c136ab
2026-11-24 03:56:24 +00:00
Alex Ionescu 4e5cd2f07d Test remote plugin archive verification end to end (#63527)
## Why

Verifier unit tests exercise the signing checks in isolation. Integration
tests cover how callers handle verification failures, including whether
they preserve an existing cache or write checkout files.

## What changed

Reuse the signed archive fixture with a mock backend to cover these paths:

- `plugin/install` accepts an unsigned archive without fetching signing keys.
- `plugin/reconcile` caches unsigned and valid signed releases, reuses a
  cached version without downloading it again, and preserves that version
  when a newer archive fails verification or signing keys are unavailable.
- `plugin/share/checkout` writes the checkout and local metadata after
  successful verification and leaves them absent for a tampered archive.
- The measurement reference cache rejects a tampered archive and accepts
  valid bytes on retry for the same plugin version.

Wire the tests into Bazel and give the new RPC suite the existing app-server
integration test concurrency limits in nextest.

GitOrigin-RevId: bfac72216ccee6c5a33fe08ef0081fad48ac842d
2026-11-24 03:55:44 +00:00
Adam Perry @ OpenAI 94772d9fb6 Require thread stores to provide a session model ID store (#63525)
## What changed

Make `ThreadStore::model_ids` return a `ThreadStoreResult` and require
persistent backends to preserve alias assignments across restarts for the
lifetime of the session.

The local store returns an explicit error if its state database is
uninitialized. The in-memory store returns its shared alias store, and
the core test wrappers delegate to their underlying stores.

GitOrigin-RevId: ca0d4bcf1c7dfa96f1a877b421760483b0cf3acc
2026-11-24 03:55:05 +00:00
Eric Traut 98835f5eba Preserve accepted prompts when turn setup is interrupted (#63523)
## Why

Interrupting a turn during extension setup or Git root discovery could
leave its prompt missing from resumed history. Interrupting a blocking
start hook could also cause the next turn to skip that hook.

## What changed

Run the input hooks and record accepted input before setting up skills
and plugins or resolving diff display roots. Run those setup steps
concurrently and cancel diff root discovery when the turn is cancelled.

Keep each start hook event queued until its outcome has been handled so
the next turn can retry it after forced teardown. If cancellation has
already been requested, defer events with matching synchronous hooks
while still processing events that match only asynchronous hooks.

## Testing

Add regression coverage for resuming with the interrupted prompt and
the turn-aborted marker, retrying a blocking start hook after
interruption, and handling synchronous and asynchronous hook matches on
a cancelled turn.

GitOrigin-RevId: 7ee1ca6a099f6af65aa0074897af51963b9cdca7
2026-11-24 03:53:31 +00:00
Eric Traut 9ba0ceac1a Wait for foreground terminal ownership before resuming the TUI (#63520)
## Why

After Ctrl-Z suspends Codex, `bg` continues the process while the shell
still owns the terminal. Restoring the TUI at that point can interfere
with the shell's terminal settings. A later `fg` can return the terminal
without sending another `SIGCONT`.

## What changed

Wait until the Codex process group owns the foreground before restoring
terminal modes, reading input, or redrawing. Preserve the TUI when
standard input has no controlling terminal at suspension time, and exit
if the controlling terminal disappears while waiting.

## Testing

Add PTY regression tests that check for unchanged shell terminal modes
and no TUI output during background continuation, then exercise
foreground handoff without a second `SIGCONT` and terminal detachment
on Linux.

GitOrigin-RevId: 4ee601a35c84a3e0aee984246b40bc3119c923f0
2026-11-24 03:27:15 +00:00
Eric Traut 5b249d57b2 Avoid panics when TUI recovery diagnostics fail to write (#63516)
## Why

`eprintln!` can panic if stderr is closed or otherwise unwritable,
turning an attempt to report a recovery error into another failure.

## What changed

Write cursor cleanup, terminal restoration, and worktree startup
recovery diagnostics with `writeln!` on locked stderr and ignore write
errors so recovery can proceed.

GitOrigin-RevId: 476144173a3e04e0153018614c3086371885ed65
2026-11-24 03:13:52 +00:00