Commit Graph
12239 Commits
Author SHA1 Message Date
felixxia-oai 8094365e6a Stabilize the Guardian network review timeout test (#54082)
## Why

Advancing the test clock expires the review, but command cancellation and output drainage still run asynchronously. The model can poll before the final timeout failure is available.

## What changed

Hold the initial tool result until the command emits `ExecCommandEnd`, with a bounded wait that also catches unexpected approval requests or turn completion. Only request a poll when the initial result reports a running process, and accept the timeout output from either `exec_command` or `write_stdin`.

Keep the assertions that the model receives the timeout explanation without a user approval prompt or a misleading user-rejection message.

GitOrigin-RevId: 219a1579dce35caf8f0d45b1d92a7343ec1a8935
2026-10-14 20:06:28 +00:00
Benjamin Carlsson 01ff831ce9 Centralize vertical navigation in TUI list views (#54081)
## What changed

Add `ListKeymap::vertical_action_for` and `ScrollState::apply_vertical_action` to share key resolution, selection movement, and visibility handling across the experimental features, hooks, memories, skills, and multi-select views. Preserve navigation priority, search input handling, and item reordering precedence.

## Testing

Update scroll-state tests to exercise the shared action handler and picker tests to navigate through key events. Cover overlapping page-down and move-left bindings when item reordering is disabled.

GitOrigin-RevId: 29927b0a4de0fbeb4c0dd19c418b8f60fffb8a7d
2026-10-14 20:05:29 +00:00
Benjamin Carlsson 57b5e89be8 Extract TUI user-turn submission into a dedicated module (#54080)
## What changed

Move `AppCommand::UserTurn` handling from `thread_routing.rs` into
`user_turn_submission.rs`. Keep turn creation, permission resolution, and
active-turn steering behavior together, preserving retry and queueing behavior.

GitOrigin-RevId: b4f798cf20a4609d959f4d9b19447ba3c4baba0a
2026-10-14 20:01:55 +00:00
Matthew Zeng 4ae6016a93 Retire rejected MCP OAuth refresh tokens (#54079)
## Why

Coordinated MCP OAuth refresh must stop retrying a definitively rejected refresh token, including after the runtime is rebuilt.

## What changed

Remove the rejected refresh token while preserving the access token and credential record. Compare stored credentials under the appropriate locks before writing so a replacement login is preserved, and update file entries using their existing keys.

Keep rejection handling alive through caller cancellation and prevent reuse within the runtime even if persistence fails. For ordinary direct-keyring credentials shared across `CODEX_HOME` directories, retire the token only in the current runtime because locking does not span those directories. Report persistence failures without exposing backend diagnostics.

## Testing

Add coverage for reauthentication after runtime rebuild, legacy file keys, cancellation with a concurrent credential replacement, keyring scope, and persistence failures with diagnostic redaction.

GitOrigin-RevId: a6e602ca2e2893ed711d853becc45142d9575fab
2026-10-14 20:00:52 +00:00
jif 71923ba305 Update gix to 0.89.0 and gix-url to 0.40.0 (#54078)
Refresh the Cargo and Bazel lockfiles for the updated dependencies.

GitOrigin-RevId: aedf8dc910d03bd0b170177afb5fa5afc86d27db
2026-10-14 19:53:12 +00:00
jif 80b88a700e Avoid false URL-launch detections in literal PowerShell commands (#54076)
## Why

PowerShell safety checks can mistake a literal `start` argument for a URL-launch command, or combine a process launch with a URL from a separate command.

## What changed

Classify independently parsed literal PowerShell commands separately so commands such as `Write-Output start 'https://example.com'` do not trigger URL-launch checks. Retain conservative checks for pipelines, script state, executable strings, and shell or terminal wrappers, while continuing to detect actual URL launches and destructive commands.

## Testing

Add policy regression coverage for literal arguments, separate commands, URL launches, wrappers, and destructive commands, plus a Windows integration test covering execution and policy rejection.

GitOrigin-RevId: 2878aa86bc36b44c60230cc1de3430922b28b81a
2026-10-14 19:47:50 +00:00
smurching-oai ae11049397 Expose gateway authentication as a reusable OAuth session API (#54070)
## What changed

Rename the grant manager and supporting modules in `codex-rs/login` to expose `OAuthSessionManager`, its configuration and status types, `OAuthLoginControl`, and `subscribe_oauth_session_status`.

Keep the existing gateway API names as compatibility aliases and retain the credential storage paths and namespace so saved credentials remain usable. Update the existing authentication tests to use the OAuth session API.

GitOrigin-RevId: 72cea12be606dde28cf42809e7f8b8807cbc4a2a
2026-10-14 19:07:44 +00:00
iceweasel-oai 0fd85b0752 Fix Windows environment handling for remote MCP servers (#54069)
## Why

Remote MCP environment filtering could drop `SystemDrive` and `LocalAppData`. Explicit overrides also need Windows-aware merging to replace inherited variables with differently cased names.

## What changed

- Preserve `SYSTEMDRIVE` and `LOCALAPPDATA` when remote environment variables activate the allowlist.
- Apply explicit environment overrides through the executor environment policy, while retaining the final overlay for variables excluded by the allowlist.

## Testing

Extend environment-policy tests to cover the additional Windows variables, overrides with differently cased names, and the final overlay used by older executors.

GitOrigin-RevId: 36df69117f248536e47cf7e1d855b99a138fe698
2026-10-14 18:56:46 +00:00
ben zhang 9d3ae38e13 Limit unarchive scans to the requested thread's archived rollouts (#54060)
## Why

Unarchiving a thread previously read rollout metadata across both active and archived history, including unrelated threads.

## What changed

Use `RolloutReferenceIndex::scan_archived_threads` to restrict discovery to archived files whose canonical filenames match the requested thread. Continue validating ownership through session metadata and include compressed and reverted rollouts.

## Testing

Add coverage for compressed and replacement archived rollouts, metadata ownership mismatches, unrelated filenames, and exclusion of active rollouts.

GitOrigin-RevId: 8784f3502b839dcb4a3839744010e350d0196545
2026-10-14 18:19:02 +00:00
Owen Lin b7ba02f880 Support store-owned preparation when resuming threads (#54059)
## Why

Thread stores need a way to reuse history and writer state loaded while preparing a resume, rather than loading them again during session startup.

## What changed

- Add an opaque, single-use `ThreadStoreResumePreparation` and an optional preparation in `StartThreadOptions`.
- Pass preparation through session startup to `ThreadStore::resume_thread_with_preparation`, which defaults to an unsupported-operation error.
- Reject preparation for ephemeral threads or threads without resumed history. Continue using `resume_thread` when no preparation is supplied.

## Testing

Add a regression test verifying that supplied preparation selects the prepared store path and propagates its unsupported-operation error instead of falling back to ordinary resume.

GitOrigin-RevId: 26537d9b83443bd56341d6afc713f32b999dc67c
2026-10-14 18:02:25 +00:00
duc-openai 9e7b2a577f Forward turn metadata to image generation and edit requests (#54058)
## Why

Native extensions need configured Responses metadata for request attribution, but extension calls used the MCP metadata template, which omits it. Image requests also did not forward the turn metadata to the backend.

## What changed

Use the Responses metadata template for native extension calls while continuing to exclude tool inventory. Forward the resulting metadata in the `x-codex-turn-metadata` header on image generation and edit requests.

## Testing

Extend metadata tests to cover configured values in extension calls and app-server tests to verify `display_name` and `turn_trigger` on image generation and edit requests, including a Unicode display name.

GitOrigin-RevId: a2ffaa4d15259c662917612391b8717ee34b9c6c
2026-10-14 18:01:54 +00:00
swastik-oai 1f7fe9b0af Distinguish unsupported evidence in Decisions comparison metrics (#54057)
## Why

Unsupported evidence currently shares a single Decisions comparison reason, making it difficult to distinguish why a comparison was skipped.

## What changed

Report separate reasons for unsupported developer messages, other non-user messages, trusted skills, images, and audio. Keep these outcomes classified as `skipped` and retain the generic reason for other unsupported evidence. Expose `TrustedSkills::KIND` for identifying trusted skill fragments.

## Testing

Expand adapter tests for the distinct rejection reasons and add a lifecycle case verifying that trusted skill evidence skips the Decisions request, reports `trusted_skills`, and preserves the baseline score.

GitOrigin-RevId: 98f076d1aa6771d0209e7f5910eed0dcc40c6263
2026-10-14 17:57:29 +00:00
jif 80ad49e3b7 Coalesce overlapping native TLS root certificate loads (#54056)
## Why

Concurrent TLS client builds can independently load the same platform trust store. Share overlapping loads while preserving fresh trust reads for later builds.

## What changed

- Share one in-flight native root load without reusing completed loads.
- Bypass sharing when `SSL_CERT_FILE` or `SSL_CERT_DIR` is set, and continue reading custom CA bundles independently for every build.

## Testing

Add tests for overlapping loads, fresh trust after completion, and recovery from a panicking loader. Extend TLS handshake coverage to verify that replacing a custom CA file affects new configurations while existing configurations retain their trust, and that empty or removed files produce errors.

GitOrigin-RevId: 1465ef3faf82f53651d9dbfe314341b17346580b
2026-10-14 17:56:24 +00:00
marksteinbrick-oai 2b21129c6b Add Responses API client metadata patches for turn start and steer (#54053)
## Why

Clients need a way to update individual turn metadata entries without replacing the existing client metadata map.

## What changed

Add the experimental `responsesapiClientMetadataPatch` field to `turn/start` and `turn/steer`. Patches add or overwrite entries while retaining other keys and apply after `responsesapiClientMetadata` when both are supplied. The existing field retains replacement semantics, including clearing unprotected entries with an empty map.

Continue protecting reserved metadata keys and preserving targeted `misalignment_override` continuations across updates.

## Testing

Extend the app-server metadata integration test to cover replacement and patch steering, patch precedence at turn start, preservation of unrelated entries during patches, and protection of targeted continuations.

GitOrigin-RevId: 8c4da3ba1b87329da20b5295846bdcf3a88126de
2026-10-14 17:39:43 +00:00
Eric Traut 9671d20fc8 Scope TUI skill refreshes and workspace commands to explicit directories (#54050)
## Why

A queued skill refresh can outlive the workspace it was requested for when the working directory changes.

## What changed

- Refresh skills for the current working directory when the skills management popup closes.
- Ignore queued `ListSkills` commands whose directories do not include the current working directory.
- Require an explicit working directory when constructing `WorkspaceCommand` and always pass it to app-server command execution. Update Git and GitHub metadata probes to use the constructor.

## Testing

Extend regression tests to verify that closing skill management refreshes the configured working directory and that stale skill refreshes after a directory change do not issue a `skills/list` request.

GitOrigin-RevId: 47ad1d95930840b3f6f0e20d7d8fe8d025e789e6
2026-10-14 17:36:18 +00:00
Eric Traut 534c70863c Defer folder trust checks until starting a task from agents overview (#54048)
## Why

The Agent Command Center does not open a workspace, so viewing it should not require consent for the launch directory.

## What changed

Skip startup folder consent when opening the agents overview, while preserving initialization for the embedded fallback. Check folder trust before starting the first task, including through `/new` after dismissing the overview. On Windows, retain the sandbox setup prompt after folder trust is granted.

## Testing

Add CLI tests for starting a task from an untrusted folder through the overview and through `/new` after dismissing it. A terminal snapshot verifies that the overview appears before folder consent.

GitOrigin-RevId: 129be14a354b8abde2e8430c81599e2064ccac87
2026-10-14 17:35:13 +00:00
Eric Traut 764a70fc11 Restore elapsed time for replayed in-progress turns (#54047)
## Why

Replaying an in-progress turn reset the TUI's `Working` timer to zero, hiding time already spent on the turn.

## What changed

Initialize the status timer from the turn's `started_at` timestamp when replaying turns or turn-start notifications. Keep the zero-time fallback when the timestamp is missing, and clamp future timestamps to zero elapsed time.

## Testing

Extend history replay tests to verify elapsed time for both thread snapshots and replayed in-progress turns, and normalize the timer in rendering snapshots.

GitOrigin-RevId: 36a48f43d0d7aa530f1bfe6dbefa9f0885cbd6c7
2026-10-14 17:34:44 +00:00
vkg-oai 3ee99cde70 Track approval cancellation sources and Guardian context changes (#54046)
## What changed

- Preserve approval resolution sources through tool errors and tag cancelled MCP approvals with `error_type=approval`, `error_code=cancelled`, and `approval_source` (`guardian`, `user`, `hook`, or `unknown`). The source identifies the reviewer, not who caused cancellation.
- Record `context_changed` when validating a Guardian allow against changed authorization or review context, even when a concurrent stop or history reset determines the outcome. Retain the flag across retries and fresh-checkpoint recovery, and include it in the Guardian review counter.

GitOrigin-RevId: a19a986a7565f9a78a9bb2eaabdb5651834d28b8
2026-10-14 17:33:28 +00:00
Felipe Coury cec8c6fb87 Keep fork lineage ahead of paginated transcript history (#54044)
## Why

Loading older history could place transcript entries before the `Thread forked from` notice, separating fork lineage from the session header.

## What changed

Treat fork lineage as a session prefix in both the TUI transcript and transcript overlay so older pages are inserted after it.

## Testing

Add regression tests for repeated history prepends in both paths, verifying that fork lineage stays first.

GitOrigin-RevId: 71497fb7ffa992c72ee08617d318aa3119e71275
2026-10-14 17:25:26 +00:00
jif 5388581653 Return async Guardian approvals before review cleanup finishes (#54039)
## Why

An asynchronous approval currently waits for the redundant synchronous review to finish cancellation cleanup before returning a decision.

## What changed

Cancel the redundant review and let it drain under the parent's `ReviewerTasks` tracker so a current approval can return immediately. Revalidate the approval and check cancellation before approving the action. Hosts without a task tracker continue to wait for cleanup.

Keep the reviewer reservation held until cleanup completes, and let shutdown join the tracked attempt. Discard late results and evidence from the cancelled review.

## Testing

Add tests covering current, invalidated, and cancelled approvals while cleanup is blocked, suppression of late evidence, reviewer reservations during cleanup, and shutdown waiting for abandoned attempts.

GitOrigin-RevId: f227738e545243f99c19a6c557a78d330f9d2767
2026-10-14 17:10:30 +00:00
josh-oai c0cfbfbb98 Extend memory extension resource retention to 14 days (#54033)
## What changed

Increase memory extension resource retention from 7 to 14 days before pruning.

## Testing

Update pruning and startup test fixtures for the 14-day retention window, including resources at the exact cutoff.

GitOrigin-RevId: 5044a1262c8806245d90d567cd84b21aa0d3da43
2026-10-14 16:53:24 +00:00
Yuzhu Shen 8cbce63387 Bound concurrent Git diffs for untracked files (#54032)
## Why

Collecting a diff previously launched a Git process for every untracked file at once, allowing process counts to grow with the number of files.

## What changed

Limit untracked-file diffs to eight concurrent operations per collection while preserving patch order and skipping failed file diffs. Concurrent collections each retain their own limit.

## Testing

Add tests for independent concurrency limits, failed-file handling, and patch order and application with tracked changes, binary files, and filenames containing spaces or a leading dash.

GitOrigin-RevId: 896e896eae62ba9b7acf3e8946c235fe725ced40
2026-10-14 16:48:00 +00:00
iceweasel-oai 81aee8c86b Preserve Windows startup variables and MXC child environment defaults (#54027)
## Why

Windows MXC needs valid host startup variables, while an empty child environment must remain empty for the SDK to select Windows user-profile defaults.

## What changed

- Replace caller overrides of `SystemDrive` and `LOCALAPPDATA` case-insensitively with nonempty Unicode host values, failing before launch if either is unavailable.
- Track whether the original child environment was empty, ignoring launcher transport keys. Supply host `SystemRoot` for launcher bootstrap in that case, then clear the bootstrap environment before the SDK selects defaults.

## Testing

Extend transport tests to cover host-value replacement and preservation of empty child environments. Strengthen the PowerShell fallback RPC test to require `SystemDrive`, `LOCALAPPDATA`, `USERPROFILE`, and `PATH` in the child.

GitOrigin-RevId: a097e1079069ef897ebb5ba5e63546328c5faeaa
2026-10-14 16:31:06 +00:00
jif 76ed3b484d Fix session lookup and resume after rollout compression (#54008)
## Why

Compression replaces `.jsonl` rollout files with `.jsonl.zst` files, so checking only the original path can skip existing sessions. Compression can also replace a file between path lookup and canonicalization.

## What changed

- Resolve compressed rollout alternatives when selecting the latest local session.
- Retry rollout path resolution when files disappear during lookup or canonicalization.

## Testing

Extend coverage to verify latest-session filtering after startup compression and resuming a compressed rollout through its original relative `.jsonl` path with preserved turns.

GitOrigin-RevId: a4d5c399567ab4c7cd8aaa8b5f38821ee8b8d802
2026-10-14 15:22:02 +00:00
jif 0c02887a0c Include compressed rollouts in doctor storage statistics (#54003)
## Why

Doctor's rollout statistics only counted `.jsonl` files, omitting storage used by compressed `.jsonl.zst` rollouts.

## What changed

Recognize compressed rollouts when collecting active and archived file counts, total bytes, and average bytes. Count both physical files when plain and compressed representations coexist, while continuing to ignore unrelated files and compression temporary files.

## Testing

Extend the rollout statistics test to cover nested plain and compressed files, coexisting representations, archived compressed rollouts, and ignored files, with a snapshot of the reported counts and sizes.

GitOrigin-RevId: 46197f9741884668b50fb6a1d0a07060020f12ed
2026-10-14 14:56:51 +00:00
bbrown-oai c6327eba6a Filter rollout filenames before checking compressed siblings (#53997)
## Why

Filesystem lookups by thread or rollout ID check whether unrelated compressed rollouts have an uncompressed sibling. These checks are unnecessary when the filename does not match the requested ID.

## What changed

Apply the thread or rollout ID filter before resolving plain/compressed file precedence. Preserve preference for uncompressed files and selection of the newest rollout for a thread.

## Testing

Extend lookup tests to cover unrelated compressed files, uncompressed-file precedence, missing rollout IDs, and rollout ID tie-breaking for files with the same timestamp.

GitOrigin-RevId: 5bdb56ebec8031fceb5f6adbfcf644ad010e52f2
2026-10-14 14:35:58 +00:00
jif-oai 954750be9c Bump rustls to 0.23.46 (#53996)
GitOrigin-RevId: 08c39511bd3afc32072b731802e2370f535cc87b
2026-10-14 14:26:25 +00:00
tejsudha-openai f87ba04ec3 Report the reason for ChatGPT token refresh requests (#53991)
## What changed

Include a `refresh_reason` diagnostic in ChatGPT OAuth token refresh requests to distinguish `proactive_expiry`, `scheduled`, `unauthorized_recovery`, and `forced` refreshes. Omit the field for gateway refresh requests.

## Testing

Extend refresh tests to check the reported reasons, including scheduled refreshes when access token expiry is unavailable.

GitOrigin-RevId: b0294a61ffc3089a66e7b132d4f45661a9e18d38
2026-10-14 14:14:09 +00:00
jif 0b73618146 Keep host MCP and plugin configuration local with remote environments (#53990)
## Why

A remote primary environment could supply its working directory and workspace roots to host plugins and MCP processes, breaking relative MCP executable resolution and applying the wrong workspace permissions.

## What changed

- Build host configuration from the local environment, falling back to the session's host working directory and runtime workspace roots when no local environment is selected. Preserve explicitly empty local roots.
- Use the same host configuration for MCP startup and refresh, and refresh MCP state when runtime workspace roots change.
- Keep repository skill discovery paired with the primary executor's working directory and filesystem.
- Box skill warmup and turn context construction futures to reduce enclosing future sizes.

## Testing

Extend the MCP integration test to cover a remote primary with populated, empty, or absent local roots; relative executable resolution before and after refresh; workspace-root revocation; and remote repository skill discovery.

GitOrigin-RevId: 21a73c90507b55fd94261e7bf348695ff8466a24
2026-10-14 14:08:26 +00:00
jif 835cd7552d Skip service backoff for stale Guardian authorization retries (#53987)
## Why

Stale authorization requires refreshing local evidence, so service retry backoff unnecessarily delays the next review attempt.

## What changed

Yield cooperatively before retrying `StaleAuthorization`, then check cancellation and the shared deadline. Keep retries within the existing attempt budget.

## Testing

Extend paused-time tests to cover recovery with fresh evidence and exhaustion of the shared attempt budget, asserting that retries incur no backoff and return the final attempt's evidence.

GitOrigin-RevId: fda7ddd040a761d08883740bb5e7aaecacfa6091
2026-10-14 13:55:47 +00:00
jif 7a08c5f627 Avoid reconnect races in the daemon restart test (#53969)
## Why

PTY reads can split a redraw while the reconnect notice is temporarily erased. The test can then submit `/status` before reconnection finishes, when Enter is suppressed.

## What changed

Make the `discovered` daemon startup test inspect only completed synchronized terminal updates. Type `/status` separately from Enter and wait for its command popup before submitting. Gate both inputs on a replacement daemon PID and the absence of the reconnect notice.

GitOrigin-RevId: a99af0f26753d81458dbce2c30ecc120ff78d3f4
2026-10-14 12:29:42 +00:00
jif 0d58012ec2 Test memory extraction budgets with excluded items and ciphertext (#53963)
Extend phase-one request tests for both memory versions with reasoning,
developer messages, and assistant ciphertext whose combined size exceeds
the reader budget while individual records remain below the record limit.
Verify that earlier extraction evidence and assistant text alongside large
ciphertext remain in the request, with `encrypted_content` excluded.

GitOrigin-RevId: f0e85e368e5a94d491d0aa4ae1688f47d873ccd9
2026-10-14 12:07:20 +00:00
jif 78dc250384 Stop rollout reads when the calling task is cancelled (#53947)
## Why

Blocking rollout reads can continue decompressing and scanning history after the calling async task is dropped.

## What changed

Propagate caller cancellation through rollout readers, prefix validation, model-context scans, history materialization, and working-directory lookup. Check cancellation during compressed input and output, bounded reads, seeks, and between history records. Return an error on cancellation so partial history cannot be mistaken for a complete read.

## Testing

Add regression coverage for dropping a caller during decompression, cancelling compressed input and output (including skippable frames), cancelling reads and seeks on plain and decoded snapshots, and cancelling history materialization between records.

GitOrigin-RevId: e3dac952789b53402f2a5f17c2a2232506feb9d6
2026-10-14 10:46:14 +00:00
jif 5670b1c18e Bound rollout input for memory extraction (#53940)
## What changed

Read rollout evidence from newest to oldest for both memory versions, retaining up to 8 MiB of sanitized response items and inter-agent communications, then restore chronological order. Skip malformed records and records larger than 1 MiB, and require valid session metadata in the first record within that limit.

## Testing

Add coverage for the retained byte budget, newest-record ordering, malformed and oversized records, and unsupported session metadata. Extend extraction request tests for both memory versions to verify that evidence after an oversized record reaches the model.

GitOrigin-RevId: 55ccbc2477ecb059830d3a55be12bcbc21235303
2026-10-14 10:19:14 +00:00
jif 400f2356d6 Preserve conversation history when compaction fails (#53932)
## Why

Compaction could record partial output before the response completed, leaving failed summaries in conversation history and persisted rollouts.

## What changed

Buffer compaction output until `response.completed` so failed or incomplete attempts leave no partial output in history. Record successful output before the response completion notification, preserving its compaction metadata.

## Testing

Add regression coverage for preserving messages, tool results, and token usage after a disconnected compaction stream, including after restart. Verify incomplete compaction output is excluded from subsequent requests and successful output remains observable and persisted.

GitOrigin-RevId: 8651200b2aae616000c55c1ed63283f3e2c1b8d5
2026-10-14 09:44:24 +00:00
Eric Traut 95273b84fb Keep the agent dashboard browsable during task removal (#53908)
## Why

Archiving or deleting a task blocked dashboard navigation until the server request finished.

## What changed

Keep the dashboard interactive for browsing while archive and delete requests are pending. Hide the affected task immediately and show an inline progress message. Allow selection movement and search while preventing task switching, new tasks, and leaving the dashboard until the request completes.

Preserve the dashboard selection when removing the current task detaches the session.

## Testing

Update archive and delete progress tests and snapshots to cover navigation, resize handling, immediate task hiding, and suppression of task switching and creation while requests are pending.

GitOrigin-RevId: ff6555602bcd84d38e00de55c3032f442589fdcb
2026-10-14 08:05:19 +00:00
Eric Traut 97771b1d78 Isolate daemon package tests to reduce disk contention (#53897)
## Why

Daemon package tests copy full debug CLI packages. Running these I/O-heavy cases alongside other tests can increase shared-disk writeback pressure.

## What changed

- Move package installation and replacement coverage into the `app_server_daemon_package` test binary, sharing daemon fixtures with the lifecycle tests.
- Reserve all nextest test threads for each package test and add an exclusive Bazel target that runs the cases serially on Linux and macOS.
- Hard-link the prepared fixture executable during package setup, while retaining real independent package copies in the installer.

GitOrigin-RevId: 255ac8caf75d9eb61bafe68f1f9bcfa99ee72484
2026-10-14 07:13:22 +00:00
Eric Traut 4906ddf5b8 Resume unloaded subagent threads when selected in the TUI (#53895)
## Why

Persisted subagent threads could be reported as unavailable when selected after unloading, even though their saved history could be restored.

## What changed

Attempt to resume selected threads marked closed, including those with a cached live channel, and restore their transcript through the existing attachment flow.

## Testing

Extend coverage for V1 and V2 subagents to verify saved transcript restoration, the appropriate direct-input behavior, and reattachment when a close notification from the previous runtime is still queued.

GitOrigin-RevId: f45d16b954ce5f9f30ca4c6c6f640937390dd78d
2026-10-14 07:07:30 +00:00
Benjamin Carlsson 7eed30ad1b Preserve running turn recovery across thread settings updates (#53879)
## Why

Standalone thread settings updates cleared the running turn's continuation lineage, preventing recovery after a daemon restart.

## What changed

Preserve continuation lineage while a task is registered. Continue invalidating pending continuations for idle, reserved, and finishing turns, and record started-turn lineage atomically with task registration.

## Testing

Extend settings invalidation coverage to idle, reserved, and finishing turns. Exercise an in-flight reasoning effort update before compaction, then verify cold resume preserves the turn's frozen settings and allows continuation. Wait for thread idle before testing idle continuation.

GitOrigin-RevId: d7c316af6a4c871790bb57f0af9892bb30871ac8
2026-10-14 06:03:02 +00:00
rhan-oai cb03f28a40 Refresh model instructions in incremental-tool context windows (#53872)
## Why

Incremental-tool windows recorded base instructions only at setup, so a catalog refresh for the same model could leave active instructions stale. Instruction changes need to reach the model without rewriting the existing history prefix.

## What changed

- Track model identity and instruction content independently, appending a `model_instructions` developer message when either changes. Explicitly mark replacement or removal of base instructions, and avoid repeating unchanged updates.
- Start new windows after compaction with the latest model instructions while preserving custom base instructions.
- Preserve the recorded window base during local compaction retries, including empty instructions, and rebuild current model instructions when reconstructing child context.

## Testing

Add integration tests and request snapshots for catalog refreshes, instruction removal, model switches, compaction, restart, and forks. Extend regression coverage for legacy snapshots and local compaction retries.

GitOrigin-RevId: eeca69067b4d9cd91c817732d79b4d5c1faa18b9
2026-10-14 05:36:44 +00:00
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
Charlie Marsh e342df7b66 Reuse staged file digests when preparing daemon installs (#53853)
## Why

Daemon installation rereads staged files to verify the executable and hash the normalized WinGet package, even though staging already computed their digests.

## What changed

Cache file digests while copying the package and reuse them for the staged executable comparison and final WinGet tree hash. Update cached paths when moving WinGet executables and refresh digests when rewriting manifests.

Continue hashing source packages and existing releases from disk so digest reuse does not bypass content validation.

## Testing

Extend the installation test to corrupt an existing release's `codex-package.json` and verify that reinstalling rejects it while preserving the current selection.

GitOrigin-RevId: 429da2ad8b2ee50f07ffb14b79281ab262a2d1a1
2026-10-14 03:26:47 +00:00
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