Commit Graph
14554 Commits
Author SHA1 Message Date
felixxia-oai 5592958044 Preserve attached Guardian reviewer sessions across retries (#65328)
## Why

A transient failure during an approval review could discard the attached
reviewer session and lose context the reviewer had already gathered.

## What changed

Use the Guardian retry policy when finishing an attached review. Honor
the review's session disposition for retryable failures and force
discard for non-retryable errors.

## Testing

Extend the prewarmed root reviewer test to simulate a server overload
after the reviewer subscribes to a channel. Verify that the retry
reconnects with the same reviewer thread ID and carries forward the
subscription result.

GitOrigin-RevId: 5a538e872f71714fee9bbd97ed775969a6893154
2026-12-02 20:19:42 +00:00
rhan-oai ea5f6b303c Recognize host-selected MCP handoffs in Guardian context (#65325)
## Why

Guardian uses native collaboration calls to identify which root-thread
context is relevant to a subagent. When an MCP server supplies those tools,
Guardian needs the server's registration to distinguish a handoff from an
unrelated call with the same name.

## What changed

Let the host opt in to handoff tracking for one local MCP plugin or extension
registration. Match the server name, source, and transport against the tool
registration used for routing. Persist the recipient of a matching direct
`spawn_agent`, `send_message`, or `followup_task` proposal so Guardian can
apply the handoff boundary when selecting context for that subagent.

Record a classification without a recipient for lookalike calls when needed
to prevent fallback to native name matching.

## Testing

Cover context filtering for the selected extension, calls without host
opt-in, and a configured MCP server using the native collaboration namespace.

GitOrigin-RevId: 40471f3cdfde88832c27c3a466e36723e42515d2
2026-12-02 20:09:58 +00:00
felixxia-oai 587c151188 Keep cumulative summaries in Guardian evidence channels (#65324)
## What changed

Ask the Guardian housekeeper to update each channel description from its prior
summary and newly routed evidence in source order. The summary captures relevant
activity, user intent, authorized actions and targets, conditions, exclusions, and
later corrections. The housekeeper attributes authorization to original user
instructions and distinguishes it from assistant proposals and tool reports.
Approval decisions remain with the reviewer.

Apply the same summary guidance with default and custom routing instructions.
Request updates only for new, missing, or changed descriptions, with each summary
limited by the prompt to 250 UTF-8 bytes and 40 words.

## Testing

Update the housekeeping fixture to carry forward staging approval alongside a
new restriction on publishing the release. Verify that the stored description
persists when a later routing response omits it.

GitOrigin-RevId: 72607fb370c18a9e2c570158bef70caa25be338c
2026-12-02 20:09:20 +00:00
felixxia-oai 0d36af2039 Guide Guardian to reuse topic channel names (#65323)
## What changed

Tell the Guardian v3 housekeeper to reuse the exact channel name when a
topic continues. For new channels, ask for a descriptive name that
identifies the topic and its project or target within 128 UTF-8 bytes.
Reflect the naming guidance in the routing schema.

## Testing

Update the recorded review request snapshot and adjust the housekeeping
test fixture so two of the three later evidence items still fit in the
model window with the longer prompt.

GitOrigin-RevId: 5beb4fc6c0ad496c22f3411ed3a8479e6bbbea6e
2026-12-02 20:08:40 +00:00
Ruslan Nigmatullin 923ced7a31 Expose pagination cursors in history and notes tool schemas (#65319)
## What changed

Add an optional `cursor` to requests that list history windows, history
items, or note files, and to requests that search history or note
contents. The schemas tell callers to repeat the same request with
`next_cursor` until the response omits it. In note search, a nested
`next_cursor` resumes matches within that file.

Update the bundled tool contract and model request snapshots to reflect
the schema changes.

GitOrigin-RevId: 0d5a76e0c8406320e320ed3347d656ff2b1b9aa4
2026-12-02 19:53:25 +00:00
jif 1bca83f820 Reuse Guardian v2 async history after large fresh reviews (#65318)
## Why

When a fresh async review already reaches the soft reset limit, adding
evidence can trigger another rebuild that replays the same large transcript
on every check.

## What changed

If a fresh review reports usage at or above
`async_classifier_conversation_token_limit`, allow projected input to grow
up to 20,000 tokens beyond that first report. Use the latest reported usage
to estimate each continuation while keeping the ceiling anchored to the
fresh review. The model's input limit still applies.

For this extra allowance, rebuild when reported usage is missing or the
next request would truncate elastic context or omit whole transcript
entries from the fixed window. A fresh review with elastic truncation
cannot start the allowance.

## Testing

Extend coverage for reuse across multiple reviews, resets at the growth
ceiling and model input limit, missing usage, and transcript evidence
recovered by rebuilding.

GitOrigin-RevId: 4c5c69a898b83e051241b06c324773a0b9e46ede
2026-12-02 19:40:40 +00:00
Alvin 0f5e7be1a7 Show workload identity account details in login status (#65317)
## Why

`codex login status` confirms that workload identity is active, but its
generic status line leaves users unable to tell which identity Codex is using.

## What changed

- For ChatGPT, show the principal ID, workspace ID, and account email when
  available.
- For API access, show the service account ID and project ID.

Read these details from cached authentication metadata and keep the generic
status line when account details are unavailable.

## Testing

Add output snapshots for ChatGPT identities with and without an email and
for API service accounts.

GitOrigin-RevId: a0fb2aafff4a52a2e890e324e939b132c59f5831
2026-12-02 19:25:53 +00:00
thomas f85a6e05eb Support explicitly declared hooks in Agent Plugins (#65316)
## Why

Codex skipped hooks in the Agent Plugin format even when the root
`plugin.json` explicitly declared them.

## What changed

- Discover hooks through the root manifest's `extensions.com.openai.hooks`
  declaration. File declarations must point to regular files inside the
  bundle without traversing symlinks.
- Apply the existing hook approval flow and give Agent Plugin hooks the same
  isolated `PLUGIN_DATA` directory as the plugin's stdio MCP servers.
- Include declared hooks in plugin details and capability detection without
  requiring a writable data directory. For remote catalog entries,
  `plugin/read` gets hook summaries from the matching installed bundle.

## Testing

Cover invalid hook paths and runtime data directory failures, verify that an
approved `PreToolUse` hook writes to isolated plugin data, and check remote
plugin reads with matching, different, and absent local bundles.

GitOrigin-RevId: 86311780865f7c598db22d873e88be2699750b75
2026-12-02 19:09:13 +00:00
Ben Romano ce1c27aa01 Link accepted steer requests to active turn spans (#65315)
## Why

A steer request can arrive in a separate trace from the turn it updates. Recording the turn ID on the input span leaves the relationship implicit in OpenTelemetry.

## What changed

Capture the context of `session_task.turn` when the task starts. When the active turn accepts steering input, add an OpenTelemetry link from the request's `op.dispatch.turn_input` span to the task span. The link is visible even when trace-level input spans are disabled.

## Testing

Extend the turn tracing integration test to check that both steering entry points link to the active task and that initial submissions and stale steer requests emit no link.

GitOrigin-RevId: 1daecd06d8db8a80c8112dff5c65a58142bda4d6
2026-12-02 18:54:34 +00:00
jif 55c21d760b Record input truncation in Guardian review reports (#65313)
## Why

Failed-review reports can include the reviewed thread's history, but they
don't show how much evidence the reviewer lost to input limits. That
makes it harder to tell whether missing context contributed to a denial.

## What changed

Add a `truncated` field to opt-in failed-review reports. It reports
bytes removed from the initial review input by evidence section,
distinguishing per-item caps from cuts made to fit the overall budget.
Carry those totals with the selected response through reconsideration,
including when the original denial is restored.

## Testing

Check that a denied review's report includes transcript bytes removed
by a per-item cap. Cover rendered JSON byte counts, deduplicated
instructions, and eviction of an already-capped tool result.

GitOrigin-RevId: 817ca54ca27969e52cac50f7ff93816c773fcc15
2026-12-02 18:40:51 +00:00
Steve Coffey a5d572b651 Record Guardian token usage on the requesting turn (#65312)
## Why

The requesting thread's rollout lacks per-response token usage for
Guardian work, including requests that consume tokens without producing
a usable result.

## What changed

Persist reported token usage from Guardian reviews, background review
compaction, and classifier requests in the requesting thread's rollout.
Each record identifies the requesting turn, response, and model, and
marks incomplete responses that report usage. These records stay
separate from the thread's cumulative token totals and are excluded from
forked history.

## Testing

Cover review attribution and unchanged parent token totals, compaction
that reports usage without a usable summary, and thread shutdown waiting
for an interrupted classifier's usage write.

GitOrigin-RevId: da5d3711cdb7c7aeab829d3537ef59b724c57171
2026-12-02 18:40:08 +00:00
malsamiri-oai 0e9c6552da Limit Computer Use cleanup notifications to turn metadata (#65311)
## Why

Computer Use helpers only need the thread and turn IDs to clean up
after a turn. The legacy `notify` payload also includes user messages
and the assistant's last message.

## What changed

Send recognized macOS and Windows Computer Use helpers a
`turn-ended` payload containing only the event type, `thread-id`,
and `turn-id`. Codex unwraps saved `--previous-notify` chains and
launches the user's notifier directly with its original arguments
and the full legacy payload, without waiting for cleanup to finish.

## Testing

Add tests for helper recognition, payload contents, and malformed
notifier chains. A Unix process test checks that the saved notifier
receives its payload while cleanup is still running.

GitOrigin-RevId: 1d5cea10b1c92e1828a23bb9eaeb8c008baa86c5
2026-12-02 18:38:45 +00:00
jif d67d903b61 Rebuild Guardian classifier history when the transcript profile changes (#65299)
## Why

A classifier catalog refresh can change which transcript entries count
toward the cursor while the parent model and conversation stay the same.
Reusing the old cursor can skip evidence that the new profile includes.

## What changed

Include the transcript's `ContextProfile` in the classifier conversation
reuse key so a profile change rebuilds history with the current profile.

## Testing

Add a regression test that enables `tool_outputs` after scoring with only
`tool_calls` and verifies that the next request includes both calls and
the newly included output in transcript order.

GitOrigin-RevId: 855f89b476c3c826b1e363e99d2f9605f8181a55
2026-12-02 16:59:20 +00:00
Tom Leach (@toml) 4e2490ec82 Introduce a request type for enqueueing thread messages (#65297)
## What changed

Use `EnqueueRequest` to pass the thread ID, turn input, and optional
Responses API client metadata through a single `enqueue_item` method.
Migrate the app server and queue service tests to this method, and
deprecate `enqueue` and `enqueue_with_metadata` while keeping them as
forwarding wrappers.

GitOrigin-RevId: 9a4e96ca5e7f30b0b6ac7f33ee6c10420df12dba
2026-12-02 16:46:59 +00:00
ioanbudea-OAI 01192c6e19 Enforce session ownership in V1 multi-agent tools (#65287)
## Why

V1 tools could use a thread ID to reach agents in another session. A
thread ID can also resolve to a different runtime after a thread is
unloaded and reloaded.

## What changed

- Check session ownership before sending input, interrupting, waiting on,
  closing, or resuming a V1 agent. Keep live operations bound to the
  runtime that passed the check.
- Check ownership in saved rollouts before resuming agents and their
  descendants. Follow the recorded parent chain for legacy rollouts that
  lack a session ID. Release the agent slot when closing a known ephemeral
  agent that has already been unloaded.
- Preserve failed `wait` calls in thread history and show the failure in
  the TUI without listing rejected targets as completed agents.

## Testing

Add regression coverage for cross-session input, close, and resume
requests, slot reuse after closing an unloaded ephemeral agent, legacy
session recovery, and failed wait history and display.

GitOrigin-RevId: 4712a53315d24d5658d746ed277738e00a4e2dac
2026-12-02 16:21:14 +00:00
jif 1396b2e0e7 Correlate Guardian failure reports with review and response IDs (#65276)
## Why

A turn can contain multiple Guardian reviews, and denial reconsideration
can produce multiple responses for one review. Thread and turn IDs alone
cannot identify which review and provider response produced the recorded
decision.

## What changed

Add `review_id`, `reviewer_request_id`, and `reviewer_response_id` to opt-in
Guardian failure reports when available. Keep the provider IDs with the
selected decision, including the original denial when reconsideration
fails and falls back to it.

## Testing

Extend tests to check the recorded IDs for initial and
reconsidered denials and verify that an invalid retry preserves the
original denial's IDs.

GitOrigin-RevId: 4bd906bfb9a80808cb3c2a8ac71c5354d4caad1f
2026-12-02 15:17:02 +00:00
jif 1df7f6d42b Freeze the clock in permission and skill history tests (#65262)
## Why

When a test spans midnight, the environment date can change between turns
and alter the request history.

## What changed

Use a shared fixed clock for the catalog permission-path model-switch
and repository skill grant history tests. The clock keeps the environment
date stable with time reminders disabled.

GitOrigin-RevId: 7c3ad23547cd9126c6115aeeea6806b32c04dd69
2026-12-02 14:09:46 +00:00
Ben Romano ba4148faaf Continue MCP callback traces into Guardian reviews (#65254)
## Why

When a Node REPL-backed MCP tool requests approval through an elicitation
callback, the trace loses the parent-child relationship between the callback
and the Guardian review.

## What changed

Parent the Guardian review span to the callback span when its
`traceparent` is well formed and its trace ID matches the active tool
invocation. Preserve the invocation's sampling flags and `tracestate`,
and strip both trace fields from the elicitation metadata before it
reaches approval handling or user prompts.

## Testing

Cover callback span parenting and trace propagation to Guardian inference,
including rejection of unrelated trace IDs and malformed headers. Verify
that form and URL prompts retain other metadata while dropping trace fields.

GitOrigin-RevId: 942b61a0da81b5d549c9f4813b28101bba622a26
2026-12-02 13:21:09 +00:00
jif 76d282ae2e Use reported token usage for Guardian v2 soft resets (#65244)
## Why

Conservative image token estimates can trigger a soft reset even when the
completed scoring conversation leaves room for new evidence.

## What changed

Store the reported context token count with each completed scoring conversation.
For the next soft reset decision, add the estimated tokens for new evidence to
that count. Fall back to estimating the retained history when the latest
completion has no usable usage. The hard input limit and metrics still use the
conservative full-request estimate.

## Testing

Cover history reuse after a low usage report, rebuilding after a higher report,
and fallback when usage is zero or missing. Check that a low reported count
cannot bypass the hard input limit.

GitOrigin-RevId: 42557d5b7272e651046e7c06226f757b59b9fa67
2026-12-02 12:22:39 +00:00
Dmitriy Kovalenko ac2a31a717 Prefetch Git attribution policy when a thread starts (#65241)
## Why

The first turn could spend up to five seconds waiting for the workspace
attribution setting. Starting the request during thread initialization
lets it overlap with MCP startup.

## What changed

Fetch the policy in the background for threads using Codex backend
authentication. Reuse the pending lookup on the first turn when it
matches the thread's current authentication generation, and cancel any
unclaimed lookup on thread shutdown.

Cache a disabled policy after a timeout until its retry deadline. Once
the deadline passes, the next lookup can fetch the setting again.

## Testing

The app-server test waits for the settings request before starting the
first turn. The extension test covers retry deadlines across turns for
both prefetched and cached policies.

GitOrigin-RevId: 6f66f6299b56affc6c95558c94381e476a5cc1d8
2026-12-02 11:46:51 +00:00
Felipe Coury 3a3b34c74a Refresh TUI colors on terminal theme changes and focus regain (#65238)
## Why

A terminal theme change could leave the composer using stale colors until
Codex returned from an external editor.

## What changed

On supported Unix terminals, enable live color reporting after startup
prompts have cleared and only when the terminal reports that the mode is
off. Refresh the default foreground and background on theme notifications
and when the terminal regains focus. Read color replies through the same
event stream as keyboard input and redraw when the colors change.

Release the subscription before handing the terminal to an external editor
and check whether it can be re-enabled when Codex resumes.

## Testing

PTY tests cover idle composer redraws, focus refresh without a theme
notification, existing subscriptions, and recovery after missing replies.
They also cover Escape, typing, and interrupt keys during color queries.

GitOrigin-RevId: 0f0d4b057fdc7c2d6813dc08ff284f47824db6b0
2026-12-02 11:39:41 +00:00
jif a5484adce0 Resolve approval reviewers from destination thread settings (#65237)
## Why

The TUI can resolve a fallback `approvals_reviewer` before the
destination app server applies the thread's provider and permissions.
Sending that fallback as an override can select the wrong reviewer.

## What changed

For fresh replacement sessions and startup with a selected profile,
send the reviewer when explicitly configured and otherwise let the
destination app server resolve it from the final thread settings.

## Testing

Cover reviewer selection for remote replacement sessions, profile
startup, and projectless sessions. Verify that embedded forks inheriting
saved permissions retain the saved reviewer.

GitOrigin-RevId: fc9b8f18b021d11e276888c6c6f78fc5db7c8846
2026-12-02 11:38:59 +00:00
jif 258cae0778 Default eligible OpenAI sessions to automatic approval review (#65236)
## What changed

When `approvals_reviewer` is unset, default to `auto_review` for sessions using the OpenAI model provider with `guardian_approval` enabled, effective workspace-write permissions, and an effective approval policy of `on-request` or `granular`. Otherwise default to `user`. Explicit reviewer settings still take precedence over the default, subject to configuration requirements.

When the TUI starts a replacement session on a remote app server, use the server's configured reviewer if the client has no explicit reviewer setting. Update the configuration and app-server schemas to document the new default.

## Testing

Cover reviewer eligibility and managed requirements in configuration tests, manual overrides and empty workspace roots in app-server thread-start tests, and remote reviewer precedence in the TUI replacement-session test.

GitOrigin-RevId: fd05687accddb8a3ab99df0486b93f3f595fef65
2026-12-02 11:38:20 +00:00
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