Commit Graph
12287 Commits
Author SHA1 Message Date
jif bc9cad3473 Treat incomplete responses as terminal errors (#53451)
## Why

Incomplete responses such as `max_output_tokens` were classified as stream errors, allowing retries and compaction model fallback after the response had hit its output limit.

## What changed

Introduce `ResponseIncomplete` errors that preserve the server-provided reason and stop stream processing immediately. Make these errors non-retryable and stop compaction without falling back to the selected model. Record incomplete responses separately in sampler failure metrics.

## Testing

Add regression tests that verify incomplete responses surface a terminal error without retries over SSE and WebSocket, and that compaction stops without retrying or switching models for both local and remote compaction.

GitOrigin-RevId: 6e107d441b9bf03fa47ea47b88eeb94b71a9f729
2026-10-12 18:53:49 +00:00
Felipe Coury c308e127e0 Suppress repeated turn diffs in codex exec human output (#53444)
## Why

Repeated turn diff notifications can print the same file changes multiple times, including after an unrelated command.

## What changed

Track the last diff and print nonempty updates only when they differ from the previous notification. Remember empty updates so a restored diff prints again, and reset the tracked diff when a new turn starts.

## Testing

Add a stderr snapshot test covering repeated, changed, empty, restored, and new-turn diffs. Add an integration test that applies one edit, runs an unrelated command, and verifies that the diff appears exactly once.

GitOrigin-RevId: db0a2aa8b77b800ca661e7d1314ed1e571743e74
2026-10-12 18:21:10 +00:00
Eric Traut 3ece80b784 Use local MSVC toolchains for native Windows Bazel tests (#53443)
## Why

Hermetic LLVM targets the GNU ABI on Windows even when an MSVC platform is selected. Native MSVC builds need the runner's MSVC toolchains and SDK environment.

## What changed

- Register the local x64 and ARM64 C++ toolchains in `ci-windows-msvc`.
- Apply `--config=ci-windows-msvc` to the native Windows Bazel test job.
- Allow the native Windows test job to run on `workflow_dispatch` as well as pushes to `main` so toolchain changes can be tested manually.

GitOrigin-RevId: b9fbd3f2bba8a3a8bf226cafda19a921c8738acd
2026-10-12 18:20:04 +00:00
Eric Traut 6c7d409a6d Preserve status line accents on 16-color terminals (#53440)
## Why

RGB and extended indexed theme colors cannot be displayed directly on 16-color terminals, causing status line items to lose their color accents.

## What changed

Use each status line item's existing ANSI fallback accent when its theme foreground requires RGB or an indexed color beyond the first 16 colors.

## Testing

Add regression coverage for uncolored output with `FORCE_COLOR=0` and ANSI status line accents with `FORCE_COLOR=1`. Give the RGB styling test explicit terminal colors so it consistently exercises true-color behavior.

GitOrigin-RevId: 213ca5c6c366f0a3c696aab256a0b146558a2837
2026-10-12 18:00:25 +00:00
Eric Traut 7c1b64c5df Stop identifying Apple Terminal from TERM_SESSION_ID (#53438)
## Why

`TERM_SESSION_ID` is not specific to Apple Terminal. Treating it as an Apple Terminal identifier can mask Windows Terminal detection and the `TERM` fallback.

## What changed

Remove the `TERM_SESSION_ID` detection heuristic. Apple Terminal remains detectable through `TERM_PROGRAM=Apple_Terminal`.

## Testing

Update tests to cover Windows Terminal detection and the `TERM` fallback when `TERM_SESSION_ID` is present, and Apple Terminal detection with its version and user-agent token.

GitOrigin-RevId: 27db11cb7bcca8f94888f9e21a6cdfcf31561b1b
2026-10-12 17:52:12 +00:00
Benjamin Carlsson 6f47fcb0be Route TUI request replies to their originating connection and thread (#53436)
## Why

Pending requests can outlive a session switch, and different threads or connections can reuse request IDs. Replies and resolution notifications must stay associated with the request that prompted them.

## What changed

- Retain the original app-server reply handle for pending and buffered requests, including requests replayed after thread attachment or session reset.
- Scope user input, MCP elicitation, and user verification bookkeeping by thread, and send user input answers to the requesting thread.
- Keep background resolution notifications from dismissing foreground prompts.
- Consume failed replies to closed connections and clear pending replay state without falling through to another request route.

## Testing

Add WebSocket regression tests for direct and buffered approvals with colliding request IDs and replies to closed connections. Extend coverage for foreground prompt preservation and thread-scoped user verification cancellation.

GitOrigin-RevId: 541acb9910e92f6f2e83c27d2a2384185d4f8fec
2026-10-12 17:39:17 +00:00
Felipe Coury b3c3bad976 Apply configuration toggles live and improve settings navigation (#53429)
## Why

Several configuration toggles required restarting Codex, and settings search only filtered the current group. Narrow terminals also truncated setting values and descriptions.

## What changed

- Apply animations, composer stars, paste detection, automatic recaps, and tips without restarting Codex. Update active motion effects and paste detection when their preferences change.
- Group animations and composer stars in an Effects picker that refreshes after saving and requires animations for composer stars.
- Search across all configuration groups, show each result's group, and preserve the query when switching groups.
- Keep setting values visible in narrow terminals and show the selected description below the list. Reserve space to keep the panel height stable and tailor footer hints to the selected action.
- Simplify configuration notices and omit routine save confirmations.

## Testing

Add and update tests and snapshots for live preference saves while offline, paste detection updates, Effects picker refreshes, global search, and stable panel height at narrow widths.

GitOrigin-RevId: 83773da2f6457ce461ef16f0cddde0df640a36c3
2026-10-12 17:14:59 +00:00
zm-oai f605162354 Preserve Windows runtime registration failure diagnostics (#53426)
## Why

Managed runtime package registration errors lacked the terminal status, separate async and deployment error codes, and deployment activity ID needed to diagnose failures.

## What changed

Include these diagnostics in registration errors and distinguish failures in `GetResults`, the `ExtendedErrorCode` getter, and deployment itself. Preserve the original completion error; failures to read diagnostic fields do not turn successful registration into failure. Keep free-form Windows error text out of diagnostic summaries.

## Testing

Add unit tests for distinct async and deployment errors, failed or canceled result retrieval, and diagnostic getter failures, including preservation of native error codes and omission of free-form diagnostic text.

GitOrigin-RevId: 7f3a46741304ef04f5c3e2aa575bcfc4392dff62
2026-10-12 16:58:24 +00:00
jif fc4921f487 Add regression coverage for network grants on cold thread resume (#53424)
## What changed

Add a Linux app-server integration test that resumes a saved read-only thread after the default permissions change to `:danger-full-access`. Verify that the live network proxy honors restored grants, requests approval for a new host, persists the approved rule, and reuses it without another approval.

The test also verifies that proxied requests succeed while direct access remains blocked.

GitOrigin-RevId: 08f63efb8752d738df0ee97e4e98c3366ae54f56
2026-10-12 16:49:29 +00:00
jif bf4ca52b61 Restore saved thread permissions during configuration loading (#53419)
## Why

Restoring unnamed thread permissions after configuration loading leaves network proxy initialization and permission validation using the configured default. A saved read-only thread should also resume when that default is incompatible with current managed requirements.

## What changed

Apply eligible saved permission profiles during configuration loading, before network preparation and final validation. Keep explicit permission overrides and managed requirements authoritative, preserve managed deny-read restrictions, and reject saved external enforcement or materialized filesystem grants. Include the saved profile in the app-server's prepared resume configuration state.

## Testing

Add regression coverage for resuming saved read-only permissions with an incompatible full-access default and for retaining managed, remembered, and newly approved network domains in the restored profile's proxy allowlist.

GitOrigin-RevId: 73e32b0a31ac678fd3f60a8ccf8fa9df627f16c3
2026-10-12 16:09:41 +00:00
jif 16845bb8e8 Isolate arg0 helper directories by operating system (#53412)
## Why

Windows and WSL can share `CODEX_HOME` without sharing a lock namespace, allowing cleanup to remove another platform's live helpers. Older clients can also clean helpers stored under the shared `tmp/arg0` root.

## What changed

Create helpers under `CODEX_HOME/tmp/arg0-<os>` and limit stale-directory cleanup to that operating system's root. Keep permission discovery compatible with both the current platform's root and legacy `tmp/arg0` directories, while ignoring other platforms' aliases.

## Testing

Add regression coverage for cleanup isolation, live helper preservation during legacy cleanup, and selection of the first session alias directory from either supported root.

GitOrigin-RevId: f34292748b5b1d3c25629604d849db4b133dfa3a
2026-10-12 15:43:27 +00:00
jif 97239fd052 Add explicit local board connections with fixed runtime access (#53400)
## Why

Local message boards were scoped to an agent tree. Independently created Codex runtimes need a way to share a board while receiving different access permissions.

## What changed

- Add `LocalBoard` and `LocalBoardConnection` so hosts can supply read-only or read-write access through `thread_extension_init`, including for isolated, ephemeral runtimes.
- Allow read-only connections to read and manage their own subscriptions; reject posting, replying, channel creation, and changes to another agent's subscriptions. Expose effective permissions in channel discovery.
- Use unique runtime paths and require matching board IDs and canonical database paths when resolving agents or delivering notifications.
- Document explicit extension installation and connection setup for new runtimes, cold resumes, and forks.

## Testing

Add a scenario and context snapshot covering an independent writer and isolated Guardian sharing a board through a symlink alias, read-only permission denials, subscription and explicit notifications, and rejection of notifications to an unconnected runtime before a post is written.

GitOrigin-RevId: f92410c3a5c6a46920c3e0e71849c85dc83d9c31
2026-10-12 14:44:22 +00:00
ioanbudea-OAI cab328f275 Distinguish Guardian parent-compaction failure reasons (#53393)
## Why

The generic `parent_compaction_error` classification metric does not distinguish serialization failures, oversized compactions, and unusable compactions.

## What changed

Record separate `failure_reason` values for each case: `parent_compaction_serialization`, `parent_compaction_oversized`, and `parent_compaction_unusable`.

## Testing

Extend parent-compaction reuse tests to cover unusable checkpoints in parent-context mode and assert specific failure reasons. Verify rejected compactions receive the maximum risk score, provide no cached approval, and do not reuse stale context.

GitOrigin-RevId: 103c4173b2ebbdc33eb71bce7f8ecb56f73055f6
2026-10-12 14:16:27 +00:00
swastik-oai 27e6192e84 Use cached login credentials for Guardian decisions (#53389)
## Why

Reading `OPENAI_API_KEY` directly bypasses login credentials reloaded by `AuthManager`.

## What changed

Use the API key from `AuthManager`'s cached authentication for Guardian decisions when the provider is `openai` and has no custom base URL. Keep `CODEX_GUARDIAN_DECISIONS_API_KEY` as the highest-priority override.

## Testing

Add a regression test covering a reloaded API-key login, override precedence, and rejection of the login-key fallback for a custom base URL. Assertions avoid printing credentials on failure.

GitOrigin-RevId: 10b2e6c28d3268c3808c25b2be94d9b6c31f597a
2026-10-12 14:08:33 +00:00
swastik-oai 0c7362d121 Ignore the unsafe-libyaml advisory in dependency audits (#53382)
## Why

`unsafe-libyaml` is unmaintained and has no patched release. It remains a transitive dependency through `serde_yaml`.

## What changed

Add `RUSTSEC-2024-0449` to the ignore lists in `codex-rs/.cargo/audit.toml` and `codex-rs/deny.toml`. Document the dependency path and require removing the exception when the affected users migrate off `serde_yaml`/`unsafe-libyaml`.

GitOrigin-RevId: 6f4cf32e55d2877d90bf00d2c12a1c85f18d229e
2026-10-12 13:39:54 +00:00
jif 6c372fbef4 Allow turns when the agent message board is unavailable (#53369)
## Why

With `multi_agent_v2.disable_direct_message` enabled, an unavailable agent message board could cause tool router construction to reject the turn.

## What changed

Remove the requirement that the router expose the board's `post` tool. Unavailable board calls return an unsupported-call error to the model, allowing the turn to continue.

## Testing

Update scenario coverage for a disabled board feature, legacy agents, and ephemeral sessions. Assert that unavailable board calls return an error to the model, that `post`, `send_message`, and `followup_task` are not advertised, and that no board database is created.

GitOrigin-RevId: cb9571459c128d84c3c96f185e70c404e0463473
2026-10-12 12:32:34 +00:00
Vaibhav Srivastav ddb33e34b2 Remove selected protocol, apply-patch, MCP, and TUI tests (#53358)
## What changed

Remove eight tests covering experimental API schema filtering and marking,
end-of-file unified diffs, MCP prompt auto-approval, and local-link regex
initialization. Remove the associated unused test imports and regex coverage
comment. Runtime behavior is unchanged.

GitOrigin-RevId: 91f59cab82393d43000eadf4e7c55e3a6ec2aa14
2026-10-12 11:24:22 +00:00
jif 6e5f665feb Test final polling of remote processes with open output streams (#53339)
## What changed

Add a unified execution test where `exec_command` yields a session and a subsequent `write_stdin` poll completes after the remote process exits while its output stream remains open. Verify that the poll returns the delayed output and exit code, emits the command completion event, and removes the background session without issuing a `process/read` request.

GitOrigin-RevId: 3a316eb9f6b29682da81a2ecbdda52f659f4b792
2026-10-12 09:55:51 +00:00
jif 7e9c061ceb Finish remote exec cleanup when output streams remain open (#53331)
## Why

A remote process can exit while its output stream remains open, leaving the exit watcher waiting and delaying `ExecCommandEnd` even after output collection finishes.

## What changed

Cancel the process output token after final collection or polling, on one-shot cancellation, and after confirmed termination. This releases the exit watcher while allowing delayed output to be collected before the final poll completes.

## Testing

Add remote process event tests for output streams that remain open at the collection deadline, during interruption, and during explicit termination. Assert that `ExecCommandEnd` preserves the exit code and aggregated output, background terminals are cleared, and interruption and termination require no extra `process/read` requests.

GitOrigin-RevId: 8346e5ce446280915b6e2ffa362fcfd79280bfff
2026-10-12 09:29:11 +00:00
Eric Traut a9b0815167 Support Windows clipboard text paste shortcuts in the TUI (#53224)
## Why

`Ctrl+V` previously attempted only image paste, so a text-only clipboard produced an image-paste error. `Shift+Insert` did not use the clipboard paste path.

## What changed

- On Windows, let `Ctrl+V` and `Shift+Insert` paste images first, then read clipboard text asynchronously when no image is available. Keep clipboard access errors distinct from missing images.
- Allow keyboard paste into composer selections and active history or Vim search queries, including inline mode with right-click paste disabled.
- Flush buffered typing before explicit paste to preserve input order. Discard pending clipboard text when the thread or editable target changes, while allowing shortcut releases and repeated paste shortcuts to leave the read pending.

## Testing

Extend shortcut and clipboard-worker tests to cover text fallback, multiline Unicode text, stale-read cancellation, shortcut releases and repeats, and read-only drafts. Add assertions for history-search preview stability and selection changes.

GitOrigin-RevId: 080c1c05a4587e325cea938a6e28c646b9ac5837
2026-10-11 23:44:43 +00:00
Eric Traut 9f3d25588b Keep agents navigation available after a thread is archived (#53201)
## Why

After a thread was archived externally, the TUI still advertised the Left-arrow agents shortcut, but pressing it in an empty composer did not open the agents view.

## What changed

Reuse the agents navigation handler when connected to an unavailable thread. Preserve the existing empty-composer and editor guards, and require a key press so repeated Left-arrow events do not open the view.

## Testing

Add a regression test for external thread archiving that verifies draft editing, the shortcut hint, ignored key repeats, and opening the agents command center, with a snapshot of the resulting view.

GitOrigin-RevId: a3f36b42bafee948ed7f5842fcb425e414d7e024
2026-10-11 20:45:58 +00:00
Eric Traut 27065a91cc Allow restarting managed background servers from the TUI (#53173)
## Why

Startup configuration warnings can reflect settings from when the background server started, even after those settings have been fixed. A restart lets users refresh the server without leaving the TUI.

## What changed

- Add a confirmed restart action to `/daemon`, warning that active or queued work in other chats may be interrupted. Reconnect automatically and let an in-progress restart finish if the TUI exits.
- Verify that Codex manages a local server before enabling restart, including servers discovered with auto-start disabled and those started by `codex agents`.
- Show a restart hint on the first startup configuration warning for managed servers, preserving the original diagnostic for copying and dismissal.
- Repaint the full surface of centered dialogs to restore background colors over cached blank cells.

## Testing

Add CLI integration coverage for agents startup and restarting a discovered daemon with auto-start disabled. Extend TUI tests for confirmation, cancellation, unmanaged servers, warning hints and dismissal, and dialog background rendering.

GitOrigin-RevId: 8e4319fab84f13bf6e7335deb93364fccaff14a7
2026-10-11 17:43:08 +00:00
Benjamin Carlsson 72f999edc7 Simplify the custom terminal drawing API (#53156)
## What changed

Remove `Terminal::autoresize` and the fallible `try_draw` helpers. Render directly in `draw_with_size`, retaining automatic size updates and the existing buffer flush and cursor handling.

Update the cursor-ordering test to use `draw`, preserving its assertion that the cursor moves before it is shown.

GitOrigin-RevId: 5889e9603d772945660e7ae35690d2b7326b10ae
2026-10-11 16:03:20 +00:00
Eric Traut 95db2cd5d5 Keep remote app-server events deliverable during shutdown (#53155)
## Why

Dropping the event receiver before shutdown lets an in-flight notification fail delivery and terminate the worker before it sends the WebSocket close frame.

## What changed

Keep the event receiver alive until `RemoteAppServerClient::shutdown` finishes waiting for the worker, allowing it to process the shutdown command and close the WebSocket.

## Testing

Extend regression tests to verify that an event remains deliverable after shutdown is queued and that the server receives `Message::Close(None)` with an extra notification in flight.

GitOrigin-RevId: ba14bc97ffa3453b7b59660144db6da9e688983d
2026-10-11 15:57:06 +00:00
Eric Traut 8553558345 Show subagent navigation shortcuts in TUI help (#53153)
## What changed

Add `Alt+Left` / `Alt+Right` to the shortcut overlay's Session group as “Subagents (empty prompt)”, using the existing previous/next agent binding labels.

## Testing

Update shortcut help snapshots for narrow and wide layouts, configured bindings, and running sessions to include the new entry.

GitOrigin-RevId: 534be840e1fe5646cfb9465e78049322d7e72b4c
2026-10-11 15:50:39 +00:00
Eric Traut 41fd60f561 Allow selecting and copying TUI turn tips (#53152)
## Why

Turn tips are visible outside transcript history, but their text could not be selected for copying.

## What changed

Register rendered working and completion tip rows for mouse selection. Keep tips in place when selection hints or copy status appear, and use the hint “Selecting text · esc cancel”.

## Testing

Extend mouse-selection tests and snapshots to cover selecting `/help` in working and completion tips with copy-on-select enabled, and clearing the selection when a working tip disappears.

GitOrigin-RevId: 25b3f02e7e93a53e777de455943d47fbab388ff1
2026-10-11 15:50:16 +00:00
Eric Traut 7c9bfb910e Restore thread-owned permissions on cold resume (#53150)
## Why

Cold resume can replace saved unnamed permissions with current configuration defaults or recover an executor's permissions from turn context. A first-turn context can also predate an acknowledged settings update.

## What changed

- Restore eligible unnamed permission profiles from settings snapshots owned by the resumed thread, honoring explicit caller overrides and current managed requirements.
- Use owned snapshots as the authority for named permission profiles and reapply workspace permissions for the resumed workspace roots.
- Persist a thread-owned settings checkpoint after the first turn's context, serialized with settings updates so older checkpoints cannot supersede newer settings.

## Testing

Extend regression coverage for cold resume with changed defaults, managed permission restrictions, workspace-root overrides, foreign snapshots, and settings updates during first-turn processing.

GitOrigin-RevId: e411d9fd3d586a4162498c9c77c4184459071bd1
2026-10-11 15:48:35 +00:00
Eric Traut 97c1f62898 Fix startup draft recovery for pending Vim Replace keys (#53148)
## Why

Startup recovery treated a buffered Vim Replace key as an insertion, so the recovered unsent text could differ from the eventual edit. Replacing the first character of `abcd` with `X` should recover `Xbcd`, not `Xabcd`.

## What changed

Preserve the distinction between held typed keys and buffered pastes when building recovery snapshots. Apply Vim Replace semantics to held keys, including mouse selections and the bash-mode prefix offset, without consuming live pending input. Keep buffered pastes literal so the live paste path retains responsibility for large-paste and image classification.

## Testing

Add regression tests for recovery after startup draft handoff and replacement of mouse-selected text with and without the bash-mode prefix. Verify that taking a recovery snapshot leaves live input unchanged and that flushing the held key produces the same text.

GitOrigin-RevId: 97fada635ad9f0f01042b8e96020372d6df9d951
2026-10-11 15:38:44 +00:00
Felipe Coury a07c8ebd57 Handle broken pipes gracefully in plugin list output (#53109)
## Why

Piping `codex plugin list` into a consumer such as `head` can close stdout before the full catalog is written, causing a panic.

## What changed

Write both table and JSON output through a fallible writer and treat broken pipes during writing or flushing as success. Continue propagating other output errors.

## Testing

Add unit tests for write and flush failures in both output formats, plus CLI tests that close stdout early and verify a successful exit without a panic.

GitOrigin-RevId: cc4a64e10ad723d26b6de9e731efdc534dbee492
2026-10-11 12:38:29 +00:00
Benjamin Carlsson 8c0f701167 Add connection-bound reply handles for app-server requests (#53049)
## Why

Server request IDs can be reused across connections. Retained replies need to target the connection that emitted the request, even if the UI selection later changes.

## What changed

- Expose `AppServerReplyHandle` through `AppServerRequestHandle::server_request_reply_handle`, capturing the originating client and request ID for explicit `resolve` or `reject` calls.
- Share single-use completion state across clones so only the first reply is submitted. Dropping a handle sends nothing; stale connections return I/O errors without retrying or switching connections.
- Route existing client reply methods through request handles and use the new API in the managed worktree model test.

## Testing

Add in-process and WebSocket tests for replies on separate connections with identical request IDs, rejection routing, duplicate completion, and stale handles after worker shutdown. Also check that debug output redacts handle details.

GitOrigin-RevId: 940d0951ab67529b05919ca8ec7adb5813834b8c
2026-10-11 06:08:41 +00:00
Felipe Coury cc7ba33601 Add a searchable /config preferences panel to the TUI (#52990)
## What changed

- Group preferences into Appearance, Notifications, Input, Sessions, and Text selection tabs, with search and links to existing theme, status line, terminal title, and keyboard editors.
- Persist preference changes to the selected local configuration file, apply supported changes immediately, and show save errors, configuration overrides, and restart requirements in the panel.
- Add a delayed notification test and controls for notification timing while preserving custom event filters.
- Add `tui.copy_on_select_clear_selection`, disabled by default, to clear transcript selection highlights only after confirmed automatic clipboard delivery.
- Keep local configuration editors usable while disconnected and prevent held activation keys or buffered input from triggering actions across editor and reconnect transitions.

## Testing

Add regression tests and rendering snapshots for panel navigation, search, dependency states, editor handoffs, offline persistence, notification timers, custom filter preservation, and confirmed-copy deselection.

GitOrigin-RevId: a16d218046060fcb6e61705a803fcd9297266e6e
2026-10-10 22:28:01 +00:00
alishobeiri-oai de8fab6d7a Upgrade rmcp to 3.5.1 and harden lifecycle tests (#52972)
## What changed

- Update the pinned `rmcp` dependency and Cargo/Bazel lockfiles, and migrate MCP handlers and fixtures to `ClientConfig` and `ServerConfig`.
- Stop requiring responses for cancelled elicitation requests in cancellation tests while retaining checks for cleanup and continued connection usability.
- Handle client disconnects during WebSocket writes in the TUI test server, use an asynchronous HTTP mock for loopback proxy testing, and improve remote executor test diagnostics and the Windows subprocess fixture.
- Use `invalid_prompt` for the memory worker failure fixture.

## Testing

Add a regression test covering transport EOF during both form elicitation and user verification. Keep the client alive while checking that pending response channels close, the timeout pause clears, and the service exits with `QuitReason::Closed`.

GitOrigin-RevId: c0166b83fab3b59d84a5207c6630cb6adcf3b230
2026-10-10 19:43:24 +00:00
Eric Traut 34f33e4ada Keep startup modals protected when terminal input draining times out (#52968)
## Why

An unfinished terminal control sequence can prevent buffered input from draining before a startup modal appears. Propagating that timeout aborts modal handling instead of keeping the screen available for an explicit user decision.

## What changed

Treat input-drain timeouts as a reason to keep startup modal input quarantined. Discard key, paste, and mouse events while retrying the drain, and continue processing server events. Preserve this protection when another request resolves and when the agent overview is restored after reconnecting.

## Testing

Add a Unix PTY regression test covering unfinished control sequences, queued approval and overview shortcuts, unrelated request resolution, and overview reconnection. Verify that buffered input cannot answer an approval or create a task, while fresh shortcuts work after the drain completes.

GitOrigin-RevId: 476bedbd45f13a15d0019e4ce2e875406d4a53ca
2026-10-10 19:23:28 +00:00
Eric Traut 7a8a9456e9 Reuse and prewarm the WSL clipboard text reader (#52967)
## Why

WSL clipboard reads previously launched PowerShell for every paste. Process creation can hang under WSL and stall the shared clipboard worker.

## What changed

- Reuse a persistent PowerShell reader on a dedicated thread, keeping clipboard requests bounded by their deadlines and restarting the reader after errors.
- Prewarm the reader at startup when right-click paste is allowed on WSL, without accessing clipboard contents.
- Use length-framed UTF-8 responses to preserve whitespace and distinguish consecutive pastes while enforcing message size limits.

## Testing

Update the command-reader test to cover consecutive responses from one process, large clipboard text, UTF-8 and whitespace preservation, and read timeouts.

GitOrigin-RevId: 36af338097d6b178ab4887faa5918240c47e1515
2026-10-10 19:22:11 +00:00
Eric Traut ecebd679c3 Defer owned transcript redraws during raw paste bursts (#52964)
## Why

Raw pastes can arrive as thousands of character, Enter, and Tab events. Redrawing the entire owned transcript before each buffered key defeats the composer's paste batching.

## What changed

Skip those redraws while the composer is capturing a paste burst. Continue refreshing geometry immediately for transcript interactions, shortcuts, and non-text keys, including Enter when an accepted Find owns it.

## Testing

Add regression tests and a render snapshot covering multiline raw paste with tabs and Korean text, deferred rendering until the burst flushes, and a single submission of the complete pasted text. Also verify that an accepted Find still handles Enter during a paste burst without submitting the draft.

GitOrigin-RevId: 49d89958a89c165249322463e6075377c517bd8e
2026-10-10 19:15:09 +00:00
jif 47bcb3a3f9 Reduce stack usage in async TUI tests (#52959)
## Why

Large test futures can occupy their caller's stack frame even when passed directly to `Box::pin`.

## What changed

- Add a non-inlined `box_future` helper and `boxed_future!` macro to construct and box futures outside the caller's poll frame. Use them for heavyweight TUI fixtures and test scenarios.
- Return the shared `App` fixture as `Box<App>` to keep it on the heap.
- Treat `ConnectionAborted` as a closed connection in the realtime speech test server, alongside `BrokenPipe` and `ConnectionReset`.

GitOrigin-RevId: 7bbf2020a5ec12bae8e0365ddf5641deef93b544
2026-10-10 18:50:34 +00:00
Eric Traut b871a1b9f6 Verify reset notification during code-mode host recovery (#52952)
Extend `hung_grpc_stdio_host_is_reaped_and_the_session_recovers` to assert that the first execution after host replacement reports lost stored values and running cells. Verify that this rejected execution does not store a value and that the next execution succeeds.

GitOrigin-RevId: 2fc5550c32774321a969b56ba59153de0e497f19
2026-10-10 18:26:18 +00:00
Felipe Coury 1badea29ab Keep agent command center rows stable across progress updates (#52946)
## Why

Progress updates change task timestamps, causing recency-based sorting to move rows within the same status group on refresh.

## What changed

Retain each task's relative order while it remains in the same status group. Append new tasks and tasks that change groups after existing rows in their destination group. Forget the order of removed tasks so rediscovered tasks behave like new arrivals.

Search and status filters preserve the retained order, and pinned tasks continue to use their explicit ordering.

## Testing

Add regression tests and a snapshot covering progress refreshes, selection stability, arrivals, status transitions (including changes caused by descendants), removal and rediscovery, filters, and pins.

GitOrigin-RevId: 54008a66de5c4cf509759e25ee8c1cb6e2a70100
2026-10-10 18:04:13 +00:00
Won Park 6c0c6759d0 Retain client-marked tool outputs across compaction (#52937)
## Why

Client-supplied tool outputs can carry task instructions. Even when marked with `retain: true`, these instructions could be trimmed before compaction and disappear from the compacted history.

## What changed

Add the disabled-by-default `retain_client_tool_outputs` feature to honor retention for explicitly marked, named `function_call_output` items without a `call_id`.

- Preserve eligible outputs in remote compaction v2 and when starting a new context window, keeping their original role.
- Stop emergency tool-output trimming at a retained output.
- Share the existing 64,000-token retention budget, keeping outputs whole and dropping an oversized output and older items rather than partially truncating it.
- Place initial context before retained standalone outputs and account for their images in retained-image counts.

## Testing

Add a scenario covering enabled and disabled retention, emergency trimming, oversized-output handling, and preservation of the latest instruction after compaction and cold resume. Verify that retention annotations stay out of model requests.

GitOrigin-RevId: 449179670e4d2be2623928700738758e43b5dc1a
2026-10-10 17:30:25 +00:00
Adam Perry @ OpenAI be9060ff96 Stabilize the realtime steering timeline test (#52923)
The initial user item seals realtime transcript segments, so starting speech before it completes can split the segment under test. Wait for its `item/completed` notification and assert that it is a `ThreadItem::UserMessage` before triggering speech, so only the steering under test can split that segment.

GitOrigin-RevId: 932443f4a0d6c4284cf95f44e64912506769a180
2026-10-10 16:52:55 +00:00
Jennifer Zhao 806d9732c9 Report exec runtime resets before accepting further requests (#52825)
## Why

Replacing a gRPC code-mode runtime loses stored values and running cells. Silently continuing after reconnection hides that loss, while prior external tool operations may already have completed.

## What changed

- Capture the runtime generation when `execute` and `wait` calls are created. If recovery replaces it, reject those calls with an explicit reset error, including concurrent calls and calls first polled after recovery.
- Explain the lost state and advise inspecting prior tool results before retrying. Allow a fresh `exec` call to continue on the replacement runtime.
- Keep `terminate` from reopening the runtime so cleanup cannot hide a reset from the next request.

## Testing

Extend gRPC recovery tests to cover reset errors after host restarts, missing sessions, and route loss, rejection of queued calls, and successful fresh execution with cleared stored state.

GitOrigin-RevId: 914cab3bb45e30a3f3b2afacb5631e42b18e21b0
2026-10-10 08:51:21 +00:00
Felipe Coury c3d3b142d1 Make pinned transcript prompts clickable (#52778)
## What changed

Clicking a pinned prompt header with an unmodified left click now scrolls the transcript to the original prompt. The click also ends text selection, cancels search, and clears activity focus. Track the prompt by entry identity so navigation remains correct when history is prepended.

## Testing

Update the prompt-header snapshot test to navigate by clicking the header after prepending history and verify that the original prompt becomes visible.

GitOrigin-RevId: dea811693853e3740909ab675b1339f701e01e02
2026-10-10 04:33:30 +00:00
Benjamin Carlsson 322bbf4d84 Classify voice session failures and record terminal outcomes (#52756)
## Why

Voice failure metrics lacked cause and lifecycle phase, and session durations were recorded before the final outcome was known. A failed control send could also overwrite a more specific WebRTC error.

## What changed

- Tag `codex.voice.session.failure` with bounded `cause` and `phase` values, recording at most one failure per session.
- Capture duration when stopping and emit `codex.voice.session.duration` at cleanup with a `success` or `failure` outcome.
- Carry typed WebRTC errors into the TUI, preserve existing errors when control sends fail, and avoid duplicate errors after startup failure.
- Record app-server disconnect failures for background voice sessions as well as the visible session.

## Testing

Add coverage for terminal outcome and failure metric attributes, preservation of specific startup and audio-session errors, and startup failures without duplicate control-channel errors.

GitOrigin-RevId: 5aeda6e766093e3fce7206560aa83b6f7770dddb
2026-10-10 02:54:59 +00:00
Channing Conger 1652992148 Make code-mode exit() stop the entire cell (#52748)
## Why

A catchable exception lets JavaScript continue after `exit()`, including in `catch`, `finally`, and queued promise callbacks. Exiting should finish the cell successfully without further output or state changes.

## What changed

- Terminate V8 execution when `exit()` is called and complete the cell even if its module promise remains pending.
- Guard host callbacks against effects after exit, including when getters or value conversion request exit.
- Preserve stored writes made before exit and suppress errors when exit occurs during exception formatting.

## Testing

Add regression tests for synchronous and asynchronous exit, timers, parallel promises, value conversion, exception getters, and resuming after a yield and tool response. Verify that only prior output and stored writes survive, and separately exercise host guards while JavaScript continues running.

GitOrigin-RevId: e9487ba65ef0358612c5009bd26953b786a12798
2026-10-10 02:14:13 +00:00
pakrym-oai 5ef96ab278 Add opt-in output token replay for OpenAI requests (#52742)
## What changed

- Add the disabled-by-default `output_token_replay` feature to request `output.encrypted_content` from OpenAI providers.
- Preserve encrypted message and tool-call output, message and function-call status, and output-text `annotations` and `logprobs` through history and replay. Update the generated protocol schemas and SDK types.
- Strip output ciphertext from requests to other providers while retaining it in stored history, including after replay is disabled. Remove encrypted content from memory extraction inputs.

## Testing

Add integration coverage for the feature/provider combinations, metadata replay across follow-up requests, and history preservation when resuming with replay disabled.

GitOrigin-RevId: 77729a021b6771933402aebe74ece8eb39c057e2
2026-10-10 01:25:00 +00:00
Alex Kira e4490eff65 Allow model catalogs to override incremental tool notices (#52736)
## What changed

Add `model_messages.tools.incremental_tools` overrides for the update hint, tool and namespace removal headers, and namespace instruction update and clearing messages. Missing, null, or over-512-byte values fall back to bundled wording; empty strings omit static text while retaining runtime names and instructions.

Substitute `{name}` in namespace message templates and append runtime instructions verbatim. Wording changes alone do not trigger tool catalog updates.

## Testing

Extend unit tests and MCP request-history snapshots to cover custom wording, empty notices, tool removal and restoration, and namespace instruction changes and clearing without repeating unchanged tools or notices.

GitOrigin-RevId: 22dea0a6fb4cfcd646f5e65346424834c8b7d5a2
2026-10-10 01:14:28 +00:00
Felipe Coury 4bad6d78e9 Report terminal program status with OSC 7501 (#52725)
## Why

Lifecycle status reporting was limited to direct iTerm2 sessions. OSC 7501 lets other terminals receive Codex's program state.

## What changed

- Emit OSC 7501 with `app=codex` and states `idle`, `working`, or `blocked` whenever stdout is a terminal, including multiplexed sessions. Report `blocked` when user action is required.
- Continue emitting iTerm2's OSC 21337 status and bounded activity details in direct iTerm2 sessions.
- Clear status before handing the terminal to an external program, as well as on suspension and exit, and re-emit the current state after returning.

## Testing

Add coverage for OSC 7501 encoding, combined iTerm2 output, clearing both protocols, and protocol selection across terminal and multiplexer environments. Update lifecycle tests and status snapshots for the new protocol.

GitOrigin-RevId: 6d2a6885687b0e7af825e954fab72db0765c9a07
2026-10-09 23:43:10 +00:00
aaronl-openai 7efd184c24 Add observers for initial exec-server connection attempts (#52724)
## What changed

Expose `Environment::observe_connection_attempts` and `ConnectionAttemptOutcome` to report elapsed time and success, failure, or cancellation for initial connections. Measure from the end of provisioning through client installation, including connection retries.

The first registered observer wins. Past attempts and reconnections are omitted.

## Testing

Extend tests to assert failure followed by success when startup is retried, and a single cancellation notification when an environment is replaced during startup.

GitOrigin-RevId: 88300f38dcf9428b824c5ff36aa1b40d7d466b6f
2026-10-09 23:28:38 +00:00
Channing Conger 2dc0791c7d Add opt-in gRPC over stdio for the code-mode host (#52723)
## What changed

- Add `grpc+stdio://` as a host transport and the disabled-by-default `code_mode_host_grpc` feature flag to select it.
- Share a lazy HTTP/2 channel and host process across code-mode sessions while keeping session state isolated.
- Use HTTP/2 keepalives to detect unresponsive hosts, kill and reap disconnected children, and spawn a fresh host on reconnect. Exit the host when its stdio connection closes.

## Testing

Add coverage for shared-host session isolation, host exit on stdin EOF, and recovery after an unresponsive host is reaped. Exercise nested tool calls with both legacy stdio and gRPC stdio, asserting that the feature flag selects the expected transport.

GitOrigin-RevId: 31389d8540de236b8e0571d3c24e29e117b75c4a
2026-10-09 23:26:34 +00:00
Eric Traut 07757f448f Explain session creation failures during server shutdown (#52721)
## Why

Graceful shutdown rejects new sessions with an invalid-request error. Give clients a structured shutdown reason and show command center users why session creation is paused.

## What changed

- Add `data: {"reason":"serverShuttingDown"}` to app-server shutdown admission errors while retaining JSON-RPC code `-32600`.
- Show a dedicated shutdown message explaining the wait for active turns and automatic reconnection for non-embedded servers. Recognize older servers by their exact draining message only when error data is absent, and preserve retained-worktree cleanup guidance.
- Keep the command center reconnect presentation when a shutdown error covers the initial overview and no conversation is open.

## Testing

Extend admission and WebSocket shutdown assertions, add embedded and daemon shutdown message snapshots, and cover reconnection with a shutdown error over the initial command center.

GitOrigin-RevId: f167144c0ddc77872afdf3daac8bb1c89f3425b4
2026-10-09 23:16:46 +00:00