Commit Graph
12297 Commits
Author SHA1 Message Date
Eric Traut 2f05c0a71f Fix daemon updater socket binding and bootstrap readiness on Unix (#53845)
## Why

The updater bound its socket directly beneath `CODEX_HOME`, which can exceed Unix socket path limits. Bootstrap could also report success before the updater's manual-update socket was ready.

## What changed

- Reuse the control socket's protected binding and cleanup guard for the updater, with a symlink at the advertised socket path.
- Remove stale updater socket entries before startup while preserving regular files.
- Wait up to 30 seconds for supported automatic updaters to publish their socket, without connecting as a readiness probe. Report updater exit or timeout with stderr log context.
- Preserve compatibility with older updaters that lack the manual-update command.

## Testing

Add Unix integration tests for updater readiness with a long `CODEX_HOME` path and bootstrap failure when a regular file blocks the updater socket, verifying that the file is preserved and the daemon remains running.

GitOrigin-RevId: 57fdcbe4e6907ece68ba66178cf81f258527560c
2026-10-14 02:51:53 +00:00
tongzhou wang 1b6e0d8145 Track content provenance through prompt assembly and compaction (#53831)
## Why

Message roles and content classifications do not identify who supplied each context part. Source attribution needs to survive prompt assembly and history truncation, including messages that combine text from different producers.

## What changed

- Add per-part `ContentItemMetadata` for user input, developer instructions, `AGENTS.md`, skills, harness context, command hooks, and tool context with optional callable namespaces.
- Carry attribution alongside content and classifications through contextual fragments, extension prompts, hook output, and agent messages. Keep tool-provided context-window hints separate from harness text.
- Preserve the source of retained text slices during compaction and attribute generated truncation notices to the harness. Default missing historical attribution to unknown.
- Attribute host MCP calls using cached tool namespaces only when catalog revisions remain stable, without starting servers or refreshing catalogs for attribution.
- Send the new metadata to Responses Lite and strip it from requests to endpoints that do not support it.

## Testing

Extend compaction tests to cover mixed sources, missing or extra metadata entries, and discarded media. Update Responses Lite request assertions to verify endpoint-specific attribution handling.

GitOrigin-RevId: b0ebc929b7c60f3ec49d1affbf897312d63edcc8
2026-10-14 02:01:49 +00:00
Eric Traut 0960e379a5 Prune unused app-server daemon releases safely (#53827)
## What changed

- Record the current and previous dedicated daemon selections in `selection-history`, bound to the selection link's identity. Preserve that history when an install leaves the selection unchanged.
- Prune unused releases after package preparation and scheduled update processing, including updates that require no restart. Retain the current and previous selections, packages used by the daemon or updater, and the calling executable's package.
- Require lifecycle and installer locks, valid selection history, and verified package boundaries before cleanup. Skip unsafe or unrecognized packages and retire releases before best-effort deletion so partial failures are not retried.
- Resolve the updater's actual executable identity after an executable handoff that preserves its PID.

## Testing

Extend coverage for stale selection history, retention of the last two selections, packages containing external symlinks, partial deletion and reinstall, cleanup without restarting the daemon, and repeated installs preserving selection history.

GitOrigin-RevId: 19a04db1cc356a2219f2afb137b9525e249ab6fb
2026-10-14 01:49:56 +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 eb1d7065f8 Support daemon installation from Windows WinGet packages (#53811)
## Why

WinGet archives place the CLI and code mode host at the package root, while daemon installation expects them under `bin/`. This layout mismatch prevents installing the daemon from a WinGet CLI package.

## What changed

Validate WinGet packages in their original layout before converting the staged copy to the daemon layout. Move the executables under `bin/`, update the package entrypoint and optional voice manifest checksum key, and hash the final tree for release reuse. Leave the source package unchanged.

## Testing

Add a Windows integration test covering daemon startup, repeated `update --from-cli --yes` calls, rewritten manifests, and rejection of an incomplete package without changing the selected release or source manifests.

GitOrigin-RevId: e78c461a557a4d005fe1f5fe37fb5ba05bb38608
2026-10-14 00:49:27 +00:00
Eric Traut ca2b076fff Add safe diagnostics to workspace routing configuration errors (#53805)
## Why

Workspace routing reported generic requirements load and reload failures, hiding the cause. Raw configuration errors can contain secrets, so exposing their messages directly is unsafe.

## What changed

Include a safe reason in configuration load and reload errors: file locations or non-file line and column numbers, cloud error categories and HTTP status codes, known network policy denials, or OS error details. Exclude raw parser messages, configuration contents, and backend-supplied policy names and IDs.

## Testing

Add regression coverage for configuration locations, cloud failures, and network policy denials. Verify that malformed local and cloud configuration reports useful errors without exposing secret values or policy identifiers, and still prevents workspace routing from falling back to startup configuration.

GitOrigin-RevId: a71484c700d32662ced9e19041dbedda5d1da8a5
2026-10-13 23:59:56 +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
rka-oai 9e03960cf8 Wire background compaction into the turn lifecycle (#53800)
## What changed

- Launch background compaction at eligible pre-turn, mid-turn, and post-turn checkpoints when `AsyncCompaction` is enabled, capturing the current world state and client routing state.
- Adopt ready results at compaction checkpoints while preserving newer messages, tool outputs, and world-state updates. Continue normally if an optional result is rejected.
- Run one foreground compaction if an adopted result still exceeds the context limit.
- Prevent cancelled turns from launching new background work while preserving already-running work for later reuse.

## Testing

Add unit and scenario coverage for stale history and account changes, cancellation, pending-result reuse and fallback, retained tool outputs, compaction event pairing, and token usage accounting. Add a context snapshot covering a collaboration-mode change while compaction runs.

GitOrigin-RevId: 04ac028d9fe2e3ea64aacaaeb351c3c776cf3940
2026-10-13 23:51:47 +00:00
jif 2b2d792305 Refresh Guardian reviews when review context changes (#53797)
## Why

Assistant messages delivered during a pending Guardian review can change its evidence. Previously, these context changes aborted the review instead of triggering a fresh assessment.

## What changed

Treat changes to local or root review context as stale authorization so Guardian retries with updated evidence. Cancellation and history resets still abort the review.

## Testing

Extend local and worker delivery tests to cover refreshed allow and deny decisions, verify that the new review includes the delivered message, and ensure commands execute exactly once after approval and never on stale approval or denial.

GitOrigin-RevId: 019205bee6d3f4e8cf6b9268f72bbc5db6b3899e
2026-10-13 23:29:53 +00:00
oli-oai 8af93416dd Use the bundled model catalog in the MCP startup invalidation test (#53795)
Set `config.model_catalog` to the bundled catalog in
`mcp_invalidation_refreshes_threads_that_are_still_starting` so model
resolution completes locally before the test waits for the startup
lifecycle hook.

GitOrigin-RevId: fd12df5140670dad4c9e2d22fabe73b0437af2b4
2026-10-13 23:08:06 +00:00
jif a373281e9e Retain rollout migration locks across worker cancellation (#53794)
## Why

Cancelling an async migration caller can leave its blocking compression or decompression worker running. Releasing migration locks before that worker finishes allows other writers or migrations to access files still being processed.

## What changed

Share maintenance, cross-process writer, and local writer locks with blocking workers during migration and recovery. Keep those locks held until file work completes, releasing cross-process locks before allowing local writers to proceed.

## Testing

Add a regression test for cancelled compression and decompression callers that verifies locks remain held until the worker finishes and the output is complete. Preserve the Unix check that decompression temporaries have owner-only permissions.

GitOrigin-RevId: 74855250d89ecab81eaadc2956e328d37b65e72e
2026-10-13 23:06:58 +00:00
ben zhang 815ef9bbc4 Fix cancellation of macOS user-verification prompts (#53790)
## Why

Keychain signing reconstructs its own authentication context, so invalidating the caller's context does not reliably cancel the context that owns the biometric prompt.

## What changed

Evaluate the stored key's access-control policy explicitly with `LAContext` before signing. On cancellation, invalidate that context and wait for its authorization callback before releasing the lifecycle lock, rejecting any late success. Reload the key with the authorized context and disable further interaction so signing cannot open another prompt.

## Testing

Update unit tests to cover waiting for cancellation completion and rejecting completed authorization after cancellation. Add an ignored macOS hardware test and setup instructions covering persisted Secure Enclave key reuse, signature verification, cancellation, retry signing, and cleanup.

GitOrigin-RevId: 4ea9756430c5649654e95e047d1666617503072c
2026-10-13 22:40:57 +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
Konstantine Kahadze b56a579fc6 Remove the product-gating TODO from SkillPolicy (#53781)
GitOrigin-RevId: 8cfd2ba212fc944d09ede97d569fea13142ba389
2026-10-13 22:07:59 +00:00
Konstantine Kahadze 8b507a8e45 Remove redundant Codex manual cache directory check (#53780)
`nearestExistingParent` already checks whether the cache path exists and is a directory. Remove the duplicate `stat` check from `usableCacheDir` in the OpenAI docs manual fetcher, retaining the existing parent lookup and write/execute permission checks.

GitOrigin-RevId: 42583353bfdd06881171d8b24fa2b2d5b6fb3135
2026-10-13 22:06:50 +00:00
Anthony Tafoya 20b4ff2f35 Enrich V2 capability discovery with resolved plugin and skill metadata (#53763)
## What changed

- Return qualified skill names such as `team:deploy` and parsed `dependencies` and `policy` instead of a separate namespace and raw metadata file. Share `agents/openai.yaml` parsing and validation between skill loaders and executor discovery.
- Include each standalone skill's search-root ID and path in `discoveryRoot`, while accepting responses from older executors that omit it.
- Add plugin `displayName`, falling back to the manifest name or installation directory.
- Materialize inline MCP declarations in `mcpConfig` with the manifest as their source path, and report incomplete discovery when declared MCP or Apps configuration files have no returned contents.

## Testing

Add coverage for JSON round trips, omitted `discoveryRoot`, optional and invalid skill metadata, qualified names, display-name fallbacks, and inline MCP configuration. Verify standalone search roots survive cached discovery and sandboxed RPC responses.

GitOrigin-RevId: 4124972444ad7c2fb8c6418acbf9a589d797fad2
2026-10-13 20:40:38 +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
Philipp Spiess 5d4922595a Prefer remote Visualize installs over the bundled plugin (#53747)
## What changed

When the remote global catalog is active, let a cached `visualize@openai-curated-remote` install supersede `visualize@openai-bundled`, matching the existing Sites behavior. A disabled remote install also suppresses the bundled plugin; a missing remote bundle preserves the bundled fallback.

## Testing

Extend the agent-turn compatibility tests to cover Visualize with enabled, disabled, and missing remote bundles, asserting which skills appear in the developer prompt.

GitOrigin-RevId: 7d0cc564189249e597d5bd29b5800353d89a9060
2026-10-13 19:28:21 +00:00
Konstantine Kahadze c12cdc924b Remove modelSlug from the latest-model resolver output (#53745)
## What changed

Update the OpenAI docs sample resolver to return only `model`, `migrationGuideUrl`, and `promptingGuideUrl`, and remove the model-to-slug conversion helper.

GitOrigin-RevId: d7cea29ff8121b1a4df3b062d54dcbed6a1589bd
2026-10-13 19:01:27 +00:00
Anthony Tafoya cf0ed4c600 Acquire and cache opt-in executor capability inventories via V2 (#53736)
## What changed

- Add the disabled-by-default `executor_capability_discovery_v2` feature to acquire `capabilities/discoverV2` inventories from supporting remote executors using each selected environment's working directory and sandbox.
- Share snapshots with MCP and world-state contributors and skill providers without activating discovered plugins or publishing discovered skills to the model.
- Cache inventories by environment instance, executor session, working directory, and sandbox. Coalesce concurrent requests, refresh the cache at turn start, retry transient failures, and refresh MCP projections after recovery.
- Resolve the system skills root in the executor and pass it explicitly to capability location discovery.

## Testing

Add coverage for feature gating, unsupported executors, inert inventories, cache reuse and eviction, turn refreshes, failure recovery, executor replacement, and system skill locations.

GitOrigin-RevId: 1bdca28fa7f17622b27e2713ab3dcc0c13426889
2026-10-13 18:15:50 +00:00
felixxia-oai 4d82d36ccf Default Guardian v2 async classification to conversation mode (#53733)
## What changed

Use `conversation` when neither a local `async_classifier_mode` override nor a model default specifies a mode. Keep `snapshot` available as an explicit override and update the configuration documentation and schema to describe the new fallback.

## Testing

Expand configuration tests to cover all local override and model default combinations. Update app-server approval tests to exercise conversation mode without an explicit override, and explicitly select snapshot mode in tests that depend on it.

GitOrigin-RevId: a62479a3f6454bf28d589373a236d8b0ab5023b9
2026-10-13 18:08:10 +00:00
Dan Gillespie efa159f7aa Reuse compiled search patterns across compressed rollouts (#53732)
## Why

Compressed rollout searches recompiled the same query patterns for every file.

## What changed

Lazily compile and reuse the JSON-escaped and content search patterns across each scan, including the fallback scan when `ripgrep` is unavailable. Keep compilation failures within the existing per-file error handling and open files before compiling patterns.

## Testing

Add regression coverage verifying that an oversized query does not fail the compressed rollout scan and that a missing file still returns `NotFound` before query compilation.

GitOrigin-RevId: 0d41cbca6e1f716fc234c268493d8dd94c34975e
2026-10-13 17:54:31 +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
Anthony Tafoya 703d253ed6 Wire V2 capability discovery through exec-server RPC (#53723)
## What changed

- Register `capabilities/discoverV2` for initialized sessions and expose it through `ExecServerClient` and remote `Environment` APIs, checking executor support before calling it.
- Reuse startup discovery locations and retry failed prewarming on demand. Replay discovery once after executor recovery while preserving the request parameters.
- Track whether all required filesystem watches registered successfully and reload locations and metadata on each request when registration fails.

## Testing

Add coverage for RPC metadata refresh, omission of skill instruction bodies, sandbox isolation, startup scan recovery, disconnect replay, and successful or failed watch registration.

GitOrigin-RevId: 726e8f7e8b4d835b877f31d1d8a9f8eea1ad9c8b
2026-10-13 17:22:34 +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
Michael Bolin 7d0b91d5d6 Separate MCP sandbox policy from launcher metadata (#53709)
## Why

MCP servers must forward sandbox policy unchanged to `codex sandbox --sandbox-state-json`, while interpreting launcher information to find the Codex CLI. Keep those contracts separate so consumers can preserve unknown policy fields.

## What changed

- Accept the experimental `codex/sandbox-state` capability alongside the deprecated `codex/sandbox-state-meta` capability, and send identical policy values under both `_meta` keys.
- Move `codexExecutable` out of the policy into `codex/sandbox-launcher`, supplied only when a verified CLI path is available for a local stdio server.
- Replace stale sandbox metadata while retaining unrelated entries, and remove stale launcher metadata when no launcher is available.
- Document the metadata contract and how servers should forward policy and retain authority for long-lived subprocesses.

## Testing

Update unit and integration coverage for policy serialization, identical state aliases, launcher availability across execution environments, and stale metadata replacement.

GitOrigin-RevId: e544c06e6e023953b1fc8069b7b1affa065262d1
2026-10-13 16:23:44 +00:00
jif cb7091b180 Preserve URLs and email addresses during external agent migration (#53706)
## Why

Rewriting source agent names and instruction filenames inside URLs and email addresses can change their destinations when importing external agent content.

## What changed

Use `linkify` to preserve recognized URLs and email addresses while rewriting surrounding text, including Markdown link labels and titles. Continue migrating instruction filename references to `AGENTS.md`, including relative links and references with line or column suffixes.

## Testing

Add rewrite coverage for URLs, email addresses, Markdown links, and surrounding Unicode text. Extend skill import and app-server configuration import tests to verify that link labels migrate while URL destinations remain unchanged.

GitOrigin-RevId: c4d210a287c99b6440438c99527364d379c568bd
2026-10-13 16:15:41 +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
felixxia-oai f6aca7dc46 Cancel Guardian V2 classifications that exceed the tool-call lag window (#53699)
## Why

Pending classifications can outlive the `max_tool_call_lag` window in which their scores are reusable, keeping metadata waits or classifier transports active after the result becomes stale.

## What changed

- Expire pending classifications when tool-call progress exceeds the configured lag allowance, preserving the wrapper discount while nested code-mode actions remain active.
- Cancel metadata waits and sampling in snapshot and conversation modes, including snapshot response drains after an early score.
- Treat expiry as supersession, preserving cached scores and the last completed conversation checkpoint and transcript cursor.

## Testing

Add regression coverage for lag boundaries, active wrapper discounts, transport cancellation before and after early scores, expired requests skipping preparation, and conversation history and transcript deltas surviving cancellation.

GitOrigin-RevId: 892ff13a05fd2b1573cef9842b934d1fc865d951
2026-10-13 15:25:12 +00:00
felixxia-oai ffc1402633 Interrupt and drain canceled classifier responses before socket reuse (#53698)
## Why

Canceled classifier requests need bounded cleanup that preserves received token usage and returns only safe WebSocket connections to the pool.

## What changed

- Own classifier response streams and connection leases together, interrupting dropped responses with a one-second cleanup deadline.
- Require a matching interruption acknowledgement and response completion before reusing a canceled response's socket. Retire sockets on rejection, invalid acknowledgements, or timeout while preserving any received completion and token usage.
- Skip requests canceled before dispatch and return their unused sockets to the pool.
- Distinguish cancellation from ordinary steering, which continues draining without requiring an interruption acknowledgement.

## Testing

Add regression coverage for cancellation, acknowledgement ordering and failures, cleanup timeouts, socket reuse, and token accounting under backpressure. Extend steering tests to cover rejected and missing acknowledgements.

GitOrigin-RevId: c4e7aac49d36cea2c2d0e9f2ba5f6147f67471dd
2026-10-13 15:24:00 +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
ioanbudea-OAI 979771476a Account for replay caches in encrypted compaction budgets (#53691)
## Why

Encrypted compaction payloads can include sampled-token replay caches that increase their size roughly threefold. Budgeting them as ordinary text can reject checkpoints that fit the model context budget.

## What changed

Use a shared estimate of one token per twelve ciphertext bytes, rounded up, for encrypted `Compaction` and `ContextCompaction` items in history and Guardian context budgeting. Guardian continues to count framing and metadata separately.

Check parent compactions against the configured token budget and a separate hard wire-size limit. Preserve the complete encrypted checkpoint when it fits. The token estimate remains a heuristic and can underestimate legacy checkpoints without replay caches.

## Testing

Add coverage for token-estimate rounding, parent compaction token and wire-size limits, and reviewer continuation with a cached compaction preserved intact.

GitOrigin-RevId: cc18ca29802491865167eef992830efcf93d97da
2026-10-13 15:05:16 +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
Keyan Zhang 044e74fef3 Preserve inherited context in prediction forks (#53678)
## Why

Prediction forks need to retain their parent's context even when it exceeds the automatic compaction threshold. Compaction or context resets can otherwise replace the history used for the prediction.

## What changed

- Apply a thread-local `AutoCompactionDisabled` policy to experimental prediction forks without changing model or skill budgets.
- Skip automatic compaction before, during, and after turns, including context-limit recovery, and suppress new token-budget reminders.
- Reject `new_context` requests for these threads and report context-limit failures without compacting their history.

## Testing

Add regression tests for legacy and paginated prediction forks across compaction thresholds, unchanged parent compaction and skill/tool inputs, context-limit failures, and rejected context resets. Add a request-history snapshot verifying inherited context and reminders survive without compaction or additional reminders after a tool call.

GitOrigin-RevId: 7df374287f4142f776981bb6c22e5caa564d74a5
2026-10-13 14:17:41 +00:00
jif 7b06e4af66 Publish Rust releases with the GitHub CLI (#53673)
## What changed

Replace `softprops/action-gh-release` in `.github/workflows/rust-release.yml` with explicit `gh` commands:

- Look up the release by tag, including drafts, and fail on API errors.
- Create stable releases as drafts until assets are uploaded. Create prereleases directly to preserve prerelease events.
- Upload sorted assets with `--clobber`, then publish the release with the configured title, notes, prerelease status, and latest status.
- Cap release notes at 124,999 characters, including a trailing newline.

GitOrigin-RevId: f343e4f265b06e047d85fe5a2b89a92690c7a7fb
2026-10-13 14:07:45 +00:00
jif 4c1cd8bbcc Keep discovered Apps tools available during startup recovery (#53672)
## Why

A transient Apps MCP startup failure can remove cached tools that the model has already discovered, preventing a later Code Mode invocation from using them.

## What changed

Keep cached Apps tools in the model's tool catalog while startup recovery runs. Let invocation readiness start or join a shared retry before acquiring the tool execution lock, while tool discovery remains nonblocking. Keep recovery running if a waiting invocation is cancelled.

## Testing

Extend connection-manager tests to cover cached tool bindings and shared recovery. Add a Code Mode regression test that discovers a cached Calendar tool, invokes it after startup fails, and verifies that it succeeds after recovery while unrelated tools remain able to execute.

GitOrigin-RevId: e888501a1050884a50a473e71b893cf6672fe256
2026-10-13 13:59:41 +00:00
jif 816fa702ec Account for token usage from incomplete responses (#53670)
## Why

Terminal `response.incomplete` errors discard reported token usage. Counting that usage as a new context baseline can also double-count input and trigger unnecessary compaction on the next turn.

## What changed

- Carry the response ID and valid reported usage with incomplete-response errors.
- Record usage for sampling and foreground compaction in cumulative totals, rollout records, budgets, and token-usage contributors without replacing the context baseline. Preserve the original terminal error, including when accounting exhausts the budget or cancellation races the error.
- Charge incomplete background compaction requests to the rollout budget without publishing foreground token usage.
- Ignore missing or malformed usage rather than estimating it.

## Testing

Extend coverage for SSE and WebSocket incomplete responses, rollout usage records, compaction accounting, deferred token-count events, and token-usage contributors. Add regressions for unnecessary compaction on the next turn and background compaction publishing foreground usage.

GitOrigin-RevId: bf1ee6df3912052ab7c19e1c6af8ad3dc4b07675
2026-10-13 13:36:24 +00:00
jif a68a7a6ab0 Improve remote exec-server test startup diagnostics (#53668)
## Why

The remote exec-server parent-lifetime test can hide an early process exit behind a connection timeout, making startup failures harder to diagnose.

## What changed

- Race the WebSocket connection against the child process exiting so startup exits are reported immediately.
- Include the registration request count and child status when attachment fails, without inspecting request headers or bodies containing authentication data.
- Enable remote exec-server info logging in the test while keeping other logs at error level.

GitOrigin-RevId: 75739fc93d7f28ba0a3f447a14d4d20b2dbdfd14
2026-10-13 13:26:19 +00:00
jif 73bbb654b3 Extract shared multi-agent v2 thread spawning (#53660)
## What changed

Move child configuration, task path construction, fork usage hints, and backend spawning into `core::thread_spawn`. Add request, result, and error types that distinguish preparation failures from backend errors.

Route the v2 `spawn_agent` handler through the shared helper while retaining tool-specific telemetry, activity events, and response formatting in the handler.

GitOrigin-RevId: a09a8f66beb41c1403220750d236a12717dbfc6c
2026-10-13 12:59:15 +00:00
jif ab82af0b2c Share hook configuration across cloned hook views (#53657)
## Why

`with_executor_hooks` clones the hook registry to create an executor-specific view. Copying the configured handlers, plugin sources, and diagnostics on every clone is unnecessary when that configuration is unchanged.

## What changed

Store hook configuration in `Arc`-backed collections and use copy-on-write when replacing executor-scoped handlers. Skip handler mutation when there are no executor hooks to add or remove.

## Testing

Extend the executor hook registration test to verify that updating a cloned engine leaves the previous engine's handlers unchanged.

GitOrigin-RevId: 6b188ca6ca21772ccd7336344d98c023f769834e
2026-10-13 12:51:12 +00:00
jif 4e7ef7d19d Keep spawned children provisional until the spawn result returns (#53654)
## Why

Cancellation after initial input admission could leave a child registered even though the spawn caller had not received its result.

## What changed

Resolve the child's status and configuration before committing reservations and releasing provisional ownership. This keeps cancellation cleanup active through the final awaits and lets the spawn result return without yielding after commitment. Cancellation after the result returns does not retract the accepted child.

## Testing

Add a regression test that cancels spawn during the final status lookup after input admission and verifies that the child is unregistered, terminated, and unloaded, and that shutdown completes. Extend the provisional-child cancellation test to cover both native V1 and V2 callers.

GitOrigin-RevId: 028b873ad4c1fac2c4b5d1dc823b4561ff19e6bf
2026-10-13 12:42:53 +00:00
swastik-oai 90f00bd89e Add an environment API key fallback for Guardian Decisions (#53633)
## What changed

Allow Guardian Decisions to use `OPENAI_API_KEY` when the default `openai` provider has no custom base URL and neither `CODEX_GUARDIAN_DECISIONS_API_KEY` nor a cached API key is available. Preserve cached API key precedence over the environment fallback.

Report missing credentials as `credentials_unavailable` instead of `provider_error` in Decisions failure metrics.

## Testing

Add tests for cached API key precedence and the environment fallback with ChatGPT authentication. Run each test in a child process to isolate environment changes.

GitOrigin-RevId: fbb772dcb9287d9e1be1b34292ad9bdffeb3d6b3
2026-10-13 10:43:13 +00:00
jif 6042ec37b0 Stabilize write ordering in the shared message board scenario (#53632)
## Why

Non-parallel tool calls can acquire their lock in either order, making the shared board scenario's `last_message_id` snapshot nondeterministic.

## What changed

Send each `collaboration.post` call in a separate mocked response to order the writes before snapshotting. Update the `board_connections` snapshot and expected request count from 15 to 17 to reflect the additional responses.

GitOrigin-RevId: a290a01f5071a2081d4d0b1531b1b31bfbb8a6e6
2026-10-13 10:42:06 +00:00
jif 86966c3230 Materialize the thread before testing a discovered daemon restart (#53631)
Empty drafts need not survive a daemon restart. Update the `discovered`
scenario in `codex-rs/cli/tests/daemon_startup.rs` to rename the thread before
restarting the daemon and include `thread-name` in the status line. Wait for
the confirmed footer name before issuing `/daemon` so the test proceeds only
after the thread is materialized.

GitOrigin-RevId: a91508582826fa1bd0cc7b89d9a1af7e8b4e1999
2026-10-13 10:32:38 +00:00
ioanbudea-OAI f5297229c1 Record truncation metrics for accepted Guardian review inputs (#53628)
## What changed

Emit `codex.guardian.review.truncation` counts and `codex.guardian.review.truncation.bytes` histograms after successful input finalization. Aggregate observations across reduction stages by component and disposition (`truncated` or `omitted`), recording original, retained, and omitted byte totals. Exclude feasibility checks and failed retries from loss telemetry.

Keep blocking command-hook cancellation fixtures in the local environment and use double quotes for the Python command.

## Testing

Add metric-export tests covering aggregation across multiple reductions, separate truncation and omission totals, no loss metrics for rejected inputs, and no duplicate reporting on repeated finalization.

GitOrigin-RevId: 69182fc7afe230be69dd2469caedb5ae4494947b
2026-10-13 10:21:42 +00:00
jif b043762f9e Preserve remote exec output until it is collected (#53622)
## Why

Remote process exit can arrive before the final output, and inherited pipes can keep the output stream open after exit. Removing the session at exit can lose output that should remain available to `write_stdin` polls.

## What changed

- Retain remote sessions with open or unread output after exit, including early exits and cancelled initial collection.
- Collect pending output when `write_stdin` races with exit, skipping stdin writes once remote exit is known.
- After initial collection finishes and the process exits, allow a five-second grace period before a final background read. Respect active polling deadlines and keep later polls available while that read recovers retained output.
- Let explicit termination stop output collection even when the process has already exited, and install the exit watcher before cancellable cleanup.

## Testing

Extend remote process event tests to cover output arriving after the initial yield, polling during a delayed final read, active polls exceeding the background grace period, resumable cancellation, and termination before the initial yield.

GitOrigin-RevId: b1671fad8b61a2cdecf7cf9fdf92e57c028c7af8
2026-10-13 09:34:17 +00:00
rka-oai 9167a0b2d4 Reuse background results for remote V2 compaction (#53620)
## What changed

- Await a compatible pending background request when foreground compaction is needed, and share the result installation path with foreground requests.
- Validate the captured history generation, prefix length, model, and authentication owner before installing a prepared result. Fall back to foreground compaction when required if the result is rejected.
- Replace only the captured history prefix, preserving later messages, retained tool outputs, goal edits, and the current world-state baseline. Record installation analytics and completion events only after a result is installed.

GitOrigin-RevId: 798963f2fc603c3febba2c21eafa1bcb094b3ebf
2026-10-13 09:18:45 +00:00