Commit Graph
14531 Commits
Author SHA1 Message Date
jif a7e4b42b4a Decouple local provider setup from codex-core (#65234)
## What changed

Have the TUI and `codex exec` pass the selected provider, optional model,
and HTTP client factory to shared OSS setup. Validate the provider's
`base_url` there and connect to Ollama or LM Studio using that URL and
factory. Return a configuration error when Ollama's URL is missing.

Remove the runtime dependency on `codex-core` from the OSS utilities
and both provider crates. Enable the existing Rustls key exchange
preference and vendored OpenSSL for musl builds directly in the provider
crates.

## Testing

Add coverage for the error returned by each provider when `base_url` is
missing. Extend the Ollama client reuse test to check readiness for an
explicitly selected, already installed model.

GitOrigin-RevId: 747ed51c6fcfa2a0ffc61ba5aa8ea4d033450241
2026-12-02 11:36:47 +00:00
jif 6b36f44a93 Describe exec-only tools in mixed Code Mode (#65223)
## Why

Mixed Code Mode can call MCP tools excluded from both direct and deferred
exposure, but the `exec` description omitted their signatures and server
instructions.

## What changed

Include exec-only tool declarations, shared MCP types, and namespace
instructions in the mixed-mode `exec` description. Cap this material at
64,000 bytes and point to `ALL_TOOLS` for declarations that do not fit.
Tools exposed directly continue to carry their own declarations.

## Testing

Extend integration coverage to verify that both Code Mode variants can
call MCP tools excluded from direct and deferred exposure. The mixed-mode
case checks that an oversized namespace is omitted from the description,
its tools remain callable through `ALL_TOOLS`, and a smaller namespace
still shows signatures and server instructions.

GitOrigin-RevId: 6ad4e68d85f6b2dfdafb8ccd55755d80651c0b6c
2026-12-02 10:51:12 +00:00
Felipe Coury fc8cd2442b Refresh TUI terminal colors after returning from an external editor (#65221)
## Why

The TUI caches the terminal's default colors at startup. If the terminal
switches from dark to light while an external editor is open, the composer
can still use the old background tint when Codex regains control.

## What changed

- On supported local Kitty, Ghostty, and Rex sessions, query the default
  foreground and background through the TUI input stream after returning
  from the editor. Redraw when the reported colors change.
- Drain pending terminal reports before opening the editor, suspending, or
  exiting. If the drain times out before an editor handoff or suspension,
  keep the TUI active, preserve input, and show an error.

## Testing

Add pseudo-terminal tests for the updated composer tint, stale Enter
handling on editor handoff, and draft preservation and report draining
after editor and suspend timeouts.

GitOrigin-RevId: 7f438a7df26d602bf975695c27a9f431432d16cf
2026-12-02 10:36:43 +00:00
Adam Perry @ OpenAI 065513215b Support model-facing IDs in environment context (#65218)
## Why

When an environment detaches after a session resumes, the context update
needs to mark it unavailable under the same ID the model saw earlier.

## What changed

Render environment entries with session-scoped aliases such as `env731`
when a mapping is supplied. Save the aliases and naming mode in snapshots
so removal updates can use the recorded names and the naming mode survives
when the last environment detaches. Keep registered IDs as snapshot keys
for compatibility with existing rollouts. The session still renders
registered names.

## Testing

Add regression tests for removing the last aliased environment after resume
and refreshing the context when a saved snapshot has inconsistent IDs.

GitOrigin-RevId: 730fe3d366a9e0bc3e5eb9c6139051901c4f5f96
2026-12-02 10:20:41 +00:00
Charlie Weems 1805912776 Add a configurable maximum width for TUI conversations (#65216)
## Why

On wide terminals, the transcript and prompt box can span more columns than
users want for comfortable reading and editing.

## What changed

Set `tui.max_conversation_width` in `config.toml` to cap the transcript and
prompt box in fullscreen and inline modes, including the startup composer.

```toml
[tui]
max_conversation_width = 80
```

The setting accepts values from 20 to 65,535 terminal columns. When unset,
the conversation uses the available width. Raw inline scrollback keeps native
terminal wrapping, and wrapped links in formatted history and command previews
retain their full destinations.

## Testing

Add regression coverage for config validation, startup and live layouts,
inline history reflow after a config reload, and links that wrap across rows.

GitOrigin-RevId: 91e1856776986fee3b540247c3fbfe5f083b297f
2026-12-02 10:19:11 +00:00
Anton Panasenko 07753325c6 Add WebSocket fallback for OAuth SSH tunnels (#65212)
## Why

Networks that block HTTP/3 and HTTP/2 `CONNECT` can prevent
`codex tcp-tunnel` from establishing an SSH connection.

## What changed

In the default `auto` mode, keep the TCP attempt available when HTTP/3
`CONNECT` is blocked. If HTTP/2 `CONNECT` returns 405, 501, or a 403 with
a `Server` header starting with `Zscaler/`, retry once over an HTTP/1.1
WebSocket. Use WebSocket directly when TLS negotiates HTTP/1.1. Ordinary
authentication and authorization rejections stop setup. The attempts
share the gateway, proxy route, TLS trust, and setup deadline.

Use `--transport websocket` to force WebSocket or `--transport connect`
to use only HTTP/3 and HTTP/2 `CONNECT`. Legacy JWT tunnels use
`CONNECT`.

Preserve independent EOF in both directions. When the remote side
finishes writing, close the output pipe to OpenSSH so it sees EOF
while upload can continue.

## Testing

Add TLS-backed tests for fallback after blocked `CONNECT` responses,
half-close in both directions, terminal gateway rejection, certificate
verification before credential loading, and redirect rejection.

GitOrigin-RevId: cfbbd81a3836da8d1f12bed61bb03c9dfb3674ce
2026-12-02 09:56:45 +00:00
Eric Traut aa433cb350 Show staged changes in /diff (#65211)
## Why

`/diff` skipped staged patches, so users could miss changes that would go into their next commit.

## What changed

Compare the index with `HEAD` and the working tree with the index. Show the staged patch under **Staged** and, when both are present, put the remaining patches under **Unstaged and untracked**. Keep Git operations local and show a warning alongside the working-tree patches if the staged comparison fails.

## Testing

Cover staged files before the first commit and a staged edit that is reversed in the working tree. The tests also cover the staged comparison warning, missing blobs without a fetch, and the refreshed sidebar rendering both sections.

GitOrigin-RevId: 2cb032d7766caf313363eb4c330abb3f6a95f017
2026-12-02 09:55:35 +00:00
arnavpatidar-OAI d62166e0c8 Require a client ID for config server OAuth discovery (#65200)
## Why

Config server OAuth discovery falls back to `codex` when no client ID
is configured. That can select the wrong client for the server.

## What changed

When discovery finds OAuth metadata but no client ID is configured,
return an error that points to `gateway.auth.client_id` and
`config_server.oauth.client_id` in `requirements.toml`.

## Testing

Cover missing client IDs both with and without discovery overrides, and
verify that an explicitly configured `codex` client ID still works.

GitOrigin-RevId: 26e7f7176dcc2ea6aa71bd3b0bc9b0dbf5bf7fbb
2026-12-02 08:36:59 +00:00
alexsong-oai 986dc881be Expose gateway spend in app-server account rate limits (#65193)
## Why

Clients need to show the spend and cap for the account behind a thread's
model provider. The existing ChatGPT usage read cannot provide those
figures for a gateway account.

## What changed

- Route `account/rateLimits/read` through the provider's configured
  `usage_url` using the provider's credentials. An optional `threadId`
  selects a loaded thread's provider for the account-wide read. Omitting it
  selects the default provider.
- Return `usageUnavailable` for a thread whose provider has neither a
  usage endpoint nor first-party authentication. Surface gateway errors
  without falling back to ChatGPT usage.
- Report monthly gateway spend in `individualLimit` as exact USD decimal
  strings, with `limit: "unlimited"` for uncapped accounts. Use
  `spendControlReached` for the gateway's cap status. Spend snapshots
  identify their unit as `usd` or `credit`, with omitted units defaulting
  to `credit` for compatibility.

## Testing

Add integration coverage for thread-specific provider selection, gateway
usage taking precedence over ChatGPT without fallback, and reuse of an
existing gateway OAuth session without interactive login.

GitOrigin-RevId: e6ec9d83eecc3084fcc98e72e2c031bd3e53a2cd
2026-12-02 07:59:18 +00:00
Benjamin Carlsson a3bca8a1b5 Validate thread identity across TUI backends (#65190)
## Why

Different backends can return the same thread ID. A Cloud environment
selection must apply to the draft on the backend that opened the picker.
When the TUI reads or resumes a specific thread, an unexpected server
response can otherwise attach history or apply settings to the wrong thread.

## What changed

- Match Cloud environment selections against both the backend and the draft
  thread ID.
- Reject mismatched thread IDs in read and resume flows before hydrating
  history or applying resume permission settings. Preserve subscription
  bookkeeping so a rejected resume can still be cleaned up.

## Testing

Add regression coverage for a thread start that reuses an ID from another
backend and a mismatched resume that preserves the active conversation,
composer draft, and approval override without sending a settings update.

GitOrigin-RevId: 603efe7aa37e510dacf91b58487a94469c7f183d
2026-12-02 07:29:37 +00:00
arnavpatidar-OAI 283fca1c98 Extend OAuth configuration for managed gateways (#65188)
## Why

Setting custom OAuth scopes or a client ID for a managed gateway required
hard-coding the authorization and token URLs, even when the server
published them through discovery.

## What changed

Omit both `authorization_url` and `token_url` in `[gateway.auth]` or
`[config_server.oauth]` to discover the endpoints while configuring
`client_id`, `scopes`, `resource`, `redirect_port`, or
`device_authorization_url`. An OAuth block that relies on discovery
produces an error if metadata is unavailable.

Managed gateways can also set `gateway.requires_openai_auth` and
`gateway.auth.delivery` for inference. For example, a gateway can use
`Authorization` for the OpenAI credential and receive its OAuth token
in `X-Gateway-Authorization`. Enrollment rejects configurations that
would send both credentials in `Authorization`.

## Testing

Add coverage for discovery overrides, missing discovery metadata,
invalid OAuth settings, and gateway token delivery.

GitOrigin-RevId: 84e0c219c9eb78d4be538e9131e15ab39fd597b9
2026-12-02 07:13:07 +00:00
Benjamin Carlsson 7f7a1aa16d Add Cloud voice signaling and protect realtime diagnostics (#65186)
## Why

HTTP and WebSocket diagnostics can record sensitive realtime data, including authorization headers, SDP offers, call IDs, and audio or transcript payloads.

## What changed

Add an account-bound app-server WebSocket for Codex Cloud voice signaling. The socket initializes without subscribing to the thread, so transcript and approval events stay on the native thread attachment. Estimate server time from the WebSocket upgrade's `Date` header so admission deadlines tolerate local clock skew.

Disable HTTP request and response logging for realtime call creation. Suppress raw WebSocket upgrade and realtime frame traces, filter sensitive Tungstenite diagnostics across TUI log sinks, and keep call details and event payloads out of debug output.

## Testing

Add coverage for denied Cloud voice endpoints and missing or invalid server dates. Exercise call creation and WebSocket exchanges with trace logging enabled to check that sensitive values stay out of the captured logs.

GitOrigin-RevId: d51a3cff7f5908685e2babbf675561cb8e57ba0e
2026-12-02 06:57:24 +00:00
Abhinav d8ccc0f051 Enable Responses Lite for Amazon Bedrock Runtime profiles (#65185)
## What changed

Set `use_responses_lite` for all `global.` and `us.` model profiles in the Bedrock Runtime catalog.

## Testing

Update the catalog test to require Responses Lite for every Runtime profile. Update the request test to check that the selected model ID is preserved, the Responses Lite header is sent, and `additional_tools` declares `functions.exec` while omitting `web_search`.

GitOrigin-RevId: 7bd3d793f6365d4bffdf51528eeb3dac0d441aba
2026-12-02 06:56:44 +00:00
Abhinav 1759ac249a Inherit bundled tool capabilities on Amazon Bedrock (#65184)
## Why

The Bedrock catalog cleared the bundled tool mode, so models configured
for Code Mode did not get that default on Bedrock. Runtime inference
profiles also discarded the base model's tool search capability.

## What changed

- Inherit the bundled tool mode on standard Bedrock endpoints. Leave
  the mode unset for GPT-5.5 and GovCloud Mantle so Code Mode settings
  determine tool exposure there.
- Inherit model-level tool search support in global and US cross-region
  Runtime inference profiles.
- Keep full Responses requests so Mantle can expose cached web search
  alongside Code Mode.

## Testing

Add coverage for Runtime profile capability inheritance and GovCloud
Mantle defaults. Verify that GPT-5.6 Sol on Mantle sends both
`functions.exec` and the text-only cached web search tool.

GitOrigin-RevId: dca35b5ca08321b5a906b442dbcbdec648ffdcea
2026-12-02 06:56:08 +00:00
tejsudha-openai f20d485ea2 Send the installation ID header on authenticated Responses requests (#65183)
## What changed

Add `x-codex-installation-id` to Responses API HTTP requests and WebSocket
handshakes when an authorization header is attached and the destination is
a trusted OpenAI endpoint. Use the persisted installation ID already sent in
`client_metadata` and mark the header value as sensitive.

## Testing

Cover header delivery over WebSocket and HTTP, retention across a trusted
redirect, and omission for unauthenticated requests and third-party endpoints.

GitOrigin-RevId: 3fa83816cc91584944d6023680ba0dd05fbca138
2026-12-02 06:54:40 +00:00
Felipe Coury 0d17a47212 Support Unicode characters in TUI keybindings (#65176)
## Why

The TUI keymap required ASCII characters, so users on layouts such as Russian
could press `Ctrl+В` but could not save the corresponding `ctrl-в` shortcut.

## What changed

Accept Unicode character keys in `tui.keymap` and shortcut capture, including
modified keys and chord strokes. Apply the same case handling to configured
bindings and terminal events so `Ф` and `shift-ф` match the same keypress.

Keep Kitty's base-layout Ctrl+C and Ctrl+D fallbacks when no active binding
claims the reported key. Reserve physical Ctrl+C for list cancellation and
reject non-ASCII character bindings on actions that can grant consent,
including both strokes of a chord and expanded leader prefixes.

## Testing

Add regression tests for Unicode capture, chord matching and conflicts,
Ctrl+C and Ctrl+D fallback behavior, and consent safeguards.

GitOrigin-RevId: 8624218efcba2784f19f502770523fe00c6f1af1
2026-12-02 06:30:47 +00:00
yansenzhou-oai 21e643d32e Remove the codex cloud and codex apply commands (#65173)
## Why

Once the commands are removed, invocations such as `codex cloud exec work` could be interpreted as interactive prompts. Rejecting retired command names in the root prompt position prevents old invocations from starting a session by mistake.

## What changed

- Remove `codex cloud` and `codex apply`, which provided CLI workflows for running and browsing cloud tasks and applying their diffs locally. Delete the cloud task crates, related backend client code, and the TUI composer widget used by the cloud task interface.
- Reject `cloud`, `cloud-tasks`, `apply`, and `a` as retired root commands. To use one of those names as a prompt, pass it after `--`, as in `codex -- apply`.

## Testing

Add parser coverage for retired names used alone, with trailing arguments, and after root options, as well as for explicit prompts after `--`.

GitOrigin-RevId: 8469e936eacde3428862c6bf1b7e33084b8ead68
2026-12-02 06:11:22 +00:00
alexsong-oai badc482b81 Add monthly spend reads for custom model providers (#65168)
## What changed

Add an optional `usage_url` to model provider configuration and carry it
through remote thread configuration. Expose `read_provider_usage` to
fetch the current user's monthly USD spend, optional cap and percentage
used, and reset time.

Use the provider's own credentials for the request. Reject redirects,
disable interactive gateway login, and enforce same-origin validation
for gateway OAuth configurations that require it.

## Testing

Cover capped and uncapped spend, percentage rounding, and malformed
responses. Verify usage URL validation and remote configuration
round-tripping.

GitOrigin-RevId: ed805a756aab6e55c24751f0285bfe73b9091f07
2026-12-02 04:59:30 +00:00
Dylan Hurd 350d8a47c4 Stream provisional text from thread/sample (#65167)
## Why

Clients had to wait for the entire sample before they could display any
assistant text.

## What changed

Set `stream: true` to receive `thread/sample/textDelta` notifications
while a sample is in progress. Each notification goes to the requesting
connection and carries the original JSON-RPC `requestId` and a text
`delta`. The stream excludes commentary and reasoning.

The final RPC response still provides the complete sample and token
usage. Discard provisional text if the request fails or the final
`text` is null. Omitting `stream` or setting it to `false` returns
only the final response.

## Testing

Integration tests cover deltas arriving before completion, text supplied
only when an output item completes, and custom tool calls producing a
null sample even after provisional text has been streamed.

GitOrigin-RevId: b2ad960420ce7789722e03f9f283781030cf61fb
2026-12-02 04:56:45 +00:00
Benjamin Carlsson fad661242b Filter hosted TUI thread discovery by originator (#65164)
## Why

Hosted thread listings can mix Cloud tasks with CLI sessions and GitHub
code reviews, which can surface unrelated results in task searches.

## What changed

Request only threads from `codex_cloud` and `codex_work_cca` when
discovering threads through the hosted app server. Apply the filter to
pinned and paginated Agents overview listings, task mention search, the
resume picker, and latest-session lookup.

## Testing

Cover originator filtering across Cloud search and resume picker pages,
the hosted task mention request, and overview recovery after a missed
unarchive notification.

GitOrigin-RevId: 0f39cd9a9a35510372fdebdba403e0b0fb227130
2026-12-02 04:42:32 +00:00
Felipe Coury 7fbe0a8018 Fix TUI Ctrl+C and Ctrl+D on non-ASCII keyboard layouts (#65162)
## Why

With a Russian keyboard layout, the keys for Ctrl+C and Ctrl+D can
send Cyrillic characters, causing Codex to miss shortcuts for
interrupting a turn, canceling a prompt, or exiting.

## What changed

Use base-layout metadata from terminals that support the Kitty keyboard
protocol to recognize Ctrl+C and Ctrl+D when the active layout produces
a non-ASCII character. Respect bindings and chords in the focused
keymap and preserve the original event during raw key capture. Give
Ctrl+C cancellation priority in lists and approval prompts, including
startup hook trust review.

## Testing

Add regression coverage for interrupting a turn and exiting with
Russian-layout key events, canceling command approval, and continuing
without trusting startup hooks when Ctrl+C is pressed on the trust option.

GitOrigin-RevId: bf5efba2de295f3665c883a95fd511089eee2aba
2026-12-02 03:58:37 +00:00
Felipe Coury 258e04a50a Handle delayed terminal color replies without swallowing TUI input (#65159)
## Why

A terminal's startup color reply can arrive in pieces across the handoff
from the startup probe to the live input reader. If the reader treats
the leading Escape as a key, the rest of the reply can leak into the
composer or trigger a shortcut. A standalone Escape still needs to
dismiss reverse history search and leave subsequent typing intact.

## What changed

Pass the outstanding foreground and background color queries to
Crossterm along with replayed input and the remainder of a two-second
reply window measured from the query. Track each completed reply,
including valid replies consumed inside bracketed paste. Update the
Crossterm pin and let the input drain at screen transitions wait for
an ambiguous Escape to resolve within that window.

## Testing

Add parser and PTY regression tests for replies completed during
probing, split across the handoff, or started in the live reader.
Cover bracketed paste, idle Escape followed by typing, and the
distinction between a reply's BEL terminator and the editor shortcut.
Run the timing-sensitive PTY cases serially in a dedicated Linux
Bazel target.

GitOrigin-RevId: b7d7db6f7d57866aad18e5bc99c32773ad25f95c
2026-12-02 03:48:16 +00:00
ningyi-oai abb3701f4c Refresh workspace Git status before sending WebSocket turn frames (#65158)
## Why

A background Git scan can finish during WebSocket connection setup.
The generation frame previously used the earlier metadata snapshot,
so it could omit Git status that was already available when it was sent.

## What changed

Pick up same-turn Git results before building the generation frame,
without waiting for the scan. Handshake headers and prewarm frames use
the initial snapshot. Keep the earlier workspace snapshot if the refresh
would exceed the metadata size limit where the earlier one fit, or
displace a Git remote URL that would otherwise fit.

## Testing

Add regression coverage for Git status arriving during the handshake,
which request kinds can refresh, and remote URL retention at the
metadata size boundary.

GitOrigin-RevId: 942eeb8d5ee16756803ce3a5021d186a47fb9f0c
2026-12-02 03:47:42 +00:00
arnavpatidar-OAI ed3678a2a9 Reuse discovered OAuth for managed gateway inference (#65157)
## Why

Gateway enrollment required an explicit `[gateway.auth]` block even when
Codex could discover the OAuth settings while loading managed policy.
Frozen policy snapshots also dropped the discovered settings before
Codex configured the inference provider.

## What changed

Make `[gateway.auth]` optional. When it is omitted, use the OAuth
settings retained in the policy snapshot to configure the inference
provider, provided the snapshot matches the configured gateway enrollment.

## Testing

Add a regression test that compares the provider built from a frozen
snapshot with the provider built from explicit OAuth settings. The test
also verifies that changing the gateway root leaves the new provider
without the previous gateway's OAuth settings and fails the managed
policy check.

GitOrigin-RevId: a8734b3c98f50c9c9ef1917eb8c1d12548cbc271
2026-12-02 03:47:01 +00:00
Felipe Coury 9f33c83cb6 Reuse the transcript overlay's interaction check for its browsing footer (#65156)
## What changed

Use `has_active_interaction()` to decide whether to show the browsing
footer, removing the duplicate checks for pending selection mode and
active viewport interactions.

GitOrigin-RevId: 9264a427feaef94bc298a18b79d440de721aadb4
2026-12-02 03:46:24 +00:00
Benjamin Carlsson ed3ccd4c21 Scope TUI reconnect recovery to the affected backend (#65154)
## Why

When the active backend reconnects, the TUI can discard pending work on
other connected backends. Completions queued before the reconnect can
also arrive after the replacement connection is active.

## What changed

- Preserve pending requests and thread state for other connected backends.
  Track asynchronous completions by connection so retired connections
  cannot update the TUI.
- Apply request resolution from background backends to pending prompts
  and the agents overview. Require users to end a voice call before
  switching sessions across backends.
- Close the verification prompt when verification finishes and suppress
  queued proofs when the user cancels the prompt.

## Testing

Add regression coverage for preserving another backend's pending work
during reconnect, dropping stale completions, resolving background
requests, and cancelling verification after a proof has been queued.

GitOrigin-RevId: fc932b0d13fd1cf04404bd5ccfce71ff776e259f
2026-12-02 03:33:04 +00:00
Charlie Marsh 028590df7d Preserve deferred tool declarations in prediction forks (#65146)
## Why

A prediction fork that disables MCP inherits the parent's tool declarations,
but recomputing the deferred tool list can append a conflicting declaration
to the request.

## What changed

Skip the deferred tool list update when the fork preserves the parent's tool
declarations. The fork still reports MCP tool unavailability separately.

## Testing

Extend `prediction_fork_keeps_inherited_tools` to cover both inline and
deferred MCP tools and assert that the fork carries exactly the parent's
`<tools>` messages.

GitOrigin-RevId: 04b4a542e0d587a20706935e8b028b7f1fdb9209
2026-12-02 02:40:50 +00:00
Alvin 3fef28219c Surface TLS failures during workload identity sign-in (#65145)
## Why

The generic token exchange unavailable error gives users no indication that
they should check their trusted CA certificates when a TLS failure occurs.

## What changed

Report TLS failures during token exchange with guidance to check the trusted
CA certificates on the host or container. Keep these failures transient and
continue reporting other request failures as exchange unavailable.

## Testing

Add a regression test that checks the certificate guidance for an invalid
custom CA file and verifies that both TLS failures and timeouts remain
transient, with timeouts still reported as exchange unavailable.

GitOrigin-RevId: b4eb9eb9eb86d4703b9b96b3e339d2764bc5644f
2026-12-02 02:39:37 +00:00
Alvin b6743d7ea8 Report workload identity authentication in codex doctor (#65142)
## Why

`codex doctor` could report missing credentials when workload identity
was selected and no local credentials were stored.

## What changed

Use the auth manager's workload identity selection to report authentication
as successful and show how to check it with `codex login status`.

## Testing

Add a regression test that checks the terminal and redacted JSON reports
for workload identity with no stored credentials.

GitOrigin-RevId: cf385cf2cb71cc8aed95427ef83524bab4582702
2026-12-02 02:14:46 +00:00
Adam Perry @ OpenAI e1e967cd46 Add session-scoped aliases for registered environment IDs (#65140)
## What changed

Pair each registered executor ID with a model-facing alias assigned on
first use by the session's model ID store. Turn environment snapshots
can resolve these pairs in selection order, including for executors
that are still starting or have failed. Environment context snapshots
and rendering continue to use registered IDs.

## Testing

Cover alias assignment in selection order, stability across readiness
updates, and reuse of the same ID pair after reopening the SQLite store.

GitOrigin-RevId: e5fa6e5549ebb12fcf651e5bf7413402fb4db1b3
2026-12-02 01:59:55 +00:00
Adam Perry @ OpenAI 55ea9a4620 Standardize response request IDs across Codex clients (#65135)
## Why

Different response paths recognize different request ID headers, so
diagnostics can lose the ID needed to correlate a failed request. For
example, an Azure response may carry only `x-ms-request-id`.

## What changed

Use `CodexHeaderMap` to share response header parsing across API clients,
OAuth errors, and response debug context. When a caller needs one
request ID, fall back to the next supported header if the preferred
value is missing, empty, or unreadable.

Preserve recognized request ID headers on Responses WebSocket
handshakes. Use a shared summary for remote control errors and tracing,
omitting sensitive, empty, unreadable, and unrelated values.

## Testing

Cover fallback from an empty or unreadable primary ID, Azure-only debug
context, filtering in diagnostic summaries, and preservation of request
IDs in WebSocket handshakes and remote control pairing errors.

GitOrigin-RevId: f728a4a867f4705b784916b331f413e560f8626b
2026-12-02 01:44:46 +00:00
Benjamin Carlsson cf24cd5a93 Centralize CLI config flag expansion (#65134)
## What changed

Expand root feature toggles and auto-review flags in the config
argument module before dispatch. Keep auto-review expansion for
`resume` in its command-specific path.

## Testing

Extend the `mcp add` argument test to check that a root `--disable`
follows the collected `-c` overrides and that the command-scoped
override still takes precedence. The test also checks that `-c` after
`--` is forwarded to the MCP server command.

GitOrigin-RevId: 6a7b2a8dddb9043dbfde6b8a20cd98cef5b39ab0
2026-12-02 01:42:03 +00:00
Benjamin Carlsson b444ea738c List account skills and Cloud-compatible plugin installations (#65130)
## What changed

- List uploaded skills for the signed-in ChatGPT account through MCP
  `resources/list`. Return the URI, name, and optional description for
  each valid account skill, deduplicated by URI across pages.
- List enabled, available plugin installations across account scopes and
  group them by marketplace. Exclude plugins with a disabled reason or
  an explicit local executor requirement.

Both lookups use metadata only. Skill contents and plugin bundles stay
on the server.

## Testing

Mock service tests cover pagination, skill URI filtering and
deduplication, and plugin eligibility. The plugin test also checks that
requests omit download URLs and skip display assets.

GitOrigin-RevId: 6b3330232db3f28a6e81510b8fd573159eaf66a9
2026-12-02 01:22:29 +00:00
Dylan Hurd b1387dd6cc Preserve active input context order during compaction (#65128)
## Why

Restoring active context after compaction selects retained messages can
move it across user turns. For example, instructions for a context-only
heartbeat can end up before an earlier, already answered user question.

## What changed

Retain active context in source order when building compacted history
and resetting the context window. Use the full items from live history
so active tool outputs and messages survive prompt shortening.

## Testing

Add regression coverage for a heartbeat that compacts mid-turn, and
verify ordering around repeated user message IDs and pending agent
messages in local and remote compaction.

GitOrigin-RevId: b670f3c4e87331a61986b4c163f892e43bd0261d
2026-12-02 01:08:37 +00:00
Ian MacLeod 0cc4569555 Avoid stale GitHub release asset redirects (#65127)
## Why

GitHub release asset URLs can return cached redirects whose signatures
have expired, causing dependency downloads to fail during CI setup and
packaging.

## What changed

Add a fresh `cache_bust` query parameter to rusty-v8 artifact downloads in
CI and packaging, the Windows voice setup's `pkgconf` MSI download, and
DotSlash archive downloads that use plain GitHub release asset URLs.

GitOrigin-RevId: 560bfdb5788032f6450920b986cd30363eda996e
2026-12-02 01:08:01 +00:00
Ian MacLeod 4487f68480 Show task-opening progress inline in the Codex TUI (#65126)
## Why

The task list already labels a visible task `Opening…`, but the spinner
appears in the footer, away from the task it describes.

## What changed

Place the spinner next to `Opening…` in the task's status column or
compact detail row, preserving the selection highlight. Keep the
`Opening task…` footer as a fallback when the inline status has no room
or the task is outside the visible list.

## Testing

Cover inline rendering, reverse-video selection styling, and the footer
fallback for short layouts and history results that disappear when
opening clears the search.

GitOrigin-RevId: 6a66b368fefb4c43aa0b27ffe9b24bb07d1839d3
2026-12-02 01:06:48 +00:00
aakash-oai 6adca62116 Measure model catalog lookups and HTTP GET attempts (#65123)
## Why

A model catalog lookup can use a cached snapshot or bundled fallback without sending a request. A lookup that reaches the endpoint can send multiple requests through retries. Measuring both lets readers of the metrics distinguish cache behavior from endpoint traffic.

## What changed

- Record one `codex.remote_models.lookup.outcome` observation per completed catalog lookup with its purpose, result, and the source of the snapshot actually selected. Record observations without taking the exporter lock on the lookup path.
- Count dispatched requests in `codex.remote_models.http_get_attempt`, including retries. Tag them by purpose and whether they match the configured endpoint when that context is available. Keep endpoint URLs out of metric labels.
- Mark background refreshes as maintenance and apply metrics enablement changes to cached global handles when the process reloads telemetry settings.

## Testing

Add coverage for cache and fallback attribution, retry counts, auth failures before dispatch, and metrics collection across exporter disablement and replacement.

GitOrigin-RevId: b970207a69432030b4511c7e84acb6696b6f824b
2026-12-02 00:44:37 +00:00
Won Park cd9a09e7f6 Record why MCP runtimes refresh (#65120)
## Why

Several invalidations can be handled by a single MCP runtime refresh. Recording the reasons together shows which changes prompted that refresh.

## What changed

When `mcp_refresh_reason_telemetry` is enabled, successful MCP runtime refreshes report a `codex_mcp_runtime_refresh_event` with distinct reason labels, a timestamp, and thread and session attribution. The flag is off by default.

Multiple installed-plugin metadata changes collapse to one `installed_plugin_metadata` label. The event omits configuration contents and plugin change IDs. Analytics buffers refresh events that arrive before their thread context is available.

## Testing

Add an integration test that queues multiple invalidations and verifies that one event with deduplicated reasons and the correct thread and session IDs is sent after thread start is recorded.

GitOrigin-RevId: 639326d0cb993b8b3a0fcbf0618049cb2ff065fd
2026-12-02 00:41:52 +00:00
Robbie Ostrow 607f7efdfb Require a local runtime for MCP HTTP headers helpers (#65119)
## Why

MCP servers can use the host's HTTP client without a local runtime. That
fallback also let locally configured `http_headers_helper` commands run
on the host when only remote executors were attached.

## What changed

Reject locally configured HTTP headers helpers unless the host has a
local runtime. A host that retains its startup runtime can still run
helpers when it exposes only remote executors. HTTP servers without a
headers helper can still use the host's HTTP client.

## Testing

Cover helper rejection with no executors and with both laptop and cloud
executors attached. Verify that the helper command leaves no marker
file, local stdio startup still fails, and plain HTTP still works. Cover
helper client resolution when a local runtime is available, including
when only remote executors are exposed.

GitOrigin-RevId: 0aff6cc1f9f6122aace54ed4c19ef93e26817c64
2026-12-02 00:28:46 +00:00
Will Emmanuel 7131f15461 Include the host subagent roster in initial environment context (#65118)
## Why

When a turn has no execution environments or other environment context
to report, Codex can skip the environment update before reading the host
roster. The model then misses any active subagents in that roster.

## What changed

Keep the initial environment update until Codex has had a chance to
attach the host roster. Emit `<environment_context>` when the roster is
its only content, and drop the update if it is still empty.

## Testing

Add integration coverage for roster-only context and empty context in
both the default and per-environment formats.

GitOrigin-RevId: 6ceffd9aa13fefa31387c4d598a81a4281554c1c
2026-12-02 00:28:07 +00:00
Shuo c4fcff5e97 Preserve primary authentication for OAuth gateways (#65117)
## Why

When runtime authentication is enabled, a gateway endpoint outside the
supported OpenAI runtime endpoints can fail runtime URL validation before
Codex can use the configured gateway credentials.

## What changed

For valid HTTPS gateway destinations on port 443 with a usable gateway
OAuth configuration, preserve the primary API key or ChatGPT token
alongside the gateway token and skip runtime authentication. Evaluate
inference and model catalog URLs independently so supported OpenAI
endpoints still use runtime authentication and invalid endpoints still fail
validation.

## Testing

Add regression coverage for model discovery and Responses requests in
both runtime authentication modes. The tests check that gateway requests
carry both credentials, omit the runtime assertion, and skip runtime
registration. They also cover mixed inference and catalog destinations
and rejection of invalid URLs.

GitOrigin-RevId: d36d12412495c50c6643d615be8a7d72046c4d1c
2026-12-02 00:26:16 +00:00
hesham-oai 5d32c09b5b Add a multiplexed stdio transport to the exec server (#65115)
## Why

Plain stdio serves one JSON-RPC connection and shuts down when it closes,
so clients cannot run concurrent sessions or reconnect to resume a
detached session over the same stdin/stdout pair.

## What changed

Add `--listen stdio-mux` to serve multiple independent newline-delimited
JSON-RPC connections over one HTTP/2 connection on stdin and stdout.
Each `CONNECT` stream to `rpc.local` carries one JSON-RPC connection.
A client can half-close the request to detach, wait for response EOF,
then open a fresh stream and initialize with `resumeSessionId` before
the session expires.

## Testing

Add tests for concurrent sessions, immediate resume after response EOF,
session expiry, and recovery after a stream reset while another stream
stays usable. Cover shutdown with a full input queue and verify that a
failed stdio write unblocks response senders.

GitOrigin-RevId: cdb9638f8b69671a50f44e3eca4dd9059f5bdcd1
2026-12-02 00:14:30 +00:00
Krish Chainani 33811295ff Treat Noise relay handshake failures as retryable disconnects (#65114)
## Why

A malformed reply during the Noise relay handshake could surface as a
protocol error and stop connection preparation from retrying.

## What changed

Report handshake failures as disconnects and preserve the reason when the
connection fails before it is ready. Keep authenticated registry rejections
as a distinct error that stops retries.

## Testing

Update the transport test to assert the disconnect reason for both an
unexpected WebSocket text frame and a relay stream reset.

GitOrigin-RevId: 2ad2dbcce5518dcfd35141dd234c87c0d86aa1ae
2026-12-02 00:11:21 +00:00
Owen Lin 88eff82bd7 Wait for reader cancellation in the RPC delay test (#65113)
## Why

The reader task can take more than ten scheduler yields to drop the
reader after a write error, causing the test to fail even when
cancellation works.

## What changed

Have the test reader signal its drop with Tokio's `Notify` and give
`write_error_cancels_reader` up to five seconds to receive that signal
after asserting the broken-pipe error.

GitOrigin-RevId: fdb1fc8d9aaccaa72f85b51e11184df483420f80
2026-12-02 00:00:35 +00:00
Benjamin Carlsson 98e240bbf7 Show modifier layers and action labels in the TUI shortcut guide (#65112)
## Why

The keyboard view only highlighted unmodified shortcuts, so users had to
switch to the list to find modified bindings or see what a highlighted
key did.

## What changed

- Let users cycle through modifier combinations from the active bindings
  with a free key shown in the guide header. Leave existing bindings
  available.
- Label keys with their actions and show the full binding for two-key
  chords beside the first key.
- Try a compact keyboard when the roomy layout does not fit, then fall
  back to the shortcut list while keeping modifier navigation available.

## Testing

Add snapshots and assertions for Ctrl and Shift layers, remapped chords,
layout fallback, and keyboard help above the prompt in an 80×24 terminal.

GitOrigin-RevId: 0b37579c145fa5176ab83de392d9eb4905d06b81
2026-12-01 23:59:56 +00:00
Owen Lin a1deffb5b2 Pass the last inherited turn ID when creating a fork (#65111)
## Why

A thread store that resolves the last inherited turn during fork preparation
can reuse that ID when creating the child instead of resolving it again.

## What changed

Forward the optional `last_inherited_turn_id` from `PreparedFork` to
`CreateThreadParams` alongside the inherited history position. Omit the
field from serialized creation parameters when no ID is available.

## Testing

Add a regression test that checks the in-memory thread store receives the
turn ID supplied by the prepared fork when it creates the child.

GitOrigin-RevId: 709c8cc4a744b2f893af6233e825026a27732873
2026-12-01 23:56:56 +00:00
aakash-oai 1640c74f1f Count remote model catalog ETag hint outcomes (#65110)
## What changed

Record one increment of `codex.remote_models.etag_hint` per comparison
when metrics are enabled. Set `result` to `match` or `mismatch` when the
current endpoint identity has a cached ETag, and to `no_baseline` when
there is no comparable cached ETag. Count the outcome even if the
subsequent refresh fails or authentication prevents a fetch.

## Testing

Add an in-memory metrics test that checks the exact counts and verifies
that a matching hint skips the fetch and an equal ETag from another
endpoint identity counts as `no_baseline`.

GitOrigin-RevId: 9570f415d43cf19bac8f4d82960466c86e883f73
2026-12-01 23:40:13 +00:00
Dylan Hurd b6065c6128 Stabilize the TUI worktree test during fork startup (#65109)
## Why

The fork can acknowledge its working directory before startup finishes.
MCP startup can also make the composer busy between the test seeing
`Ready` and pressing Enter, causing `/cd` to be rejected.

## What changed

Wait for the fork's own `Ready` status and a complete terminal update
showing the pasted `/cd` command before submitting it. Retry only when
a new busy rejection appears and the fork is ready again. Require a
complete terminal update showing the directory change before continuing.

GitOrigin-RevId: eceb98b3376977dcc60963e3733bf45559b88ae0
2026-12-01 23:38:53 +00:00
Benjamin Carlsson 7b680b178a Keep TUI background work tied to its originating app server (#65108)
## Why

App servers can reuse the same request IDs. Tracking dynamic tool calls by
request ID alone lets one server's cleanup affect another server's call.
Background title and recap events also need to reach their originating server
when the TUI is displaying a different session.

## What changed

- Track dynamic tool calls by backend and request ID, and match completions
  to the specific call. Send replies through the original reply handle in the
  background and give pending writes time to finish on shutdown.
- Route background task registrations and title and recap events by backend.
  Check ownership before registering temporary threads or forwarding their
  notifications, and use the original connection for temporary-thread cleanup.

## Testing

Regression coverage checks that closing a side thread preserves another
backend's tool call with the same request ID, that a disconnected backend
cannot register a task thread, and that a title helper cannot replace a
temporary thread owned by another backend.

GitOrigin-RevId: 0878efba94f317c814ee131403f0c6e793dfc2c0
2026-12-01 23:22:59 +00:00
Felipe Coury fbb04fca5f Share composer copy handling across keyboard and mouse input (#65107)
## What changed

- Route keyboard and mouse copies of composer selections through the same
  plain-text copy helper.
- Check composer visibility separately when completing clipboard work
  and canceling primary selection. Use the overlay input check when
  deciding whether to end a composer drag.
- Convert external transcript links to view actions through the shared
  `ReaderLink` conversion.

GitOrigin-RevId: 7285acfe6d8911da806adbba7da8b79393389b08
2026-12-01 23:13:10 +00:00