Commit Graph
1196 Commits
Author SHA1 Message Date
jif a5484adce0 Resolve approval reviewers from destination thread settings (#65237)
## Why

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

## What changed

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

## Testing

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

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

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

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

## Testing

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

GitOrigin-RevId: fd05687accddb8a3ab99df0486b93f3f595fef65
2026-12-02 11:38:20 +00:00
Charlie Weems 1805912776 Add a configurable maximum width for TUI conversations (#65216)
## Why

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

## What changed

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

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

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

## Testing

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

GitOrigin-RevId: 91e1856776986fee3b540247c3fbfe5f083b297f
2026-12-02 10:19:11 +00:00
Eric Traut aa433cb350 Show staged changes in /diff (#65211)
## Why

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

## What changed

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

## Testing

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

GitOrigin-RevId: 2cb032d7766caf313363eb4c330abb3f6a95f017
2026-12-02 09:55:35 +00:00
alexsong-oai 986dc881be Expose gateway spend in app-server account rate limits (#65193)
## Why

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

## What changed

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

## Testing

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

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

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

## What changed

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

## Testing

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

GitOrigin-RevId: 603efe7aa37e510dacf91b58487a94469c7f183d
2026-12-02 07:29:37 +00:00
Felipe Coury 0d17a47212 Support Unicode characters in TUI keybindings (#65176)
## Why

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

## What changed

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

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

## Testing

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

GitOrigin-RevId: 8624218efcba2784f19f502770523fe00c6f1af1
2026-12-02 06:30:47 +00:00
Dylan Hurd 350d8a47c4 Stream provisional text from thread/sample (#65167)
## Why

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

## What changed

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

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

## Testing

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

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

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

## What changed

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

## Testing

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

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

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

## What changed

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

## Testing

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

GitOrigin-RevId: bf5efba2de295f3665c883a95fd511089eee2aba
2026-12-02 03:58:37 +00:00
Benjamin Carlsson ed3ccd4c21 Scope TUI reconnect recovery to the affected backend (#65154)
## Why

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

## What changed

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

## Testing

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

GitOrigin-RevId: fc932b0d13fd1cf04404bd5ccfce71ff776e259f
2026-12-02 03:33:04 +00:00
Ian MacLeod 4487f68480 Show task-opening progress inline in the Codex TUI (#65126)
## Why

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

## What changed

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

## Testing

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

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

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

## What changed

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

## Testing

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

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

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

## What changed

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

## Testing

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

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

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

GitOrigin-RevId: 7285acfe6d8911da806adbba7da8b79393389b08
2026-12-01 23:13:10 +00:00
Eric Traut 75c48af16f Support --search with the shared background server (#65103)
## Why

Launching Codex with `--search` forced the TUI into embedded mode, even when the shared background server was available.

## What changed

Treat `--search` as a per-thread request for live web search. Check daemon eligibility before applying the flag, and restore the launch setting when reconnecting to an unloaded conversation or reopening an unloaded saved side chat.

## Testing

Cover daemon startup with `--search` and verify that a conversation retains its history and search behavior across a daemon restart. Check that worktree launches honor the flag per invocation and that reattaching to an already loaded side chat leaves its search settings intact.

GitOrigin-RevId: 9d15ec3d103383d80442e07845442341f6da6727
2026-12-01 23:03:41 +00:00
Eric Traut 6801507507 Preserve --add-dir when starting local TUI threads (#65087)
## Why

Selecting a permission profile for a new local thread could drop directories
explicitly supplied with `--add-dir`. Starting a thread in a different
directory could also lose those additions.

## What changed

Carry explicit additions into local thread starts. When a permission profile
is selected, send the working directory and the explicit additions as
runtime workspace roots. Require the app server to confirm each added
directory before accepting the thread. Decode local workspace roots as
native paths so tabs and newlines in directory names survive.

## Testing

Extend tests for startup, managed worktree creation, and permission-profile
selection. Cover an added directory with a tab in its name on Unix and the
error for an unconfirmed directory.

GitOrigin-RevId: 97beb528aa396b97d6d0ad664fde8abe3b9e2bbf
2026-12-01 21:18:55 +00:00
Eric Traut 1e832a92c2 Fix granular approval defaults at projectless TUI startup (#65086)
## Why

An `approval_policy` in the client's config could suppress the granular
default when starting a projectless session with server-owned defaults.

## What changed

Make the granular default available at startup so the launch code can
apply it when the invocation leaves the policy unset and the server
allows it.

## Testing

Extend the server-defaults startup test to set the client's policy to
`never` and verify that `thread/start` still requests granular approval.

GitOrigin-RevId: 770aa978e2372e1e30fe778b670ea25f9c3c1cd0
2026-12-01 21:01:05 +00:00
Eric Traut be972c162c Preserve the thread's selected workspace when the TUI starts a turn (#65084)
## Why

Another client can change a thread's workspace after startup. When the
TUI sends its local working directory with the next prompt, it can reset
the thread's selected environments before the TUI receives the update.

## What changed

Omit `cwd` and `runtimeWorkspaceRoots` from TUI `turn/start` requests
for both regular prompts and misalignment continuations so the turn
uses the thread's current workspace.

## Testing

Add a regression test that changes the thread's workspace before the
TUI receives the update and checks that the first prompt sent to the
model includes the newly selected working directory.

GitOrigin-RevId: b5cc23bce787f91058ede6aa7ee825e0e7a9518c
2026-12-01 20:47:55 +00:00
Felipe Coury 10cab5fad3 Keep the TUI responsive during WSL image paste (#65083)
## Why

A slow or stalled Windows clipboard helper can block the TUI while it
reads a pasted image.

## What changed

Read and stage clipboard images on a background worker in WSL. Give each
paste a five-second deadline and stop and reap the PowerShell helper if
the read is cancelled or times out.

Keep the draft editable while the paste is pending. Insert the image at
the original cursor or selection, preserve later edits outside that
range, and cancel the paste if an edit overlaps the range or the draft
is no longer current. Block submission while the paste is pending and
show a reminder to review the draft before sending.

## Testing

Add regression tests for insertion after continued typing, submission
blocking, stale completions, temporary file cleanup, and timeouts.
Cover helper cleanup after cancellation or timeout and rejection of
oversized clipboard output.

GitOrigin-RevId: d7b1d520b242244f9749f02e9d62a57d17821340
2026-12-01 20:45:18 +00:00
Felipe Coury eb79af452e Load TUI image previews in the background and downscale large JPEGs (#65079)
## Why

Composer thumbnails and transcript tool previews read and decoded files
during rendering. A JPEG whose decoded pixels exceeded the 32 MiB
allocation budget could lose its preview even when the encoded file fit
within the file size limit.

## What changed

- Load visible composer thumbnails and transcript previews on background
  workers and request a redraw when the result is ready. Reuse prepared
  tool previews when the viewport changes size.
- Share the sidebar's scaled JPEG fallback with composer and transcript
  previews. Preserve the oriented source aspect ratio and enforce the
  encoded file size limit separately from the decode budget.
- Check that the owning thread has a local workspace before reading an
  inspected image. Generated artifacts can still load from the daemon host.

## Testing

Cover large JPEG previews in the composer and transcript, thumbnail
refresh after an attachment is replaced, text fallback for oversized
PNGs, and an inspected path shared by local and remote workspaces.

GitOrigin-RevId: f2c8948a9abaa2527932423224b6ebeda3e122ae
2026-12-01 20:29:37 +00:00
Benjamin Carlsson 854e723882 Add --cloud to launch interactive Codex sessions on Cloud (#65063)
## What changed

- Select the Codex Cloud backend at startup with `codex --cloud`,
  `codex agents --cloud`, or `codex resume --cloud`.
- Use `--env <ENV_ID>` to select a saved Cloud environment for new
  threads. Resume by picker, most recent session, ID, or name using the
  thread's saved environment and model.
- Reject local execution overrides and managed execution requirements
  that Cloud cannot enforce. Recheck managed requirements for the
  ChatGPT workspace selected when connecting.

## Testing

Cover initial prompt delivery, resume by ID and name, and rejection of
unsupported settings, including managed execution requirements from a
workspace selected after startup configuration was loaded.

GitOrigin-RevId: 6144decb9679f903607a586466cff37e402ab4a4
2026-12-01 19:17:41 +00:00
Eric Traut e14750e0b9 Preserve the exit summary when Ctrl+C is pressed again on Windows (#65038)
## Why

Once the TUI restores the terminal, another Ctrl+C becomes a Windows
console event and can terminate Codex before it prints the exit summary,
including the resume hint when available. The npm launcher can also
force-terminate the child by forwarding a Ctrl+C that Windows already
delivered to it.

## What changed

Register a Windows Ctrl+C listener before restoring the terminal and keep
it alive until the CLI or standalone TUI finishes printing the exit
summary. Skip forwarding `SIGINT` from the npm launcher on Windows.

## Testing

Add a Windows regression test that simulates `SIGINT` in the npm launcher
and checks that the child can finish and report its own exit code.

GitOrigin-RevId: cd73a4a2ecc22812bc301787e67c349f7720a93b
2026-12-01 17:07:18 +00:00
Benjamin Carlsson 949cdb56ef Rank TUI slash commands by recent usage (#65034)
## Why

The slash menu uses a fixed order within each match tier, so frequently used commands can stay buried among equally good matches.

## What changed

Rank commands within each match tier by frequency over the last 50 dispatches, keeping the existing order for ties. Count `/quit` toward `/exit` and `/btw` toward `/side`. Store slash command usage locally in `slash_command_usage.json`, separate from `$` picker history, when history persistence is enabled.

If `/exit`, `/quit`, or `/logout` ranks first, require its full name or explicit menu navigation before Enter can run it.

## Testing

Cover ranking after queued and disconnected dispatches, exact-match priority, persistence after widget handoff, and explicit selection of shutdown commands.

GitOrigin-RevId: 152f2b642dcac1ece9c3347eb4541d03fc3a425c
2026-12-01 16:52:56 +00:00
Benjamin Carlsson 5c865592f4 Remember the TUI's Cloud environment choice per project (#65033)
## Why

Selecting a saved Cloud environment for a draft did not set a default
for future conversations in the same project.

## What changed

- Save the environment selected for a Cloud draft in the local user
  configuration under `tui.default_cloud_environments`, keyed by project
  and local user identity. Selecting Default clears the preference.
- Reuse the preference at startup, when creating a new Cloud conversation,
  and when switching to Cloud. Use the normal Cloud environment selection
  when the saved environment is absent from the catalog or the catalog
  cannot be loaded.
- Use the v2 environment catalog, filter for eligible saved environments,
  and deduplicate entries across personal and workspace results.

## Testing

Cover preference persistence and clearing, project scoping, reuse after a
config reload, fallback when the catalog is unavailable, and catalog
pagination, filtering, and deduplication.

GitOrigin-RevId: bc4f66842c5c83dc75c5b10840fd596feedd44df
2026-12-01 16:51:26 +00:00
Felipe Coury dcafb4c96f Honor the session directory when resuming after /cd (#65030)
## Why

Changing directories with `/cd` could force in-app resume to use the current
directory even when the saved preference was to use the session's directory.

## What changed

Use the `/cd` directory for the remembered Current choice. Explicit CLI and
remote directory overrides still select Current. If reloading configuration
fails, reuse the existing configuration only when it already belongs to the
resume directory.

## Testing

Update the in-app resume and agents overview cold-resume tests to cover using
the session directory after `/cd`.

GitOrigin-RevId: d87bc2ba96f7ca10d6fd0d5ec0414712d44238e6
2026-12-01 16:41:22 +00:00
Felipe Coury eb1c5108a3 Reject oversized remote sidebar file previews before reading (#65022)
## Why

A remote preview can exceed the WebSocket client's 128 MiB message limit
once the file is base64-encoded and wrapped in a JSON-RPC response.

## What changed

Check the file size with `fs/getMetadata` before calling `fs/readFile` for
remote previews. Allow for base64 expansion and reserve room for the
JSON-RPC envelope. If the reported size exceeds that budget, show a
preview error with the file's size.

Continue with the read if the server lacks `fs/getMetadata` or omits
`sizeBytes`. Apply the sidebar's existing path error handling to metadata
failures as well as read failures.

## Testing

Extend the remote preview test to cover an image at the size limit,
oversized image and text files, and both metadata compatibility fallbacks.

GitOrigin-RevId: a284b3b76d9c56fe7e80445d880ccc17d575681c
2026-12-01 16:07:34 +00:00
Dylan Hurd 187affbce3 Wait for the Command Center grouping header in the startup test (#65004)
## Why

Startup can send a `thread/list` request while the loading screen is still
visible. Reading the terminal buffer at that point can make the saved
grouping test fail before the Command Center header has rendered.

## What changed

Capture completed terminal frames through a test-only channel. Have
`agents_overview_startup_restores_saved_grouping` wait for the grouping
header and verify that it shows `Group: Status`, the saved preference.

GitOrigin-RevId: e4479039e0663483016637be0fe5bfff62f27044
2026-12-01 14:58:43 +00:00
Benjamin Carlsson 1ba4c7b4fb Recover Cloud sessions with paginated TUI history (#64932)
## Why

A Cloud session can have more history than the TUI scans on reconnect.
Requiring the full transcript prevents recovery even when the recent
history is enough to verify where the session left off.

## What changed

Allow recovery from a bounded history window in owned transcript mode
when it confirms the required turns and updates. Preserve completed
local history outside that window and keep older history pageable
without rendering prompts or replies twice.

Bound turn metadata lookups, including across turns without items.
Sample partial history again before restoring queued question answers
so a response from another client has another chance to appear.

## Testing

Extend reconnect tests to cover partial and overlapping history,
missing live updates, duplicate-free pagination, bounded metadata
lookups, and queued question answers.

GitOrigin-RevId: 2f12d64dc83a6e7e42ee3923baaea40ca7f663ab
2026-12-01 05:32:15 +00:00
Benjamin Carlsson 0ee8daa550 Discover local and cloud tasks together in the agents overview (#64930)
## Why

The agents overview could miss cloud tasks when opened from a local
session, even when the cloud backend was already connected.

## What changed

- Refresh tasks from connected backends when opening the overview, and
  have **Show more** fetch additional pages from each backend that has
  more results.
- Preserve pagination progress across refreshes when it still applies,
  and keep refresh errors visible until the affected backend recovers.

## Testing

Add coverage for discovering and paging through cloud tasks from a local
session, reopening the overview with pagination progress intact, and
refreshing after lifecycle events from a background backend. Add a
snapshot of the mixed local and cloud overview.

GitOrigin-RevId: 11d3108dbbd8c7033cd8fe43cfd045fb3eacccd4
2026-12-01 05:20:42 +00:00
Eric Traut 3496c2f99c Prompt before replacing an existing transcript export (#64822)
## Why

When a filename is already taken, saving a conversation with `/export` ends
with an error. Users have to restart the export to choose a different name.

## What changed

Show a conflict picker with options to choose another name, replace the
existing file, or cancel. Choosing another name pre-fills an editable
numbered filename, such as `notes-3.md` when `notes.md` and `notes-2.md`
already exist.

Offer replacement only for regular files. After confirmation, check the
directory and file identities and use an atomic rename to install the new
transcript.

## Testing

Cover the picker actions and numbered filename suggestion, verify that
replacement requires confirmation, and check that replacement rejects a
changed file or redirected directory.

GitOrigin-RevId: edcb2fad858bab15a7228c69bd27a8ffd18e8d05
2026-11-30 22:40:58 +00:00
Eric Traut debcc79621 Use destination app-server defaults for new TUI sessions (#64821)
## Why

A fresh session could send client-side execution settings as thread
overrides, even when the destination app server had its own defaults.
The TUI also needs the destination settings when preparing the first turn.

## What changed

Use the destination defaults to prepare the first turn for session
replacement, starts from the agents overview, and backend switches.
Keep explicit launch choices and managed new-thread defaults in the
start request, and let the server resolve its own model and reasoning
effort. When `config/read` is unavailable, omit implicit execution
overrides and avoid replacing server instructions with terminal
visualization text alone.

## Testing

Extend session replacement tests to check the start request and first
turn, including shadowed launch settings, server instructions with
terminal visualization enabled, and compatibility with older servers.

GitOrigin-RevId: d66d6d51495ee067282514a138f7e39abfd91f2f
2026-11-30 22:39:43 +00:00
Eric Traut 5eb0253e6f Preserve service tier intent when starting, resuming, and forking (#64820)
## Why

A TUI resume request could override a thread's saved service tier with a
configured tier, a model default, or the local Fast default opt-out.
CLI forks could also send a tier before the destination's settings were
resolved.

## What changed

- Send a tier on resume or CLI fork only when the invocation supplies a
  tier override. In-app forks carry the current session's tier.
- On fresh startup, use the invocation's tier choice first, then the
  managed default, then the startup configuration. Keep an explicit
  reset (`serviceTier: null`) distinct from omitting the field.
- Use the current local Fast default opt-out when resolving tiers for
  new sessions and honor feature gating for launch overrides.

## Testing

Extend request assertions to cover tier omission on resume and CLI fork,
`flex` on in-app fork, and both explicit reset and disabled Fast mode on
fresh startup.

GitOrigin-RevId: d74f0f5e98506a0d5a6ead7106e1042691d41d41
2026-11-30 22:25:03 +00:00
Eric Traut 4e6aae20fa Keep TUI launch model overrides independent (#64819)
## Why

Resuming with only a model or reasoning-effort override could also
send the other value from the TUI's resolved config, overriding saved
thread settings. Startup forks could similarly carry an unrelated
default into the destination.

## What changed

Build thread requests from explicit launch overrides. Resolve model
and reasoning effort independently from invocation options and the
selected profile, honoring config precedence. On resume, omit unset
fields so the app server can restore saved values. On startup fork,
let the destination config supply unset fields.

Carry accepted model migrations into resume requests and apply managed
new-thread model defaults on fresh starts without a launch model or
effort choice.

## Testing

Extend resume coverage for model-only and effort-only requests and for
a launch effort shadowed by higher-priority managed config.

GitOrigin-RevId: 5190d9b820a36c4da6a179fbdbca27591b1e8541
2026-11-30 22:08:33 +00:00
Felipe Coury 8fe2646705 Enable mouse-wheel scrolling in the Agent command center (#64808)
## Why

The mouse wheel scrolls the help view, but browsing a long task list
requires keyboard navigation. Once the list can scroll independently of
the selection, task shortcuts need to account for an offscreen target.

## What changed

Scroll the task list without moving the selection, and keep task titles
reachable in short viewports. When the selection is offscreen, show a
reveal hint and make the first task shortcut bring the selection back
into view. Keyboard navigation resumes following the selection.

Suppress repeats from the key that revealed the task so holding a
shortcut such as Stop cannot immediately act on it. On Windows, peek at
queued console input to account for press/release pairs emitted by
legacy ConPTY input.

## Testing

Cover wheel paging and short viewports with a rendering snapshot, test
that Stop requires a fresh press after revealing a hidden selection,
and verify that the Windows release probe leaves queued input intact.

GitOrigin-RevId: ebd7c0993978de3fc07245adf930f9fc63b306c1
2026-11-30 21:19:57 +00:00
Felipe Coury 8860825f86 Make agent center help scrollable and status tabs clickable (#64807)
## Why

Short terminals can cut off agent center shortcuts and require a resize to
read them. Status filter tabs and their overflow arrows are visible but
require keyboard navigation.

## What changed

- Scroll help with the configured list navigation keys or mouse wheel.
  Show a scroll hint when help extends beyond the viewport.
- Click a status tab to filter tasks, or click an overflow arrow to
  select the adjacent hidden tab. Overflow arrows also work in Analytics.
- Display `/` as the primary search shortcut and retain `F3` as a binding.

## Testing

Extend regression tests for help scrolling, task paging after resizing
in help, and mouse clicks on filter tabs and overflow arrows.

GitOrigin-RevId: b01b465626a681ca48a6e20547a24cf715a9a406
2026-11-30 21:02:08 +00:00
Felipe Coury da92371925 Use an in-memory clipboard in TUI tests (#64797)
## Why

TUI copy tests can verify the text sent to the clipboard and `PRIMARY`
without depending on the host clipboard or waiting for a background worker.

## What changed

Give each test TUI its own in-memory clipboard and `PRIMARY` selection.
Handle requests inline and expose completions through the normal worker
polling path.

## Testing

Assert copied text in transcript, sidebar preview, and turn tip tests.
Verify that a second TUI's copy leaves the first TUI's Markdown clipboard
text and plain-text `PRIMARY` selection available for paste.

GitOrigin-RevId: 159845b17f0dac26b4b12c3851c101afe8d21d2d
2026-11-30 19:37:56 +00:00
Felipe Coury f92681791d Open /status in an interactive TUI modal (#64772)
## Why

Rate limits and thread usage can arrive after `/status` is displayed.
Updating a status card already in terminal scrollback required rewriting
history and depended on where the card was rendered.

## What changed

- Show the report in a scrollable modal with Overview, Configuration, and
  Session tabs. Apply rate limit and thread usage results to the open report
  without writing status output to the transcript or terminal scrollback.
- Copy a selected field or the full report directly from the modal, and open
  usage settings from the same view. Remove status fields from the `/copy`
  picker.

## Testing

Add coverage for overlapping refreshes, dismissal during account or thread
changes, keyboard navigation and copying during an active turn, and scrolling
in a narrow terminal.

GitOrigin-RevId: 64961c4d013607e373d50a79182b74e3048c632f
2026-11-30 17:40:02 +00:00
Benjamin Carlsson f7184ab849 Recover cloud conversation history on idle TUI reconnect (#64770)
## Why

Reattaching a cloud reply stream after a disconnect can leave gaps in
the transcript. Queued follow-ups also need to wait until the TUI has
caught up and knows whether a turn is already running.

## What changed

- Automatically resume eligible idle cloud conversations with history
  recovery. Replay missed items and repair partial replies in place while
  preserving the draft and native terminal scrollback.
- Hold queued follow-ups until the reattached stream has delivered its
  pending events and any active turn has settled.
- Reconcile queued async question answers against recovered history.
  Drop answers already recorded and return unresolved unsent answers
  to the composer for review.

## Testing

Add regression coverage for transcript repair, scrollback preservation,
queued input during catch-up, and async question answer recovery.

GitOrigin-RevId: 3378479ff886204cdc473a701ef51b3fc8b6b5c0
2026-11-30 17:27:17 +00:00
Benjamin Carlsson ed33bb35af Enable /archive in TUI side chats (#64767)
## Why

Side chats disabled `/archive`, so users couldn't archive the current
side chat from the composer while the sidebar was hidden.

## What changed

Show a confirmation in the composer even when the sidebar is hidden.
Warn about stopping a running turn, discarding unsent input, or losing
temporary chat history when applicable.

On confirmation, return focus to the parent chat's composer. Archive
saved side chats and remove them from Side chats. Close temporary side
chats and discard their history after cleanup succeeds.

## Testing

Cover saved side-chat archiving, including retry after a failed archive,
and verify that a temporary side chat stays accessible with its queued
input when cleanup fails.

GitOrigin-RevId: 1bbe25a241719cdc2722bc8db915dea9111b6fc9
2026-11-30 17:14:19 +00:00
Felipe Coury 3506461cf4 Separate TUI transcript rendering from input handling (#64765)
## What changed

Let the transcript reader paint into a caller-provided frame and area,
returning the delay for the next search or history-loading frame. Split
event preparation, including clipboard completions and selection ticks,
from input dispatch so the app can refresh visible rows before handling
selection input.

Extract transcript reader construction and centralize the app's overlay
input checks. Route draft snapshot flushing through `ChatWidget`.

GitOrigin-RevId: c5e093f585e264c4ffea51ebfcff0b08a1c3ff93
2026-11-30 17:00:53 +00:00
Eric Traut f62d4836b8 Avoid unnecessary TUI redraws on terminal focus changes (#64752)
## Why

Switching away from an idle composer can write to the terminal even when
there are no animations to clear. Regaining focus already triggers a draw.

## What changed

On focus loss, request a redraw when composer sparkles are visible or
when an active empty-state replay is canceled.

## Testing

Add a PTY regression test that checks for zero terminal output after idle
focus loss and verifies that input is accepted immediately after focus
returns, in both inline and fullscreen modes.

GitOrigin-RevId: c961a4274049b98fff7307092f6ac89d51cf8e95
2026-11-30 16:25:43 +00:00
Eric Traut ba431841b4 Load TUI client preferences from configuration layers (#64650)
## Why

TUI preferences belong to the client. Building test settings from resolved
session fields can mask which preferences startup and reloads actually read.

## What changed

Remove the conversion from core `Config` to `LocalSettings`. Have TUI test
fixtures read preferences from the configuration layers or reuse existing
`LocalSettings`, and set runtime overrides directly on those settings.

## Testing

Update the startup test to verify that the saved agents overview grouping wins
when the resolved core field specifies a different grouping.

GitOrigin-RevId: 99a4ef475d1679e8f9ef1a870635631cad76ae40
2026-11-30 00:39:15 +00:00
Eric Traut b2d7473520 Reload TUI preferences from configuration layers (#64645)
## What changed

Reload `LocalSettings` from the effective configuration layers while
preserving the active transcript and alternate-screen modes. Reuse the
prepared settings after folder trust changes and when starting a session
from the agents overview.

Pass `LocalSettings` directly to working-directory prompts, hook review,
and history loading. Initial history loading uses a bounded item budget
when local settings are unavailable.

## Testing

Update the reload test to verify that layered preferences are applied
while the active screen modes are preserved. Check the initial history
budget when local settings are absent.

GitOrigin-RevId: e02736b7bb29e00ddfd791afa778fc0d958d358a
2026-11-29 23:28:54 +00:00
Eric Traut 16022fda85 Carry local TUI settings through startup (#64643)
## What changed

Pass layer-derived `LocalSettings` through the startup draft, onboarding,
session pickers, and app launch. Refresh those settings when startup reloads
configuration, including after a resume or fork selection or picker
cancellation.

Use the local settings for rendering and screen selection, then update them
to reflect the terminal's actual alternate-screen and transcript modes.

GitOrigin-RevId: 89fcaa0c05c68e55d7de6e0052c38a48d6842d7b
2026-11-29 23:14:56 +00:00
Charlie Marsh dfd76bb740 Filter MCP server status tools by connector ID (#64527)
## Why

A single MCP server such as `codex_apps` can expose tools from multiple
connectors. Clients that need one connector's tools currently have to
filter the server's tool inventory themselves.

## What changed

Add an optional `connectorId` parameter to `mcpServerStatus/list`. It
keeps only tools whose `_meta.connector_id` or `_meta.connectorId`
exactly matches the requested string. Servers with no matching tools
still appear with an empty `tools` map and their status. Omit the
filter or pass `null` to return all tools, and repeat the filter on
each page when paginating.

## Testing

Add integration coverage for standalone and thread-scoped requests,
including both metadata spellings, an unknown connector ID, and an
omitted filter.

GitOrigin-RevId: d6ad367dff72002b239db7b5012145ba1811ccac
2026-11-29 01:29:23 +00:00
Felipe Coury 717dbefdb9 Fit the Agent Command Center grouping header to the panel (#64411)
## Why

The full header can clip the current grouping and its shortcut in
narrow panels.

## What changed

Use shorter header labels as space runs out and show just the grouping
in the narrowest layout. Account for the longest grouping name and the
configured shortcut when choosing a layout so the title stays stable
as users cycle groupings or move focus. Show the shortcut when it is
available and fits.

## Testing

Add snapshot coverage for Directory grouping with a custom `f11 g`
shortcut at 24, 36, and 60 columns.

GitOrigin-RevId: 9d4efe8d483d9431ff75c163a1a0ce96b7886894
2026-11-28 02:07:41 +00:00
Eric Traut d2be907d4d Show confirmed thread permissions in TUI status (#64396)
## Why

The TUI used its local configuration to report permissions and approvals.
Pending profile selections could make those values differ from the
settings confirmed for the displayed thread. Legacy sandbox policies
can also hide restrictions of named profiles.

## What changed

- Use the displayed thread's confirmed permissions and approval settings
  in `/status`, the built-in status line, and status line provider data.
  Show unknown values in the UI when the thread has no confirmed settings.
- For named custom profiles, show the profile name and approval mode in
  `/status`, including workspace roots where applicable.
- Omit ambiguous enforcement from provider data unless the embedded app
  server can resolve it. Report confirmed approval settings independently.

## Testing

Add regression coverage for switching threads, retaining confirmed
settings after a rejected profile selection, and resolving enforcement
for a full-disk profile with networking disabled.

GitOrigin-RevId: f7b6c005d640ae9ede4bd132090b835ca6b7ea1f
2026-11-27 23:37:54 +00:00
Eric Traut 8cd512c85f Track server-confirmed thread permissions in the TUI (#64393)
## Why

Embedded sessions can use a local execution profile that differs from
the sandbox policy reported by the app server. The TUI needs a
server-confirmed snapshot for permission displays.

## What changed

Capture the server-reported sandbox profile, active profile, approval
settings, working directory, and workspace roots when a thread starts,
resumes, forks, or receives a live settings update. Restore the snapshot
from cached sessions and preserve it during transcript replay. Leave the
snapshot unset when session settings are inferred.

## Testing

Extend tests to cover differing server and local profiles, workspace
roots from live settings updates, and snapshot preservation during
transcript replay.

GitOrigin-RevId: 525fdfa1b526f5d799bca01c955ac7cfc3e60774
2026-11-27 22:52:25 +00:00
Eric Traut e2e7dabd45 Clean up unused TUI image paste files on exit (#64382)
## Why

Pasting an image or an image file path could leave a temporary copy on disk
even if the image never reached the app server. Drafts still need those
copies during the session, and saved turns can reference them after exit.

## What changed

Track pasted-image copies for the lifetime of the TUI session, including
across backend switches and reconnects. Delete the remaining tracked copies
on exit. Preserve copies when a turn is admitted or when a lost response
leaves admission uncertain.

Check model support before writing a clipboard image for an ordinary
composer paste. In WSL, read PNG bytes from PowerShell's standard output
so the fallback uses the same cleanup path.

## Testing

Extend paste tests to verify that a copied image survives changes to the
source file and a change of event sender, and that cleanup removes the
copy while preserving the source. Verify that queueing a submission still
leaves the copy eligible for cleanup.

GitOrigin-RevId: 36d51af242901306be0ff319949d26a01ca71200
2026-11-27 20:36:59 +00:00