Commit Graph
11124 Commits
Author SHA1 Message Date
Benjamin Carlsson ac9db7d8b5 Generate keymap descriptors and binding accessors from one catalog (#54151)
## Why

The `/keymap` action catalog and root-config binding lookup duplicated the same action inventory, requiring both to be maintained together.

## What changed

Use `define_keymap_actions!` to generate `KEYMAP_ACTIONS` and `binding_slot` from a single declaration grouped by context. Preserve the existing action order, descriptions, feature gates, and binding mappings.

GitOrigin-RevId: 182e937d9642a8b5a4aa787691da793712f29010
2026-10-15 01:37:36 +00:00
ostepanian 4ca84a1069 Allow large file writes over direct exec-server WebSockets (#54135)
## Why

Direct mode serves executor requests but applied the client's 8 KiB inbound request limit, causing larger `fs/writeFile` requests to disconnect the executor.

## What changed

Use a dedicated direct WebSocket connection constructor that omits the client inbound request limit while retaining WebSocket message and frame limits.

## Testing

Add a regression test that runs the direct environment and verifies successful file writes above the client request limit using both text and binary WebSocket messages.

GitOrigin-RevId: e8e77a5e8581ab9eb98446e23b77a6da41d64868
2026-10-15 00:00:57 +00:00
Alex Kira 348ef773ee Record per-tool incremental update and description size metrics (#54133)
## What changed

Tag `codex.tools.incremental_updates` counters with the qualified tool name alongside the action. Continue excluding initial catalogs and namespace headers, while counting each removed namespace member.

Add `codex.tools.spec_description_bytes` to measure UTF-8 description bytes when an existing tool definition is replaced. Skip definitions without descriptions and use logarithmic histogram boundaries up to 1 MiB.

## Testing

Extend namespace transition tests to check per-tool counts and description sizes. Add scenario assertions for replacement metrics with incremental tool updates and their absence on the non-incremental request path.

GitOrigin-RevId: e20e6d81f21a867b285df1f0da005c2806dd03c6
2026-10-14 23:55:50 +00:00
Oliver Tepman d292f72124 Allow stdin review under active grants with sandbox prompts disabled (#54119)
## Why

With granular sandbox approvals disabled, `write_stdin` rejected input to terminals retaining additional permissions even when those permissions were still granted.

## What changed

Let input reach approval review when the terminal's retained permissions match active grants for its environment. Require identical filesystem grants, including entry order, and an active network grant when retained permissions enable network access. Each input still requires review.

Keep rejecting input when retained authority is no longer covered or the approval policy changes to `Never`.

## Testing

Add regression coverage for user and Guardian review, turn grant expiry, session grants, and switching to `Never`. Cover filesystem restrictions, protected metadata, symlinks, and ordered denials, and verify that rejected input never reaches the terminal.

GitOrigin-RevId: 9abf7da8d03b1526d26ca2a718e36349a255330b
2026-10-14 23:02:21 +00:00
Channing Conger dec54912f9 Report terminal completion states and blocking reasons (#54114)
## Why

Terminal status previously collapsed completed and failed turns into `idle` and reported blocking prompts without a reason. Blocking detection also depended on terminal title settings.

## What changed

- Emit `done` and `error` through OSC 7501 for live turn results, retaining them until deliberate keyboard, paste, or mouse input acknowledges them. Mouse movement does not acknowledge results.
- Classify blocking requests with `kind=permission`, `kind=question`, or `kind=auth`, including requests hidden behind another view or delayed while typing, independently of terminal title settings.
- Keep pending follow-up work and active goals `working`. Treat interrupted turns and replayed results as `idle` rather than new results.
- Preserve the existing iTerm2 OSC 21337 labels and indicators, mapping `done` and `error` to `Idle`.

## Testing

Add lifecycle and input-acknowledgment tests covering approvals, completion, failure, interruption, replay, pending follow-ups, and active goals. Extend blocking-request assertions and terminal protocol snapshots for the new states and reasons.

GitOrigin-RevId: 90bad1d54d8b3b9e3cec66fbd3bf3df0c42b995b
2026-10-14 22:58:37 +00:00
Dmitriy Kovalenko e1e2257e29 Embed generated app-server schema bundles in Bazel builds (#54113)
## What changed

Use the stable and experimental bundles generated by `//bazel/schema:app-server` as compile-time inputs for `app-server-protocol` instead of the checked-in bundles.

Generalize `schema_generator_sources` to `schema_sources` so it can stage Rust sources alongside generated bundles. Keep empty bundle placeholders for the on-demand schema generator, which derives its output from Rust sources.

GitOrigin-RevId: a976c420a3698d631f3ea7c698b15b82391158e5
2026-10-14 22:57:03 +00:00
felixxia-oai 1ffa95ee8a Wait for readiness in the SIGTERM cancellation test (#54099)
## What changed

Wait for the subprocess readiness marker before cancelling in
`process_exec_tool_call_cancellation_allows_sigterm_cleanup`, removing the
one-second polling cutoff. Poll readiness alongside execution under the existing
five-second timeout, then cancel and await execution if that timeout expires so
cleanup completes before the test fails.

GitOrigin-RevId: ba47dad9ba87fb5dc3bd087380811655387f825a
2026-10-14 21:11:58 +00:00
Ahmed Ibrahim 0c5720ea0f Keep environment tools stable across readiness changes (#54098)
## Why

Environment tool availability and selectors should remain stable as selected environments become ready.

## What changed

- Keep configured environment tools advertised even when no execution environment is ready, and derive `environment_id` selectors from all selected environments.
- Return guidance to wait when an environment is unavailable, while preserving errors for unknown environment IDs. Require a usable primary environment for `write_stdin`.
- Always include `shell` and `login` in the `exec_command` schema and mark `stable_environment_tools` as removed.

## Testing

Update integration tests to expect environment tools with empty or starting environments, and remove explicit feature opt-ins from affected scenarios.

GitOrigin-RevId: 1590c1b5be16a39e4a370663c552b881602545b5
2026-10-14 21:06:42 +00:00
Charlie Marsh f10ec115b7 Show Daybreak notices after the session header (#54097)
## What changed

Emit the Daybreak notice after replacing or removing the placeholder session header so the notice follows the configured header.

## Testing

Extend the resumed-history snapshot test to start with a placeholder header and verify the full transcript order: session header, Daybreak notice, and replayed user and assistant messages.

GitOrigin-RevId: 536f717b2859d2fe319756f52123b4cd0407cb66
2026-10-14 21:05:41 +00:00
Dmitriy Kovalenko bc13ff239c Add Bazel targets for on-demand schemas and Python SDK generation (#54096)
## What changed

- Add `//bazel/schema:app-server` to generate stable and experimental schemas from Rust sources without depending on committed precomputed bundles.
- Add `//sdk/python:generated` to generate Python SDK models, the notification registry, and API methods from the stable schema in scratch space, using dependencies from `uv.lock`.
- Add `generate-types --no-format` to skip formatters for build outputs while preserving formatting by default.

## Testing

Extend contract generation tests to regenerate in a temporary SDK copy, checking byte equality for formatted output and AST equality for unformatted output.

GitOrigin-RevId: 9ca7daa8ac0a33c4106a9e95c2f48bbded07df21
2026-10-14 20:59:31 +00:00
Anthony Tafoya 12fd621f62 Preserve specific MCP failure codes in metrics and spans (#54094)
## Why

MCP request failures and tool errors reported only through `codex/telemetry` metadata previously received an `unknown` error code, obscuring the failure category.

## What changed

- Classify typed request failures into bounded codes such as `request_timeout`, `transport_closed`, and `protocol_error`, and carry them into MCP call metrics and spans before errors become strings.
- Preserve typed timeouts when a prepared tool call exhausts its deadline during trusted access lookup.
- Accept allowlisted `error_code` values from `codex/telemetry` as a fallback after structured content and connector authentication metadata. Keep model output unchanged and ignore unrecognized metadata codes.

## Testing

Add coverage for typed errors wrapped in context, prepared-call timeout classification, metadata precedence and rejection, unchanged model output, and exported span error attributes.

GitOrigin-RevId: d7a440a6c9119b8a07a7f1fad697eb25af506f00
2026-10-14 20:53:59 +00:00
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