Commit Graph
3181 Commits
Author SHA1 Message Date
Ian MacLeod c22a06c180 Record bucketed terminal sizes in TUI telemetry (#53859)
## What changed

- Add `terminal_columns` and `terminal_rows` buckets to `codex.tui.start`.
- Record `codex.tui.terminal_size` for new turns in the active thread and for resize bucket changes after the terminal size settles for 15 seconds. Reuse launch context and suppress duplicate turn notifications.
- Respect analytics consent for the built-in metrics exporter while allowing explicitly configured OTLP collectors. Apply consent checks to the active exporter across provider replacements.

## Testing

Add coverage for exporter replacement and consent after config reloads. Extend the PTY integration test to verify startup size buckets, turn-start observations, and delayed resize observations with analytics disabled and an explicit OTLP collector.

GitOrigin-RevId: e01a900cd3f04a36731078f725c75374596cb01b
2026-10-14 03:52:30 +00:00
Dylan Hurd c3733756a9 Reject Guardian review threads during interactive CLI resume (#53816)
## What changed

Check the selected thread's app-server metadata before resuming it in the TUI. Reject Guardian review threads with a clear error and suggest `codex resume <parent_thread_id>` when a parent session is available. Preserve existing resume behavior if the metadata read fails.

## Testing

Add a regression test for Guardian thread rejection and the parent-session hint. Update daemon startup coverage to select a saved session when testing `resume`.

GitOrigin-RevId: 64b43bb24b5e24eec14c8204c6e15232387dade8
2026-10-14 01:07:57 +00:00
Eric Traut 923f276f57 Keep the Agent command center visible during archive and delete (#53804)
## Why

Archive and delete progress replaced the task list, hiding the selected task and surrounding context while the request was pending.

## What changed

Render progress as a centered dialog over the Agent command center. Preserve the selected task and shared scroll/filter state, and re-render the backdrop on terminal resize.

## Testing

Update narrow-terminal snapshots for both archive and delete to cover the progress overlay, task list, and selected row. Adapt the existing modal input-isolation test to supply a backdrop.

GitOrigin-RevId: e155478aeaddef189fbc53b27b8ff05d54bc3711
2026-10-13 23:58:39 +00:00
Chris Dong 6786dccbe7 Forward client voice session IDs in realtime requests (#53784)
## What changed

Add optional `voiceSessionId` to realtime start parameters and forward it as the `voice-session-id` header for WebSocket, WebRTC, and existing-call transports. Keep this client-generated voice session identifier distinct from `realtimeSessionId`, which uses `x-session-id`.

## Testing

Extend serialization tests and add coverage for distinct session ID headers, WebRTC request forwarding, and existing-call handshake forwarding.

GitOrigin-RevId: cb558dbb9d438f2d34e281199a7e81fe5d33b879
2026-10-13 22:21:31 +00:00
Felipe Coury 21c1616119 Support Command/Super shortcuts in the TUI keymap (#53754)
## What changed

- Accept `super` modifiers and normalize `cmd` and `command` aliases to `super`. Support capturing, displaying, and using these bindings in shortcuts, chords, and leaders.
- Add `super-left`, `super-right`, and `super-backspace` editor defaults for moving to the start or end of a line and deleting to its start.
- Honor safe Super-modified editor shortcuts during startup without treating them as text or inserting a pending paste newline.
- Save keymap edits through `config/value/write` when connected to a local daemon so it can validate bindings before they are saved or applied. Preserve the configuration and active keymap if the daemon rejects the edit.

## Testing

Add coverage for modifier aliases, shortcut capture and labels, chords and leaders, line editing, startup input, and daemon acceptance or rejection of keymap edits. Extend the startup PTY test with Command editing sequences.

GitOrigin-RevId: 8ed74f8253c89d423d5dfe87aa092844ce834454
2026-10-13 19:55:22 +00:00
Felipe Coury 3517671c60 Extend copy-on-select to composer text (#53753)
## What changed

Apply `tui.copy_on_select` to composer mouse selections on release, including X11 PRIMARY publication when enabled. Keep editable selections highlighted so typing can replace the selected text, even when `tui.copy_on_select_clear_selection` is enabled.

Share clipboard destination handling across the transcript, footer, and composer. Apply automatic deselection to footer selections after confirmed delivery, and release composer and footer PRIMARY ownership on focus loss or resume. Update configuration descriptions to clarify the behavior across all three surfaces.

## Testing

Add composer tests covering copy on release, retained selection highlights, replacement by typing, PRIMARY ownership lifetime, and clipboard-only status reporting for pending copies.

GitOrigin-RevId: 46999a32170149193fca561741000e97dfc458cf
2026-10-13 19:45:14 +00:00
jif e762c05bd6 Apply feature overrides when restarting the app-server daemon (#53751)
## Why

`codex app-server daemon restart` previously reused saved settings without applying feature flags supplied on the command line.

## What changed

Apply `--enable`, `--disable`, and boolean `-c features.*` overrides during an explicit restart and persist them for subsequent restarts. Accept nested `enabled` values, normalize feature aliases, and replace conflicting saved aliases while preserving unrelated settings.

Reject invalid feature toggles before stopping the daemon or saving settings.

## Testing

Add integration coverage for overrides on stopped and running daemons, alias replacement, preservation of saved settings, restarts without flags, and rejection of non-toggle keys without interrupting the running daemon.

GitOrigin-RevId: 14a657bc4758b9c248e363f9dac58f8887070a04
2026-10-13 19:36:44 +00:00
Felipe Coury 237b7d4323 Preserve the remote cwd filter in the in-app resume picker (#53728)
## Why

Opening the in-app resume picker created a new app-server session without the active session's remote working directory override, dropping the remote directory filter from the thread list.

## What changed

Pass the active session's remote working directory override to the picker session so its `thread/list` request retains the `cwd` filter.

## Testing

Add a regression test that opens the in-app picker against a recording remote server and verifies that `thread/list` includes the remote working directory in `cwd`.

GitOrigin-RevId: 0073ed77e9d9b0ffdd647fcb9f157d20ea2aa599
2026-10-13 17:41:03 +00:00
Benjamin Carlsson 72ad8747e9 Render Markdown web links as labels in Rex (#53725)
## What changed

Select label-only web link rendering when `TERM_PROGRAM` is `rex`, matched case-insensitively. Preserve the existing visible-destination fallback for multiplexers and `dumb`, `screen`, or `tmux` terminal modes.

## Testing

Add a regression test verifying that Rex renders `[label](https://example.com)` with the label-only policy.

GitOrigin-RevId: 615ca6186d84fc17cef9286e75848877b542b6ab
2026-10-13 17:30:45 +00:00
Brian Lee 6cc7d9cc5c Enable Cyber access programs for API-key sessions by default (#53717)
## What changed

- Default `features.api_key_cyber_access_programs` to `true` and allow `codex exec` to select Daybreak with an OpenAI API key. Select the advertised standard program when `daybreak=false`, while respecting explicit feature opt-outs.
- Resolve API-key eligibility for TUI background turns from the target thread's feature settings, including project opt-outs. Omit access-program overrides when the server cannot report those settings.
- Preserve automatic server treatment for unlisted models and missing or empty Cyber program metadata in exec and TUI. Continue rejecting Daybreak when a nonempty program list does not offer it.

## Testing

Update regression coverage for API-key Daybreak selection, the off override, explicit opt-outs, resumed sessions, target-thread settings, and missing model metadata.

GitOrigin-RevId: f3cf7bd95a2754d4b4281bc70b18c7da4b177552
2026-10-13 16:57:54 +00:00
Brian Lee 6fbfc352ca Enable CLI Daybreak by default and enforce background-turn eligibility (#53701)
## What changed

- Mark `cli_daybreak` as stable and enable it by default.
- Apply Daybreak to background turns only for eligible OpenAI accounts, allowing API-key accounts when `api_key_cyber_access_programs` is enabled. Preserve saved settings for ineligible accounts and report account lookup failures when Daybreak is enabled for the OpenAI provider.
- Skip inheriting Daybreak configuration when the app server does not support reading effective configuration.

## Testing

Expand dynamic-tool request tests to cover the feature toggle, ChatGPT and API-key authentication, API-key program eligibility, and unsupported configuration reads.

GitOrigin-RevId: 55a57315c9f527f977dd8305ea62d4096ed7dae9
2026-10-13 15:33:50 +00:00
Felipe Coury 31434401fa Add keyboard selection support to the transcript view (#53693)
## What changed

Add transcript select-mode state with an underlined cursor, grapheme-aware movement via arrow keys or `h`/`j`/`k`/`l`, and vertical movement that preserves the preferred display column. Support marking with `v`, Space, or Shift-arrow keys and copying through the existing selection machinery.

Keep the displayed transcript snapshot and reading position paused during selection and after exiting the mode. Add entry and exit methods; this change does not yet bind mode entry to a user-facing key.

## Testing

Add unit tests for initial cursor placement, movement across empty lines and entry boundaries, wrapped text, preferred-column preservation, and Enter behavior with and without a marked range.

GitOrigin-RevId: e5bc380ea0eb6e2c6157ba73ac063d548a7de145
2026-10-13 15:11:10 +00:00
Brian Lee c03bbff483 Constrain API-key model access programs to server support (#53689)
## Why

Servers can advertise cyber access programs without accepting them for API-key accounts. The TUI must account for server support before exposing those programs.

## What changed

- Check `features.api_key_cyber_access_programs` at startup and when loading models for API-key accounts, clearing `available_access_programs` when forwarding is unavailable.
- Use thread-scoped feature settings after thread creation and honor feature requirements and CLI overrides at startup.
- Refresh account-scoped models when switching to or from API-key authentication or changing API-key thread context, clearing cached access programs while the refresh is pending.

## Testing

Extend session tests to cover enabled and disabled server settings, CLI overrides, and catalog filtering before and after thread creation. Update account-change tests to handle the model refresh.

GitOrigin-RevId: c80de30a0063b84949098d137715d8678bd70587
2026-10-13 15:03:34 +00:00
Benjamin Carlsson f82e365922 Deduplicate TUI modifier handling and terminal color caching (#53556)
## What changed

- Reuse `custom_terminal::ModifierDiff` when writing history spans.
- Share the terminal default-color probe and cache implementation between Unix and Windows.

Both changes remove duplicate implementations while preserving existing behavior.

GitOrigin-RevId: 35f8d77ade972b791c6beac0678d2fe2be3aa763
2026-10-13 04:42:04 +00:00
Felipe Coury 92caad7828 Preserve pending Effects toggles across save refreshes (#53496)
## Why

Saving an Effects preference refreshes the picker. When users toggle repeatedly before saves finish, that refresh can discard newer choices and cause subsequent toggles to use stale values.

## What changed

- Update Effects checkboxes immediately and track pending saves per row, preserving newer choices when an earlier save takes effect.
- Preserve pending Composer stars choices while Animations disables the row, and clear pending state on a regular panel refresh.
- Use the shared list toggle handling for Effects, including Space support, while giving configured key bindings precedence over Space toggling.

## Testing

Add regression tests for repeated toggles across save refreshes, pending Composer stars choices while disabled, clearing pending state, and a Space cancel binding taking precedence over toggling. Update the Effects picker snapshot.

GitOrigin-RevId: 847dcc2dfd40448c7adc56c8c40879db28b1fc39
2026-10-12 22:44:06 +00:00
Eric Traut 0c329ad2c9 Prefer the Windows clipboard and bound copy attempts on WSL (#53453)
## Why

WSLg clipboard initialization can block indefinitely, and PowerShell clipboard writes can stall while receiving input or exiting. These stalls can prevent subsequent TUI copy requests from completing.

## What changed

- Try the Windows clipboard first for `/copy` and `Ctrl+O` on WSL, falling back to the native clipboard and terminal delivery when needed.
- Give Windows executable discovery and writing a shared five-second deadline, with a separate one-second deadline for native clipboard setup. Reuse pending setup tasks after timeouts to avoid accumulating blocked threads.
- Launch PowerShell through a native shell and stop its process group on write failures or timeouts. Reap the writer before returning so an older copy cannot overwrite a newer one, and suppress stderr that could expose clipboard contents.

## Testing

Add tests for command compatibility, large Unicode input, expired requests, and cleanup of stalled writers and subprocesses. Update routing tests to cover Windows-first copying and native fallback with HTML and clipboard leases.

GitOrigin-RevId: 218c8541a169a16536db0370455e076a31a42b1f
2026-10-12 19:02:36 +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
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
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
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 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 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
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
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
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
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
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
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
Won Park 45311351c2 Add opt-in retention for turn tool outputs (#52686)
## What changed

Add an optional `retain` flag to `TurnToolOutput` for `turn/start`. When set to `true`, pass the output to the core with a retention annotation to request retention in the thread's model history. The flag defaults to `false`, preserving existing behavior.

Update the generated JSON schemas, TypeScript types, and Python bindings to expose the flag.

## Testing

Add an integration test verifying that a retained tool output reaches the model and preserves client-authored sender metadata in persisted history, including the receiver message ID.

GitOrigin-RevId: 52893a8fcb308f26e77ba8f0bee9990073b26d54
2026-10-09 20:02:18 +00:00
Eric Traut d3f9b22b74 Limit daemon feature compatibility checks to explicit CLI overrides (#52648)
## Why

A running shared background server owns its feature settings until it restarts. Differences from a client's configuration files or defaults should not trigger a compatibility warning or a restart request.

## What changed

- Check shared-service features only when explicitly overridden on the command line.
- Exclude overrides superseded by active legacy managed configuration or feature requirements, while supporting older servers without `configRequirements/read`.
- Pass only the remaining explicit feature overrides to a requested daemon restart.

## Testing

Update compatibility tests for stale daemon overrides, explicit enable/disable requests, managed configuration, and older servers. Extend CLI startup tests to verify the feature overrides persisted after a restart.

GitOrigin-RevId: ac92c9c02cd70fa233203ebef1182fd119325dd1
2026-10-09 17:15:58 +00:00
jif 9a59289fbe Fix races in remote environment and session replacement tests (#52591)
## Why

The remote environment test can steer before the wait tool call is recorded, discarding the call. The session replacement test can close the client while agents overview RPCs are still pending, leaving the proxy writing to a closed socket.

## What changed

- Wait for the `wait-for-active-environment` function call event before steering the active turn.
- Wait for `AgentsOverviewThreadsLoaded` before shutting down session replacement test cases that open the agents overview.

GitOrigin-RevId: 886112a56ff6e1016efe30dbbd0256807bc1cc85
2026-10-09 14:21:14 +00:00
Felipe Coury 5fe4fc8f7c Forward clipboard copies to the terminal in Herdr sessions (#52557)
## Why

Herdr sessions can gain attached clients after Codex starts. Successful native clipboard copying should still forward the text to the attached terminal, even without inherited SSH variables.

## What changed

Detect Herdr sessions with `HERDR_ENV=1` and enable terminal forwarding for `/copy` and `Ctrl+O` even when native copying succeeds. Use OSC 52 directly when outside tmux, while preserving the native copy result.

## Testing

Add a routing test verifying that a Herdr session copies natively before sending OSC 52 and retains the successful native clipboard lease.

GitOrigin-RevId: c43c08ca037ff51e902267dc8636889493f5c30c
2026-10-09 12:24:07 +00:00
Benjamin Carlsson 2351d9e1b6 Avoid an extra blank quote line when pasting text with a trailing newline (#52418)
## Why

Pasting text ending in a newline into a composer line beginning with `> ` adds an unnecessary empty quoted line before the next Markdown block.

## What changed

Remove one trailing newline from nonempty blockquote paste content before adding quote prefixes. Preserve interior blank lines and the two unquoted newlines that move the cursor to the next block.

## Testing

Add a trailing-newline regression case, update the CRLF/CR expectations, and exercise trailing-newline input in the existing rendering snapshot test.

GitOrigin-RevId: 2367efa8253dd0512de8ba6333b39eba6381fba8
2026-10-09 05:12:54 +00:00
Brent Traut 82883da25e Notify subscribers when thread read state changes (#52384)
## What changed

Add the experimental `thread/readState/changed` notification with `threadId` and the committed `readState` receipt. Send it to existing thread subscribers when terminal activity updates read state or a revert clears a removed unread position. Emit terminal read-state updates before `turn/completed` so completion remains the last notification for that result.

Expose the notification in generated JSON schemas, TypeScript types, and Python SDK models. Document experimental capability gating, subscription lifetime, notification opt-out, and refreshing receipts when concurrent responses disagree.

## Testing

Extend the read-state integration test to assert that the notification receipt matches the receipt returned by `thread/read` after terminal activity.

GitOrigin-RevId: 28935352a881b7a5e2e7f629173c3b2061bd7941
2026-10-09 02:59:21 +00:00
Brent Traut 0ada5d8806 Expose experimental durable thread read state in the app server (#52350)
## What changed

- Add experimental `readState` to `thread/read` and a thread-ID-keyed `readStates` map to `thread/list` for eligible durable local user threads. Each receipt contains `firstUnread` and an opaque `revision`.
- Publish new visible terminal results before `turn/completed`, after flushing the rollout. Reading snapshots leaves activity unread; replayed history does not publish new activity.
- Clear unread positions removed by a paginated thread revert while preserving explicit thread-start marks and concurrent receipt updates.

## Testing

Add an integration test covering completed-turn receipts, repeated reads without acknowledgement, matching list receipts, and revert cleanup with a changed revision.

GitOrigin-RevId: e7f6ddfbb1fc2fa95d1ef2876d7f0f7b9f99ff65
2026-10-09 01:22:30 +00:00
Benjamin Carlsson 22ebb0fb17 Clamp wrapped source ranges before remapping terminal hyperlinks (#52330)
## Why

Wrapping can retain a cursor sentinel one byte past the end of the input. Using that range to slice source text during hyperlink remapping can panic.

## What changed

Clamp wrapped range boundaries to the input length before calculating hyperlink columns and recording logical source ranges, keeping both aligned with the visible text.

## Testing

Add a regression test that extends a wrapped range past the input boundary and verifies that the line, hyperlinks, and logical source are preserved.

GitOrigin-RevId: c83c817df8d3ea790f7d126768092ae317ff9217
2026-10-09 00:04:15 +00:00
Felipe Coury a3f3b44cd8 Add configurable persistent leader shortcuts to the TUI (#52273)
## What changed

- Add `tui.keymap.global.leader`, defaulting to `ctrl-x`, and symbolic bindings such as `leader c` that follow the configured prefix. The default prefix yields to existing custom shortcuts and chord prefixes.
- Keep leader shortcut hints open until completion or cancellation, while ordinary chords retain their one-second timeout. Pressing `esc` or repeating the leader cancels the pending shortcut.
- Add leader configuration and a `Use leader...` capture option to `/keymap`, with resolved shortcut labels and conflict validation.
- Cancel pending chords when input targets change, on paste or focus loss, and on mouse actions other than movement.
- Move the default voice mute shortcut from `ctrl-x` to `f9` and update its tests and displayed hints.

GitOrigin-RevId: 35b964cccd2812c73200f0c26b0f19506821df92
2026-10-08 21:01:06 +00:00
Felipe Coury 39f4277087 Enable text selection in the fullscreen TUI footer (#52270)
## What changed

Allow mouse selection and plain-text copying of rendered status and footer text, honoring `tui.copy_on_select` and existing selection keyboard controls. Keep the selected region stable while other content updates, preserve Unicode and terminal hyperlinks, and clear selections when their region becomes invalid.

Defer warning clicks until a stationary mouse release so dragging selects text without opening the warning viewer. Preserve the composer draft and cursor while selecting footer text.

## Testing

Add unit and snapshot coverage for visible-text copying, Unicode and hyperlinks, selection invalidation, keyboard ownership, and stationary clicks versus drags. Add a fullscreen integration test for warning selection and draft preservation.

GitOrigin-RevId: dd14d7ede52e97e507be24c4d6ac0299f7388a9b
2026-10-08 20:49:14 +00:00