Commit Graph
11195 Commits
Author SHA1 Message Date
dkovalenko-oai 3b7a8520ef Identify failed SQLite databases in codex doctor output (#47330)
## Why

The generic state integrity failure message does not identify which database needs attention.

## What changed

- Include the paths of all databases that fail integrity checks in a structured issue, shown in text summaries and JSON output, with the existing recovery guidance.
- Redact sensitive details using `: ` as the field-label separator so Windows drive letters are not mistaken for labels and unlabeled sensitive paths are fully redacted.

## Testing

Add coverage for single and multiple failed databases, summary and detailed text output, JSON output, preservation of damaged database contents, and sensitive path redaction on Unix and Windows.

GitOrigin-RevId: ac5fec9473d22b6b137a9fc8a751aba8605d940f
2026-09-22 17:59:02 +00:00
Eric Traut 00d92ad3ee Standardize TUI menu description wording and punctuation (#47329)
## What changed

Remove trailing periods from concise built-in option descriptions and disabled-option explanations, and simplify wording across TUI menus. Share the built-in permission preset descriptions between permission pickers.

Document the convention in `codex-rs/tui/styles.md`, including normal punctuation for descriptions with multiple sentences and preservation of externally supplied descriptions.

## Testing

Update menu assertions and rendering snapshots for the revised copy and line wrapping.

GitOrigin-RevId: 3231d25484178452ab001af5ddc982460d14f94a
2026-09-22 17:58:37 +00:00
Chris Dong 6cfe299849 Preserve image generation request IDs on failure (#47327)
## Why

Failed image requests discarded the `x-codex-imagegen-request-id` header, leaving failure analytics without the request ID.

## What changed

Carry the request ID through `ImageRequestError` and backend errors for image generation and editing. Preserve it on failed image generation items for HTTP errors, response decoding errors, and responses with no image data.

## Testing

Extend the app-server failure test to verify that a request ID returned with an HTTP 500 response reaches `codex_image_generation_event` analytics.

GitOrigin-RevId: 57cddacc0221e5b58877ac375d5eca0afb99d853
2026-09-22 17:37:45 +00:00
viyatb-oai 2c2a42e65d Restrict MCP OAuth authorization endpoints to HTTP(S) (#47326)
## What changed

Reject authorization endpoints with schemes other than `http` or `https` before client registration or authorization URL return. Document this constraint for `mcpServer/oauth/login`.

## Testing

Make existing asynchronous tests wait for cleanup: wait for `ThreadIdle` before injecting user input in the guardian cached-score test, and poll for queue consumption before asserting that dispatched items are gone.

GitOrigin-RevId: e5f6b4c5556234c3cc2aa56910486e892c011116
2026-09-22 17:31:02 +00:00
ningyi-oai 8a577399c7 Keep report reason tags within Sentry limits (#47325)
## Why

Sentry tags cannot contain newlines or exceed 200 characters, but report comments can contain both.

## What changed

Limit the `reason` tag to the first 200 Unicode characters and replace each carriage return or newline with a space. Preserve the full, unchanged comment in the exception body.

## Testing

Add coverage for line endings, the 200-character boundary, and multibyte Unicode comments. A mock upload test checks that the compressed Sentry envelope contains the bounded tag preview and full comment, even when caller tags attempt to override `reason`.

GitOrigin-RevId: e0f0db6a9797a817da2f868727077c948ad82bfb
2026-09-22 17:08:11 +00:00
Owen Lin 286d4ecf44 Persist resume metadata in compaction checkpoints (#47323)
## Why

Compaction companion records do not represent all resume state, including the last started turn and previous turn settings. The selected multi-agent runtime also needs a persisted value when no companion turn context is present.

## What changed

- Add optional `resume_metadata` to `CompactedItem`, recording the multi-agent version, last started turn ID, and previous turn settings. Preserve the distinction between absent metadata and explicitly empty values while retaining compatibility with older records.
- Capture this metadata under the settings persistence lock alongside the compaction checkpoint.
- Rewrite inherited metadata to use the child agent's runtime, and clear previous turn settings when the child must rebuild context.
- Clear pending continuation state before delivering acceptance of standalone settings updates, while holding the persistence lock.

## Testing

Add coverage for metadata round trips with empty values, legacy reader compatibility, checkpoint companion records, inherited fork metadata, and continuation invalidation while settings event delivery is blocked.

GitOrigin-RevId: f30b7feaa7e2fdb5b65fc3c53b37fd7a7fe27903
2026-09-22 16:35:30 +00:00
Eric Traut 5a11c45606 Render TUI Markdown lists with Unicode bullets and checkboxes (#47322)
## What changed

Render unordered bullets as `•` and task markers as `☐` or `☑`, preserving ordered numbering and continuation indentation in streaming and completed Markdown. Add `tui.rendering.lists`, enabled by default; setting it to `false` retains hyphen bullets and textual task markers.

## Testing

Add snapshot coverage for nested, ordered, quoted, and wrapped task lists, plus code and escaped markers. Add character-by-character streaming tests that compare incremental and emitted output with full rendering, with list rendering enabled and disabled.

GitOrigin-RevId: df9209d8c42f277dd2a2d7073ea19a6feb7dd706
2026-09-22 16:34:07 +00:00
Eric Traut 13a966fc65 Honor the system clock preference across more TUI timestamps (#47321)
## Why

Several TUI views hard-code 24-hour timestamps even when the detected system preference is 12-hour time.

## What changed

Use the existing `ClockFormat` preference for rate-limit and spend-control reset times, usage notices, backend banners, reset-credit expiration times, analytics timestamps, and expanded session details in the resume picker. Capture the preference when constructing views and preserve existing timezone handling, including analytics' UTC labels.

## Testing

Add coverage for midnight, noon, and next-day reset labels in both clock formats, plus 12-hour analytics rendering with UTC labels. Update snapshots for status, banners, usage notices, reset-credit details, and expanded sessions, including narrow-width layouts. Pin test fixtures to explicit clock formats for deterministic output.

GitOrigin-RevId: 73c36d603ddc4eb7800614650a14c6f2961f8b70
2026-09-22 16:23:59 +00:00
Eric Traut 2c087a0cc2 Fix Escape navigation in read-only agent sessions (#47320)
## Why

In read-only sessions with an external writer, `Esc` could enter prompt backtracking or be consumed by a scrolled transcript instead of returning to the agent command center.

## What changed

- Exclude external-writer views from prompt backtracking and let `Esc` navigate away from scrolled transcripts. Active search and selection still consume `Esc` first.
- Close the legacy transcript overlay without starting a backtrack preview or changing the retained draft.
- Allow `Esc` to open the agent command center while disconnected, showing a stale-list notice with reconnect status instead of requesting a refresh.

## Testing

Add regression coverage for normal, scrolled, detailed, and offline read-only views, command-center snapshots, and retained-draft preservation when closing the legacy transcript overlay.

GitOrigin-RevId: e2623d25dd4b4beea13b6f517932280168113dce
2026-09-22 16:16:15 +00:00
Eric Traut a3275210bd Match agent status symbols to the selected row style (#47319)
## Why

Status symbols in the agents overview retained their status color when selected, making their styling inconsistent with the rest of the selected row.

## What changed

Apply the row's selection style to its status symbol while preserving status colors for unselected rows.

## Testing

Extend rendering tests to assert and snapshot selected status symbol styles across status variants, and verify that an unselected idle symbol retains its cyan color.

GitOrigin-RevId: a5163841bed80d6d43e7c62a7596c6e48b9dc886
2026-09-22 16:15:02 +00:00
Eric Traut d6093d3228 Offer explicit recovery for incompatible background servers (#47318)
## Why

Automatic daemon launches could silently fall back to embedded mode when shared feature settings differed from the session's requirements. Changing those settings affects other clients, and restarting the server may interrupt active or queued work.

## What changed

- Offer interactive choices to run without the daemon, restart with the required settings, or cancel. Default to cancel and require explicit confirmation for restart.
- Allow restart only for managed daemons with a feature mismatch, then recheck compatibility once. Noninteractive required-daemon failures return an error with `--no-daemon` guidance; optional attachment retains its fallback behavior.
- Preserve saved feature overrides on startup and require confirmation before applying requested shared-feature disables, including on fresh starts.
- Merge confirmed settings under the lifecycle lock, persist changes after the old process stops, and avoid restarting when the saved overrides already match.

## Testing

Add recovery-menu snapshots and confirmation tests, compatibility tests for required and optional attachment, daemon ownership and settings-preservation tests, and CLI terminal tests for cancellation, embedded fallback, confirmed restart, and disabling shared features.

GitOrigin-RevId: d50a6cf7e476b9647237431e8fc0fc6041ed17db
2026-09-22 16:07:38 +00:00
Eric Traut 7e6c4c20fd Enable /import in remote and local daemon sessions (#47317)
## Why

`/import` was unavailable in remote sessions and when connected to the local app-server daemon. Shared servers also broadcast import completions from other clients, which must not clear this client's pending import or report its completion.

## What changed

- Allow external setup migration through the connected app server in both session types.
- Detect setup using the active thread's working directory, or the remote working-directory override before a thread starts. Use home-only detection when no remote directory is available.
- Track the returned `import_id` and only clear the pending import and report completion for a matching notification.
- Skip refreshing configuration from local disk after import completion in remote workspaces.

## Testing

Add shared-transport coverage in embedded and remote modes for detection with and without a working directory, retrying failed imports, rejecting overlapping imports, and matching interleaved completion notifications queued before the import response.

GitOrigin-RevId: 864ed9fe87e5c554da79907ed80a01f0c9948392
2026-09-22 16:06:30 +00:00
Charlie Marsh 44b857c00e Clean up legacy Guardian thread metadata in SQLite (#47303)
## Why

Guardian prompts are synthetic review context, but legacy thread metadata can duplicate them in titles, previews, and first messages. Keep SQLite metadata small while retaining rollout JSONL as the canonical record.

## What changed

Add a migration for Guardian threads that:

- Replaces blank or prompt-derived titles with `Guardian review`.
- Preserves nonblank names and distinct nonblank titles, using the title as the name when no name exists.
- Sets `preview` to `Approval review` and clears `first_user_message`.

## Testing

Add a migration test covering prompt-derived and blank titles, custom titles and names, and unchanged metadata for a non-Guardian worker thread.

GitOrigin-RevId: 65b5ff5200a39a19fb11f494de6dca7710ff6cc6
2026-09-22 15:05:27 +00:00
Charlie Marsh 4f6c106cdd Use compact display metadata for Guardian review threads (#47302)
## Why

Guardian review threads use synthetic approval prompts as user messages. Deriving thread titles and previews from those prompts exposes large, unhelpful summaries in thread listings.

## What changed

- Default Guardian threads to the title "Guardian review" and preview "Approval review" across metadata creation, rollout reads, and resume.
- Skip synthetic user messages and goal updates when deriving Guardian display metadata, leaving `first_user_message` unset for new threads.
- Preserve custom names, including legacy indexed names, when listing, reading, resuming, and migrating threads to paginated history.

## Testing

Add regression coverage for compact metadata, resume without session metadata, custom names before and after migration, and app-server persistence, listing, and rename/resume behavior.

GitOrigin-RevId: 42aa707db20c3e57ffa5fd4c91ee313710be10d7
2026-09-22 15:02:54 +00:00
jif 5c07856e25 Separate local agent runtime state from controller handles (#47301)
## What changed

Extract `LocalAgentRuntime` from `LocalAgentControl` to hold the shared registry, residency state, execution limiter, rollout budget, service tier, instruction provider, and thread-manager bindings. Keep session identity on the controller handle.

Store the runtime in `SessionServices` and use it to bind controllers for child startup, resume, delegation, and guardian reviews. Route ownership checks and residency handling through the shared runtime, preserving registry identity across handles. Update existing test fixtures to keep the controller and runtime paired.

GitOrigin-RevId: 846094657cbdf736da3149f0a1c96b4e01423dfe
2026-09-22 14:48:28 +00:00
jif c6c09fe29f Consolidate agent operations in the AgentControl implementation (#47292)
## What changed

Move `spawn`, `send`, and `inspect` into the `AgentControl` implementation for `LocalAgentControl`, removing the forwarding methods and the `spawn_request` module. Update tool handlers and existing tests to use the trait methods, and remove redundant boxing at spawn call sites.

Preserve spawn validation, message attribution, runtime loading, and queue-only delivery semantics.

GitOrigin-RevId: 6027d4d97d0dfb6763dc97ef92a2d7ef58de945d
2026-09-22 13:47:56 +00:00
felixxia-oai d9ac1f02ed Update the Guardian extra-policy snapshot for retained instructions (#47287)
## What changed

Update `extra_policy_reaches_guardian_review` to expect a retained user
instructions section before the transcript, including the source-order notice
and the original user request. Adjust the subsequent snapshot item numbers.

GitOrigin-RevId: 9e57f9bb7cdc9318787d083bf4350143a1353287
2026-09-22 13:17:13 +00:00
jif 89a7298aff Add regression coverage for message board unsubscribe persistence (#47281)
Verify that unsubscribing from a message board thread remains effective
after posting to that thread and resuming the session. The runtime test
checks that replies from a child agent produce no `CHANNEL_POST` notices
while unsubscribed and that explicit resubscription restores delivery.

Use gated streaming responses to keep the recipient active during each
reply and drain worker completion messages before checking notices.

GitOrigin-RevId: fe2695a46722a94e6fca86a3d3bd49c0b8bb7ee7
2026-09-22 13:02:44 +00:00
felixxia-oai 279ba89415 Enable Guardian thread context by default (#47275)
## What changed

Mark `guardianv2.thread_context` as stable and enable it by default for synchronous and asynchronous Guardian reviews. Keep it independent of the Guardian v2 `enabled` toggle and preserve explicit configuration and profile overrides. Update the configuration schema documentation to match.

## Testing

Update coverage for default configuration and sender user messages, review prompt snapshots, history retention across compaction, and checkpoint provenance. Assert that later user input invalidates an in-flight review's authorization. Keep legacy transcript budgeting coverage by explicitly disabling thread context in that test.

GitOrigin-RevId: 19afd34d7bfc0ee36bbf878089c68b732a21bc6a
2026-09-22 12:43:11 +00:00
felixxia-oai 99784bd09b Allow Guardian sync review across compaction hash differences (#47272)
## Why

Thread-owned Guardian review rejected usable parent compaction checkpoints when the reviewer's `comp_hash` differed or was unknown, even though the synchronous reviewer can consume those checkpoints.

## What changed

Remove the synchronous reviewer's compaction hash compatibility check and the associated hash plumbing. Pass usable checkpoints to the backend for payload validation, while continuing to fail closed on unusable checkpoints and review errors.

## Testing

Update compaction and resume tests to expect retained evidence with different, missing, or empty reviewer hashes, while preserving rejection of empty checkpoint content.

GitOrigin-RevId: bbc4f5a2e697f832f815dcf8bda4d4a652f06b8a
2026-09-22 12:37:11 +00:00
jif 16bb1b9d7e Implement AgentControl for LocalAgentControl (#47271)
## What changed

Add an adapter that delegates the shared controller interface to existing local agent operations, including lifecycle management, message delivery, status observation, budget accounting, and shared settings.

Align the trait signatures and documentation with local behavior: separate advisory capacity checks from execution tracking, preserve best-effort completion reporting, and return optional guardian evidence. Use `SessionId` for controller identity and replace paginated queries with loaded-agent listing by path prefix, removing the obsolete types and exports.

GitOrigin-RevId: 15bb7135e0f180d207390f6f2e75f63b9058816a
2026-09-22 12:19:05 +00:00
jif ac7634b9f7 Stream agent snapshots from local status subscriptions (#47267)
## What changed

- Return `StatusSubscription` streams of `AgentInfo` snapshots from local status subscriptions, including agent metadata and configuration.
- Emit the initial snapshot before subsequent coalesced updates. Use a weak thread reference and retain the last observed configuration so published final updates remain available after the runtime is dropped.
- Update completion notifications and `wait_agent` to consume snapshot streams, propagate subscription errors from `wait_agent`, and fall back to the latest status when a stream ends.

## Testing

Update the shutdown subscription test to verify that shutdown before the first poll preserves the initial `PendingInit` snapshot followed by `Shutdown`.

GitOrigin-RevId: beb46952cbcc9bddf65a4d6603fea939d5ace8b9
2026-09-22 11:44:00 +00:00
victor-openai a1f40f3f13 Expose hosted plugin extensions in app-server summaries (#47263)
## What changed

- Request installed-plugin metadata with `includeExtensions=true` and carry optional `extensions` through the cache into `PluginSummary`.
- Add typed declarations for global, settings, thread, and file entrypoints, quick actions, settings tools, icons, and search mention providers. Update JSON schemas and TypeScript and Python bindings.
- Accept supported snake_case aliases and emit camelCase fields. Discard incompatible extension declarations without invalidating the installed-plugin inventory.

## Testing

Add an integration test covering extension metadata preservation, field normalization, and unknown entrypoint and quick-action types across live and cached `plugin/installed` reads. Update pagination assertions to require `includeExtensions=true`.

GitOrigin-RevId: b73b0d13c151a30dc1fb9cda70b5cd6d7e3e2441
2026-09-22 11:29:58 +00:00
jif d3e5840932 Subscribe authors to message-board channels created by posting (#47259)
## Why

Posting to a new channel subscribed its author to replies on that post, but not to new discussion roots in the channel. The creator could therefore miss notifications for subsequent discussions.

## What changed

Subscribe the author to the channel in the same transaction that creates the channel and its first post. Document this behavior in the API and the `new_channel_name` tool parameter.

## Testing

Update coverage to verify that channel creators receive notifications without explicit targeting and that posting to an existing channel preserves an explicit unsubscribe. Adjust thread-deletion test expectations for the additional persisted subscription.

GitOrigin-RevId: 5553ebc9f9b51456ab48886e9871733e93370a2b
2026-09-22 11:10:53 +00:00
jif 3d5cdc51d0 Test spawn settings reporting after child removal (#47258)
## What changed

Add a V1 spawn regression test that removes the child from the thread manager during startup, before spawn reports its settings. Verify that the completed spawn event retains the role-configured model and reasoning effort, nickname, and role even when the child can no longer be looked up.

Also verify that the child receives its initial input with the effective settings and the parent receives a successful spawn result.

GitOrigin-RevId: 5e94e3ddb0feda0eaaa86e7539ef8c6720176f88
2026-09-22 11:10:29 +00:00
jif 0160eb3497 Preserve explicit message-board unsubscribes when posting (#47257)
## Why

Posting to a discussion automatically subscribed its author, undoing an explicit unsubscribe and restoring unwanted reply notifications.

## What changed

Persist explicit opt-outs so posting follows a discussion by default but leaves unsubscribed agents opted out until explicitly subscribed again. Keep active subscriptions in the existing table for compatibility with older readers, and remove opt-outs when deleting a board. Update the API and tool descriptions to explain the behavior.

## Testing

Extend the local board test to cover reopening an older database, preserving opt-outs across reopen and subsequent posts, legacy subscription queries, explicit notifications without resubscribing, explicit resubscription, and board cleanup.

GitOrigin-RevId: 8b8f7f50cea5041541b8d93067c52db18cdde85c
2026-09-22 11:07:21 +00:00
jif fdd89e78ac Return agent snapshots from close_agent (#47252)
## What changed

Return an `AgentInfo` snapshot captured before shutdown, including metadata for known unloaded agents. Use the snapshot's status and metadata in the tool's completion event and its status in `previous_status`, replacing the separate status subscription.

Preserve the pre-close status for error reporting when shutdown removes the target before a descendant fails to close. Propagate unexpected thread lookup errors before attempting shutdown.

GitOrigin-RevId: bdbd877aaf0389e830d6a7e84a5e14bb7d47277a
2026-09-22 10:58:32 +00:00
jif c117207a6f Drop descendant channel posts from retained remote compaction v2 history (#47249)
## Why

Remote compaction v2 excluded descendant progress messages from retained history but kept `CHANNEL_POST` messages from those same agents.

## What changed

Treat descendant `CHANNEL_POST` messages like `MESSAGE` progress updates when selecting history to retain after remote compaction v2.

## Testing

Extend the remote compaction test to verify that a child channel post is included in the compaction input and omitted from the follow-up request.

GitOrigin-RevId: 204bf44b8cddf1e6dc1e48234f51d4ac2aaf2e9f
2026-09-22 10:44:00 +00:00
victor-openai 3b50349e1a Add explicit app and account targets to MCP resource reads (#47248)
## What changed

Allow `mcpServer/resource/read` to specify `target: {connectorId, linkId}` for direct hosted app reads without tool discovery, when supported by the backend. Require an explicit `linkId`: a string selects an account, while `null` requests no-auth access subject to backend policy.

Restrict direct targets to `codex_apps` and reject empty connector IDs, empty link IDs, and synthetic link IDs. Preserve originating app/account scope when `originCallId` and `threadId` are supplied, and retain discovery when `target` is omitted.

Update protocol schemas and TypeScript and Python models, preserving required-but-nullable `linkId` semantics in Python code generation.

## Testing

Extend resource-read tests to check target metadata with and without a thread, including explicit no-auth targets and omitted targets. Add Python model tests for string and null `linkId` values and rejection of a missing `linkId`.

GitOrigin-RevId: 8cf5595fbdd937193aeb529901fc95299f6e18ad
2026-09-22 10:42:50 +00:00
jif c46aa58a7b Centralize agent resume handling in LocalAgentControl (#47244)
## What changed

Add `LocalAgentControl::resume_agent` to reuse an existing thread or restore it from its rollout when lookup returns `ThreadNotFound`. Return the agent's current status, metadata, and configuration snapshot.

Route the `resume_agent` tool through this method, replacing its status-based resume check and separate restoration helper.

GitOrigin-RevId: 2ae0572a030f169eca1760ba0aff1fb9e2ab6651
2026-09-22 10:27:19 +00:00
jif acc20df49f Prevent V2 agent eviction from racing with queued messages (#47240)
## Why

Accepted inter-agent messages can still be waiting in the submission queue when a worker appears idle. Evicting that worker can lose the queued work, while cancelling an eviction caller can leave shutdown unfinished and allow delivery to a closing runtime.

## What changed

- Pin V2 recipients until queued submissions are handled or dropped, and verify that delivery targets the registered runtime.
- Move `Submission` into core so it can carry the residency guard through queue handoffs.
- Give eviction exclusive access to each runtime and keep it counted against capacity until removal. Run teardown in a separate task so it completes even if its caller is cancelled, and remove registry and residency entries together.

## Testing

Add a regression test covering queued follow-up delivery, eviction refusal while mail is pending, cancelled eviction completing teardown, rejection of late delivery, and capacity reuse after removal.

GitOrigin-RevId: d6de3d68cb6b911942e9ddfc05c65b3741b796b2
2026-09-22 09:50:48 +00:00
jif b58b05e062 Suppress agent message board notifications to the post author (#47236)
## Why

Channel and thread subscriptions, or explicit `agents_to_notify`, could cause agents to receive notifications for their own posts.

## What changed

Exclude the author from notification recipients, even when explicitly targeted. Preserve the author's subscriptions so replies from other agents still reach them, and document this requirement in the board API.

## Testing

Update board tests to cover explicit self-targeting, subscribed authors, and delivery of other agents' replies. Update the model-context scenario and snapshot to verify posts remain searchable without a `CHANNEL_POST` self-notification.

GitOrigin-RevId: 0b2558e7df79122a6da06ad592f9735ba260cce1
2026-09-22 09:39:49 +00:00
jif f908e5a968 Route multi-agent spawning through SpawnRequest (#47235)
## What changed

- Route both multi-agent spawn handlers through `LocalAgentControl::spawn`, accepting user input or an agent message.
- Centralize spawn message attribution and canonical path validation, and require message input to use `TriggerTurn`.
- Return the child's configuration snapshot alongside `LiveAgent`, so handlers obtain effective settings directly from spawning without a separate lookup.
- Update child test fixtures to use the shared spawn entry point.

GitOrigin-RevId: 9f9278df08041a62215f9ec3d38688c78fc5e0e2
2026-09-22 09:32:22 +00:00
Ben Romano 94174e44cb Preserve MCP request trace context across transport workers (#47212)
## Why

MCP requests pass through background transport queues, so HTTP requests need the caller's trace context carried explicitly to preserve trace ancestry.

## What changed

- Capture W3C trace context in request metadata for tool and resource operations, custom requests, and event streams.
- Restore that context in an `mcp.http.request` span around HTTP POSTs, linking outgoing HTTP traces to the originating request.
- Preserve application metadata while replacing trace fields with the current caller's context and removing stale `tracestate`. Read the SDK's merged metadata so extension fields retain precedence over parameter metadata.

## Testing

Add a unit test for metadata merge precedence and an integration test covering concurrent paginated requests, tool calls, custom requests, and tool-call continuations across legacy and `2026-07-28` protocol modes. Verify HTTP trace ancestry, metadata preservation, and removal of stale `tracestate`.

GitOrigin-RevId: 0b22cd75f31f9fcb855b27fa8d34ecdffd6e3549
2026-09-22 06:47:07 +00:00
alexsong-oai 064e701b0f Add explicit gateway OAuth sign-in to app-server (#47207)
## Why

Clients with a gateway sign-in UI need to control when browser authorization starts and inspect credential readiness before making authenticated requests.

## What changed

- Add `initialize.capabilities.explicitGatewayOauth` to require explicit login while allowing existing credentials to refresh. Preserve automatic authorization for clients that omit the capability, and prevent later connections from undoing explicit opt-in.
- Add `account/gatewayOAuth/read`, `account/gatewayOAuth/login`, and `account/gatewayOAuth/cancel`, plus `account/gatewayOAuth/changed` notifications. Send the authorization URL only to the initiating connection and cancel its login on disconnect.
- Check gateway authentication before returning cached results from `model/list`, with restart guidance when provider settings have changed.
- Update protocol schemas, TypeScript and Python bindings, and document capability probing and the sign-in lifecycle.

## Testing

Add tests for passive readiness reads, credential reuse after login, token exchange failures, cancellation and immediate retry, connection ownership, legacy versus explicit login, and model-list authentication checks.

GitOrigin-RevId: a26e116a62c9f3db84dc238a40b7f4e816eb1594
2026-09-22 06:36:09 +00:00
Celia Chen 6ea62c4396 Resolve proxy routes for standalone web search redirects (#47204)
## Why

Standalone web search selected a proxy route only for the initial endpoint. Redirect destinations can require a different system proxy route.

## What changed

- Add `RouteAwareClientPool` support to `ReqwestTransport` for both buffered and streaming requests, and use it for standalone web search.
- Preserve default Codex headers and Cloudflare cookie handling across routes, while retaining the default client behavior when route-aware handling is disabled or Codex is sandboxed.
- Share request construction so URL authentication and header precedence follow `reqwest` semantics, applying them once before redirects and TLS retries.
- Map route-aware failures to transport errors and remove request URLs from those errors.

## Testing

Add regression coverage for redirects through distinct proxies, preservation of POST bodies and default headers, URL authentication and header precedence, and transport error classification without URL leakage.

GitOrigin-RevId: 19a10a62118846db09dd95265dc277e54aac09ef
2026-09-22 06:24:49 +00:00
dermanyang-oai b781733f95 Separate thread preparation from execution persistence (#47199)
## Why

Injecting context before the first turn currently forces a full flush. Stores need a preparation checkpoint that can leave disposable context in memory, while local storage must keep prepared context durable before the first user input.

## What changed

- Add `PersistContext::ThreadPreparation` and `CodexThread::checkpoint_preparation()`, and use the checkpoint in `inject_response_items()`.
- Allow stores to defer rollout-derived metadata writes through `record_thread_metadata()`, including during preparation and execution checkpoints. Keep standard metadata updates synchronous.
- Flush local storage at preparation checkpoints so injected context survives restart.

## Testing

Add tests showing that preparation and first sampling can proceed without waiting for durable metadata. Cover prepared context in first and follow-up requests, plus durability before first input and restoration after restart, in both legacy and paginated history modes.

GitOrigin-RevId: 74f6bb1a5f8d47192364b8bba6afd703a3b7d688
2026-09-22 05:53:29 +00:00
Eric Traut 639d2478cc Render aligned equations and optimization notation in TUI math (#47191)
## Why

Aligned equations and common optimization notation previously fell back to TeX source. Scripts without Unicode equivalents also prevented otherwise supported expressions from rendering.

## What changed

- Add display layouts for `aligned` and `\boxed`, preserving fraction geometry and alignment with surrounding math.
- Stack sum limits and `\underset`/`\overset` annotations in display math, with compact forms for inline math and nested arguments.
- Support `\substack`, uppercase `\mathcal`, and single-grapheme `\widehat`.
- Preserve scripts without Unicode equivalents using explicit grouping, such as `x_{gpt}` and `x^{q+1}`.
- Keep layouts bounded and retain source fallback for unsupported input or expressions that do not fit.

## Testing

Add snapshots and regression tests for optimization models, display limits, grouped scripts, fraction alignment, narrow-width fallback, malformed input, and layout bounds. Add streaming coverage comparing character-by-character output with complete rendering at wide and narrow widths in rich and raw modes.

GitOrigin-RevId: 83937880a309375f472228368ebe885d4f50bf9c
2026-09-22 04:33:58 +00:00
Felipe Coury d1092865f8 Allow forking conversations locked by another app in the TUI (#47185)
## Why

Conversations open in another app disable the composer. Let users continue in an editable fork while the original conversation remains owned by that app.

## What changed

- Add an `f`/`F` shortcut and footer hint to the locked conversation view, preserving local drafts and queued prompts in the fork.
- Show “Forking conversation…” while a fork is pending, block additional key input, and discard buffered input after forking from the locked view.
- Replace the previous session summary after a fork with “Fork created. You can continue here.”
- Keep the locked view and draft intact if the fork request fails.

## Testing

Add tests for shortcut ownership and modifiers, repeated input, editable forks that preserve drafts and queued prompts without taking the source lease, and failure recovery. Add snapshots for fork progress, completion, and the updated footer.

GitOrigin-RevId: 2ecdb0b7fc7e82d8295097faa567995d7a2f7d92
2026-09-22 03:49:43 +00:00
Eric Traut 75ec81c862 Enable automatic daemon startup by default (#47179)
## What changed

Promote `daemon_auto_start` to stable and enable it by default for eligible interactive launches. Remove its entry from `/experimental`.

## Testing

Update daemon startup, `--no-daemon`, and startup failure tests to exercise the default without explicitly enabling the feature. Disable daemon startup in unrelated TUI and path-safety test fixtures.

GitOrigin-RevId: 107d71108b96d09431148d7d61f10c6381929e05
2026-09-22 03:20:27 +00:00
Eric Traut 5106a5234f Enable the fullscreen transcript by default (#47178)
## What changed

Default `tui.fullscreen_transcript` to `true`, including when the `[tui]`
section is absent, and apply the same default to the first frame. Update the
configuration schema to match. Alternate-screen restrictions still take
precedence, and `tui.fullscreen_transcript=false` restores terminal scrollback.

## Testing

Update configuration and startup tests for the new default, including an empty
`[tui]` section and `--no-alt-screen`. Adjust PTY tests to cover default fullscreen
entry and explicit opt-out to terminal scrollback.

GitOrigin-RevId: e460dcd058d52c50da2abc5113bbb678e845d5fc
2026-09-22 03:20:04 +00:00
ningyi-oai a37f260dc6 Preserve empty cell metadata under pending tool-call pressure (#47174)
## Why

Reaching the pending tool-call limit could evict finished empty cells even though removing them frees no pending-call capacity. This loses the metadata needed to certify an empty tool-call inventory on a later `wait`.

## What changed

Only evict cells with pending calls when reclaiming pending-call capacity. Keep empty cells eligible for eviction when a cell slot is needed.

## Testing

Extend recorder coverage to check empty inventories under pending-call pressure in fresh and resumed sessions. Add a code-mode integration test verifying that `wait` serializes an empty inventory with `tool_calls_complete: true` while another cell has filled the pending-call budget.

GitOrigin-RevId: 559d0b4fdc9864c42a90b7d087eb2a3327272d5c
2026-09-22 03:03:52 +00:00
alexsong-oai f4389de279 Add explicit gateway login control and authentication status (#47170)
## What changed

- Add `GatewayLoginControl` so hosts can require caller-initiated browser authorization while retaining automatic login by default.
- Expose passive readiness checks, scoped status subscriptions, and cancellable browser login that reports success after credentials are persisted.
- Return non-retryable request errors for `LoginRequired` and `LoginInProgress`, while preserving retries for transient authentication failures.
- Keep rejected credentials unready until replaced, and prevent slow readiness reads from blocking cached requests or overwriting newer credentials.

## Testing

Add coverage for login cancellation, status notifications, external credential recovery, concurrent credential I/O, legacy automatic login, and request retry behavior.

GitOrigin-RevId: e236d203998ceb6eeaca9704cc05d20ad45f2931
2026-09-22 02:54:53 +00:00
acrognale-oai 30daed37ad Apply workspace routing to Guardian v2 classifier requests (#47162)
## Why

Classifier requests need to preserve their owning thread's workspace routing and account binding, including when reusing pooled connections or retrying after authentication changes.

## What changed

- Share the thread's `WorkspaceRoutingContext` with Guardian v2 and resolve routing before leasing HTTP or pooled WebSocket connections.
- Reuse WebSockets only when their connection key and authentication state still match. Cache HTTP transports by URL and redirect policy, rejecting redirects when routing requires it.
- Stop classification requests and retries when the account owner changes while allowing token refreshes for the same user and workspace.

## Testing

Add regression coverage for routing failures with prewarmed sockets, shared thread routing state, account switches during HTTP and WebSocket requests, same-account token refreshes, and HTTP redirect-policy cache changes.

GitOrigin-RevId: 7b3efcadb4797b6a2de2e28e7506b297b0728d69
2026-09-22 02:33:29 +00:00
Alex Kotliarskyi b23324986d Expose HTTP origins in MCP server status (#47159)
## What changed

Add nullable `httpOrigin` to `McpServerStatus`, derived from the effective configured endpoint for both configured and plugin-provided servers. Return only the HTTP(S) origin, excluding credentials, path, query, and fragment; return `null` for stdio transports, invalid URLs, and non-HTTP(S) schemes. Update the generated protocol schemas and TypeScript and Python types.

## Testing

Extend status integration tests to cover configured and plugin-provided HTTP servers, verify that endpoint paths and query parameters are omitted, and assert `null` for a stdio server. Update protocol tests to check null serialization and compatibility with older inventory responses.

GitOrigin-RevId: 033ebdeefe829e3a48b2d4ab7d8866dac4cda5c5
2026-09-22 02:24:25 +00:00
alexsong-oai 9f22ba8039 Harden gateway OAuth credential persistence and error redaction (#47158)
## Why

Credential I/O can block async workers, and canceled browser logins must not release the credential store lock while a write is still running. Provider errors can also echo secrets from authorization URL query parameters.

## What changed

- Move credential reads and writes to `spawn_blocking`, retaining the cross-process lock until encryption and the atomic write finish, even if the caller is canceled.
- Clear pending rotated credentials during browser login only when stored credentials have changed, preserving recovery after a failed login without overwriting an external login.
- Omit provider response details and request IDs when the authorization URL contains query parameters, matching the existing protection for token and resource URLs.

## Testing

Extend regression coverage for authorization URL query-secret redaction and failed browser login after a failed credential save, including retry, expiration, and external-login recovery.

GitOrigin-RevId: 4a63702a260fd7f3e2ad2314b0124c0d647d4f12
2026-09-22 02:24:01 +00:00
Eric Traut bf7c87a7b7 Ignore stale thread-close notifications after resuming a thread (#47155)
## Why

A queued close notification from an old runtime can arrive after the same thread has been resumed. Because thread IDs survive reloads, handling that notification can incorrectly exit the TUI or switch away from the displayed thread.

## What changed

Confirm the displayed thread's status with `thread/read` before handling its close notification. Ignore the notification if the thread is still loaded. Bound verification to five seconds and retry an internal server error once.

If verification fails, reconnect remote sessions. Preserve close handling for embedded sessions, unreadable unpersisted threads, and servers that do not support the request.

## Testing

Add regression tests for stale and genuine close notifications, plus disconnects, timeouts, transient and persistent server errors, embedded-session fallback, and unsupported requests.

GitOrigin-RevId: 783433b11ed268aed521f3b2cc4d0aa3a36a3836
2026-09-22 02:15:01 +00:00
andrewgu-oai c11ed24c2a Update code mode catalog snapshot hashes (#47149)
Refresh the collaboration namespace hash and aggregate tools hash in the
`code_mode_catalog_messages` snapshot.

GitOrigin-RevId: bcfb793ba379760219cb4214d39f9c8bcd01e40c
2026-09-22 01:38:17 +00:00
Adam Perry @ OpenAI 517f51a6f7 Extract exec-server CLI startup into a dedicated module (#47143)
## What changed

Move `codex exec-server` argument definitions, transport validation, configuration loading, authentication, and shutdown orchestration from `codex-rs/cli/src/main.rs` into `codex-rs/cli/src/exec_server_command.rs`.

Expose startup through `ExecServerCommand::run`, merge the root `--strict-config` flag into the command before dispatch, and update existing argument tests to use the new entry point.

GitOrigin-RevId: 4bcc59db2bd6e1d153a366142bd0b93ad03c6951
2026-09-22 01:01:44 +00:00
Celia Chen b045757052 Honor system proxy settings for standalone web search (#47142)
## Why

Standalone web search used a default HTTP client, bypassing the configured system proxy route when `respect_system_proxy` was enabled.

## What changed

Pass the configured `HttpClientFactory` to the web search tool and create its client asynchronously for the provider's search URL using the API route policy. Export and reuse `SEARCH_ENDPOINT` so route selection and search requests use the same endpoint.

## Testing

Add an isolated regression test with environment proxies removed and a mock system proxy. Verify that standalone web search reaches the proxy and returns its result in the follow-up model request.

GitOrigin-RevId: 3b64803a777b9d1eb0ccf694e06658b0fd562129
2026-09-22 00:59:54 +00:00