Commit Graph
11280 Commits
Author SHA1 Message Date
johnl-oai e9b4c6967e Apply Guardian computer-use review to the Browser connector (#47647)
## Why

The Browser connector on `codex_apps` needs the computer-use policies and review handling already applied to `node_repl` and `cua_repl`.

## What changed

- Classify `connector_openai_browser` using registered tool metadata and preserve its computer-use scope through Guardian review.
- Extend confirmation-policy forwarding, review evidence capture, JavaScript execution tracking, and initial-call approval handling to the Browser connector.
- Correlate Browser elicitations with live invocations so nested actions retain their own review identity while assessments are attributed to the originating call. Require verified Browser identity for strict nested review.
- Include the Browser connector in computer-use policy prompts and bundled model messages.

## Testing

Add integration coverage for ordinary and strict Browser nested reviews, including policy injection and action attribution. Verify strict review declines requests with missing or unknown invocation correlation or a non-Browser registration.

GitOrigin-RevId: b04af6fb9db1bac2203dc4265913d210746df90b
2026-09-23 20:05:09 +00:00
rhan-oai 8c66a5a243 Add model-specific prefixes to indirect tool descriptions (#47642)
## What changed

Add `model_messages.tools.indirect_description_prefixes` with selectors for exact namespaces and configured MCP server names. Apply the selected model's guidance to namespace documentation embedded in `CodeModeOnly` prompts, `ALL_TOOLS` descriptions, and namespaces returned by tool search.

Trim prefix values, treat empty values as no prefix, and reject conflicting selectors for the same namespace. Apply prefixes during rendering so model changes take effect without altering direct tool specifications, search ranking, or tool dispatch.

## Testing

Add unit tests for prefix normalization, namespace grouping, MCP server mapping, and conflicts. Add scenarios covering both Code Mode variants, clearing prefixes on model changes, unchanged tool dispatch, and conflict rejection before a model request.

GitOrigin-RevId: 0c7ce6d418c775945c2ccfdab3c605fa4d431b55
2026-09-23 19:54:07 +00:00
Adam Perry @ OpenAI 9d8de19674 Honor Retry-After and preserve server retry deadlines (#47641)
## Why

HTTP retries used local backoff even when the server supplied `Retry-After`. Relative retry delays also failed to account for time spent propagating errors or reporting retries.

## What changed

- Parse `Retry-After` delay seconds and HTTP dates into a monotonic deadline captured when response headers arrive.
- Honor that deadline for HTTP retries, falling back to local backoff when valid advice is absent.
- Preserve deadlines through API and Bedrock error mapping, stream retries, and exhausted retry state. Expired advice remains a zero delay instead of triggering local backoff.

## Testing

Add coverage for header parsing, deadline countdown and expiry, error mapping after exhausted HTTP retries, and delayed stream retry notifications. Update Responses and remote compaction tests to verify that HTTP retries honor `Retry-After`.

GitOrigin-RevId: a2eff02946e5524f29e06f7ba1431e3d339261a4
2026-09-23 19:53:11 +00:00
Felipe Coury ab021e9f13 Add configurable copy-on-select for transcript selections (#47639)
## What changed

- Add `tui.copy_on_select` with `auto` (default), `always`, and `never` modes, and apply it to the fullscreen transcript, transcript overlay, and resume/fork previews.
- Enable `auto` in tmux and Zellij, and in direct macOS terminals except Ghostty and Kitty. On other platforms, enable it in direct terminals identified as iTerm2 or Terminal.app.
- Copy nonempty mouse selections on release, including word and line selections, while retaining their highlight. Preserve link activation and ignore empty selections.
- Clear composer selections after confirmed keyboard copies, matching right-click copies, while preserving the draft and cursor. Keep selections when copying fails or delivery is unconfirmed.

## Testing

Add coverage for terminal defaults and configuration overrides, copying on release, retained highlights, repeated clicks, link activation, and empty drags. Extend composer coverage to verify selection clearing for `Cmd-C`, `Ctrl-C`, and right-click across clipboard outcomes.

GitOrigin-RevId: 24e6f9e267ef3ab249c5356db736e094127f68b8
2026-09-23 19:37:42 +00:00
mtsui-oai c847294c60 Classify retryable exec-server preparation errors by type (#47638)
## Why

Transient connection and registry failures can reach remote filesystem callers as generic `io::ErrorKind::Other` errors. Callers need a typed signal to identify failures that read-only preparation can retry.

## What changed

- Add `ExecServerError::is_retryable_preparation_error()` to classify transient registry, connection, handshake, timeout, and session-attachment failures, including errors wrapped in `ConnectionAttempt`.
- Map these failures to `io::ErrorKind::BrokenPipe` in the remote filesystem adapter.
- Keep authentication, TLS, and malformed protocol failures outside the retryable classification; error text alone does not trigger it.

## Testing

Add a regression test showing that a wrapped registry service-unavailable error maps to `BrokenPipe`, while a protocol error containing transport-closed text remains `Other`.

GitOrigin-RevId: c3e1bbab8f977a0b421eba5d6d3071ada72c09ff
2026-09-23 19:37:16 +00:00
Ben Romano ce7df36237 Overlap startup WebSocket preconnect with tool discovery (#47635)
## Why

Startup prewarm waited for tool discovery before opening its WebSocket connection. Slow MCP startup therefore delayed connection setup even though the handshake could proceed independently.

## What changed

- Run the WebSocket handshake concurrently with tool capture, then send `generate=false` with the discovered tools and finalized request metadata.
- Include model and effective service-tier routing hints in preconnect, including the inherited tier for spawned subagents. Omit routing hints for guardian reviewer requests.
- Recover authentication failures during preconnect and switch to HTTP fallback on `426 Upgrade Required`.

## Testing

Add and extend regression coverage for handshake overlap with delayed MCP discovery, cancellation before warmup, finalized Responses Lite tool metadata, socket reuse and reconnection, service-tier changes and inheritance, and authentication recovery during preconnect.

GitOrigin-RevId: ecb53540765df8227e55e79910a13a05260a4c8d
2026-09-23 19:16:20 +00:00
jif dce62a50a2 Route message board agent resolution through the selected controller (#47633)
## What changed

Use `agent_control.resolve` for message board agent lookups and path validation instead of accessing `local_agent_runtime` directly. Derive paths from the session source, with a root fallback, and verify that each path resolves to the agent that owns it.

Validate the requested caller's thread for path and clock queries, and apply the same path ownership check to notification recipients.

GitOrigin-RevId: 92632a31b493b6519d2154f49e9d1d4a1019b394
2026-09-23 19:12:03 +00:00
jif 851d9e95f1 Bind Guardian reviews to the action's target environment (#47630)
## Why

Actions targeting a secondary environment could be reviewed with the primary environment's denied-read restrictions. Each review needs the permission context of the environment that owns the action, including when a Guardian session is reused across environments.

## What changed

- Carry `environment_id` through environment-scoped approval requests and their planned-action JSON.
- Select and label permission context using the target environment, explicitly stating when it has no denied-read paths or globs.
- Reject reviews for unavailable target environments and reject environment IDs longer than 256 bytes before Guardian inference, while preserving manual approval routing for oversized IDs.

## Testing

Add coverage for `exec_command`, `apply_patch`, and `request_permissions` reviews switching environments while preserving the existing review prefix. Extend tests for environment-specific restrictions, unavailable environments, action serialization, and the 256-byte ID boundary.

GitOrigin-RevId: ad3292edddb1c6f5b180142c6857cba6f1308328
2026-09-23 19:03:12 +00:00
jif e1f3fafad8 Route V2 child loading through AgentControl (#47629)
## What changed

Add `AgentControl::ensure_child_loaded` and use the parent's configured agent control in `ThreadManager` to reload recorded V2 children. The local implementation delegates to the existing loader using the live parent's current configuration, preserving parent-controlled restoration without sending input.

GitOrigin-RevId: 67cadf79cbc034eb271c5ae13145f1a42722fe69
2026-09-23 19:02:47 +00:00
pmccrary-oai fdeaa6c1ec Allow history and notes without experimental context capability (#47625)
## Why

Enabling `features.token_budget.use_history_notes_extension`, explicitly or through model defaults, rejected session startup when the model lacked `supports_experimental_context`, even with experimental mode disabled.

## What changed

Remove that startup restriction so token-budget history and notes can be used independently of the model's experimental context capability.

## Testing

Extend core tests to cover explicit configuration and model defaults on startup and cold resume, checking `new_context`, token-budget contexts, and `history_ingest_requested` metadata. Add app-server coverage for native history and notes tools and context-window hints without experimental context capability.

GitOrigin-RevId: 6157479aeb75ffd785b8d4b2f48b11c6f46e8f35
2026-09-23 18:54:02 +00:00
Ankush Gupta f07b26c9c9 Recognize user_message tools in Guardian authorization context (#47624)
## Why

Messages sent through the singular `user_message` connector were omitted from Guardian's delivered assistant message evidence because only `user_messaging` tool names were recognized.

## What changed

Accept both namespaced and flat `user_message` forms of `send_message` alongside the existing `user_messaging` forms.

## Testing

Extend Guardian subagent authorization tests to cover the singular connector and flat tool names, including blocked post-tool hooks and cancellation before confirmation. Add a negative case ensuring `send_message_to_thread` is not treated as delivered message evidence.

GitOrigin-RevId: 68495642ef4b78eec71df4fee2bacfda407adc47
2026-09-23 18:53:38 +00:00
jif 8bbe8f8702 Fix read-only metadata mount ordering for nested writable roots (#47623)
## Why

Nested writable roots must allow the Linux sandbox to start while preserving read-only metadata protections, including when a writable directory sits beneath a read-only `.codex` directory.

## What changed

Defer read-only subpath mounts shared with a deeper writable root until that root is bound. Keep symlink target remapping and writable-symlink validation for deferred paths so mount ordering does not bypass those checks.

## Testing

Add regression coverage for mounting `.git`, `.agents`, and `.codex` metadata exactly once after the nested writable bind. Add sandbox integration cases for ordinary and symlinked roots, using both parent and nested working directories, to verify startup, allowed writes, metadata protection, and temporary mountpoint cleanup.

GitOrigin-RevId: 45e439eaf537e10bfa8b839bad816b0401fb65aa
2026-09-23 18:51:35 +00:00
Sean Huang 13869ca39e Add portable project trust lookup APIs (#47620)
## What changed

Add `resolve_root_git_project_uri_for_trust` to resolve repository trust roots through `ExecutorFileSystem` using executor path conventions. Share repository and linked-worktree validation with native lookup while preserving native ancestry for paths with opaque URI representations.

Extract `ProjectTrustLookup` to match merged project settings using supplied path spellings and an explicit path convention. Preserve canonical-before-original and cwd-before-repository-root precedence, including cwd entries without a trust level, with ASCII case-insensitive matching for Windows.

## Testing

Add coverage for POSIX, Windows drive and UNC trust roots, project-key precedence and case handling, and native/URI lookup parity. Extend environment-config coverage to verify returned `projects` entries include entries without a trust level.

GitOrigin-RevId: 315434802e86cceee85b14bc1c3767a45e3139f5
2026-09-23 18:40:12 +00:00
Celia Chen 0ed77c274b Add bounded buffering for global operation metrics (#47619)
## What changed

Add `record_global_operation` to record an operation count and duration in milliseconds, buffering up to 256 pairs until a metrics provider is installed. Validate both metric names and tags before accepting a pair, limit each operation to 16 tags and 1024 bytes of metadata, and drop whole pairs when the buffer is full.

Drain pending operations on installation and serialize recording with provider lifecycle changes so a pair stays with one installation. Resume buffering when the active provider shuts down without disturbing a newer installation. Disabling metrics discards pending operations and suppresses recording until metrics are enabled again.

## Testing

Add unit and integration coverage for buffer limits, validation, concurrent installation and replacement, redirected global handles, shutdown buffering, and accepted or rejected opt-out configuration changes.

GitOrigin-RevId: 3b094e69bf975016ff1fb8f99b3611c2ccddccf3
2026-09-23 18:39:47 +00:00
Ian MacLeod 591ffb1aae Prefer Shift-arrow hints for queued messages and questions (#47618)
## Why

Queued-message edit hints could vary by terminal instead of showing the first configured shortcut. Use the keymap consistently for queued messages and async question navigation.

## What changed

- Make `Shift+Left` the primary shortcut for advancing through questions and editing the last queued message, and `Shift+Right` for navigating back toward the composer. Keep `Alt+Up` and `Alt+Down` as alternatives.
- Remove terminal-specific hint selection and derive hints from the configured keymap, including custom chords and unbound actions.
- Update question footers, queued-input previews, and keymap picker snapshots to reflect the preferred shortcuts.

## Testing

Extend tests to cover both default shortcut pairs, configured shortcut ordering, custom chord hints, and hiding the queued-message edit hint when the action is unbound.

GitOrigin-RevId: e0f60860ef1e81c71ca0fc32369b8cbd12582b47
2026-09-23 18:39:19 +00:00
Charlie Marsh 88b498ded4 Route Linux PTY launches through the process setup helper (#47617)
## Why

PTY launches need to establish a controlling terminal and reset signal state. Extend the Linux process setup helper to perform this work in a fresh, single-threaded process image without forking the application when the native helper is available.

## What changed

- Add a PTY setup mode and support caller-owned stdout and stderr descriptors so all three standard streams use the PTY slave.
- Use the helper for eligible Linux PTY launches, including launches with explicitly preserved descriptors, and wait for child exit asynchronously.
- Preserve portable PTY behavior for `PATH` lookup, custom `argv[0]`, missing working directories, default `SHELL`, stdin EOF, and signal exit status.
- Retain compatibility fallbacks and release the initial PTY descriptors before allocating a portable replacement.

## Testing

Add regression tests for controlling-terminal setup without forking, portable signal exit status, and successful fallback under file-descriptor pressure. Resolve the Python test executable to an absolute path to exercise the helper path.

GitOrigin-RevId: 4b07ce68aa33c5b79548581e221caf5953b0eda1
2026-09-23 18:36:48 +00:00
Charlie Marsh 15922a50aa Expand Linux spawn-helper lifecycle test coverage (#47613)
## What changed

Add real-child tests for parent-death signaling, large environment transfers, explicit file descriptor inheritance, and fallback when the helper exits before acknowledgement.

Introduce test-only pause points during environment transfer, reporting, and exec to verify that cancelling startup kills and reaps the helper. Cover cancellation after runtime shutdown and verify that the fallback reaper can reap an exited child while an earlier child remains alive.

Probe an actual helper launch before asserting native-helper behavior, and skip fixtures when their required procfs or pidfd support is unavailable.

GitOrigin-RevId: 5136dc242a91efd0596171266965f29903c6c970
2026-09-23 18:25:32 +00:00
Free Wortley df3ecee6f0 Launch Linux pipe processes through a fresh setup helper (#47612)
## Why

Linux pipe launches need session, parent-death signal, and descriptor setup. Move this work into a fresh, single-threaded executable image to avoid forking the app-server for child setup.

## What changed

- Register an early setup helper and launch it through `posix_spawn` for Linux pipe processes.
- Start the helper with an empty environment, then transfer the target environment over a control socket so loader settings cannot interfere with helper startup.
- Await target execution asynchronously, propagate setup and execution errors, and kill incomplete launches on cancellation.
- Preserve direct spawning as a fallback when the helper is unavailable or fails before target execution.

## Testing

Add coverage for launch semantics, avoiding fork, loader environment isolation, early argument dispatch, closed standard descriptors, and fallback under bootstrap failure or descriptor pressure. Add an app-server regression test that reuses a process handle after an execution failure.

GitOrigin-RevId: 079c673f0f22ebd531f8c57e5338095cc98acfdc
2026-09-23 18:25:07 +00:00
Charlie Marsh 60f0ab6cbf Use the shared process launcher for Unix shell snapshots (#47611)
## What changed

Launch Unix shell snapshot commands through `codex_utils_pty::Command` with `ProcessMode::NewSession`, replacing the custom `pre_exec` hook. Pass the complete, scrubbed child environment and preserve the original command arguments so NUL bytes are rejected before execution.

## Testing

Add a Unix regression test asserting that a snapshot script containing a NUL byte returns `InvalidInput` without creating the file it would otherwise write.

GitOrigin-RevId: ef68a6c9f64d7a541498d3ecc4113fad8ff7ed14
2026-09-23 18:24:42 +00:00
Charlie Marsh 7aa6519909 Use native POSIX spawning for command hooks (#47610)
## Why

Unix command hooks use a `pre_exec` callback to detach from the controlling terminal, forcing the launcher to fork. Native spawn attributes can create the detached session without that callback.

## What changed

- Route Unix hooks through `codex_utils_pty::Command` with `ProcessMode::NewSession`.
- Extend the native `posix_spawn` launcher to detached Linux sessions, retaining compatibility fallbacks for unsupported libc features and executable handling.
- Preserve the session environment snapshot, hook overrides, and restricted-variable filtering.

## Testing

Add regression coverage for launches without parent forks, terminal detachment, environment and argument handling, Linux `PATH` lookup, and executable compatibility. Cover process-group cleanup on cancellation and timeout, including descendants holding output pipes open, and preservation of background descendants after completed hooks.

GitOrigin-RevId: dbe2cf12d84aa79868cfb55ace40c7d5b5282703
2026-09-23 18:24:05 +00:00
Charlie Marsh 50fc133d05 Route pipe processes through the shared child launcher (#47605)
## Why

Pipe spawning installs Unix `pre_exec` hooks, forcing a fork on macOS even though the shared child launcher supports native spawning.

## What changed

- Use the shared `Command` for pipe processes, enabling native macOS spawning while preserving session isolation, explicit descriptor inheritance, and Linux parent-death handling.
- Select `ReapOnly` so the pipe adapter retains ownership of process-tree termination.
- Track embedded NUL bytes in original Unix command inputs and reject them before spawning, including when invalid `current_dir` or `arg0` values are later replaced.

## Testing

Add macOS integration coverage verifying fork avoidance, executable path lookup, pipe I/O, session isolation, and descriptor inheritance. Add Unix regression tests for pipe and PTY fallback under descriptor pressure and for rejecting NUL inputs without running the child.

GitOrigin-RevId: f4fa2c1d3c1aee2c4ffa1dc2ff946f9f0b08eb20
2026-09-23 18:00:11 +00:00
Charlie Marsh b8d365b18e Extend child commands with session and descriptor controls (#47604)
## What changed

- Add `ProcessMode::NewSession`, null stdin, and opt-in Linux parent-death termination to the shared child command API.
- Replace `DescriptorPolicy::StdioOnly` with `Explicit` and add `preserve_fds` to allow selected inheritable Unix descriptors alongside stdio. Preserve descriptor numbers without duplicating or closing the parent's descriptors, keeping POSIX record locks intact.
- Support session creation and preserved descriptors in the native macOS backend, with a compatible fallback for high descriptor numbers rejected by native file actions.

## Testing

Add regression coverage for process groups and sessions, descriptor preservation across native and executable-text launches, the last descriptor slot below the file limit, and retention of parent record locks.

GitOrigin-RevId: 29ecd859d3b673da6ae6412cc06a32fa10d11346
2026-09-23 17:59:47 +00:00
Charlie Marsh 897b7ae285 Add a reap-only drop policy for child processes (#47603)
## What changed

Add a crate-private `ChildDropPolicy` to choose whether dropping a child kills it or only reaps it after exit. Keep `KillAndReap` as the default.

For `ReapOnly` on Unix, transfer dropped children to a shared reaper thread that operates independently of the Tokio runtime. Support both Tokio children and native macOS children, without blocking drop or letting a live child delay reaping others.

## Testing

Add an isolated regression test verifying that reap-only children survive handle drop after runtime shutdown, are reaped after exit, and do not prevent other exited children from being reaped.

GitOrigin-RevId: 5ec639597dba7f3b61694d6d465991e054ae3397
2026-09-23 17:59:23 +00:00
Ruslan Nigmatullin 2210190435 Add opt-in WebSocket authentication to exec-server (#47601)
## What changed

Expose the shared `--ws-auth` options on `codex exec-server` for direct WebSocket listeners. Support capability tokens configured by token file or SHA-256 digest, and signed JWT bearer tokens. Validate `Authorization: Bearer TOKEN` before each WebSocket upgrade, rejecting missing or invalid credentials with HTTP 401 when authentication is enabled.

Reject listener authentication with stdio, `--remote`, or `forward`. Document the options and connection-time authentication behavior.

## Testing

Add CLI integration tests for all three credential configurations, unauthorized upgrade rejection, authenticated RPC initialization and reconnects, invalid configuration, and incompatible transports.

GitOrigin-RevId: 941fbd3d43e732c910d29b6f8137077b7c332835
2026-09-23 17:56:46 +00:00
Ian MacLeod 6824dabe03 Guard prerelease channel and canary updates against older versions (#47597)
## Why

Publishing a hotfix for an older release line or alpha can replace a newer prerelease pointer. Release pointers should advance according to version order.

## What changed

- Share release version validation and numeric comparison across publishing scripts, including alpha hotfix suffixes and alpha, beta, and stable ordering.
- Read the prerelease pointer directly from R2 and update it only for a newer version or missing or invalid version metadata.
- Restrict `latest-alpha-cli` updates to alpha releases with successful R2 and npm publishing, and compare against the branch's Cargo version before advancing it. Allow replacement when the manifest version cannot be parsed or validated.

## Testing

Add 15 passing unit tests covering version validation, older release lines and alphas, numeric hotfix ordering, prerelease precedence, equal versions, and missing or invalid versions.

GitOrigin-RevId: 6bee3906a47f613b662ef2b2224cfcbd1b56650c
2026-09-23 17:35:40 +00:00
reia-oai c114f232f9 Refresh realtime context for each model request (#47596)
## Why

A realtime call can start or end while a text turn is still running. Using call activity captured at turn creation leaves subsequent model requests with stale realtime context.

## What changed

Capture realtime activity and mode instructions together in a `StepContext` snapshot for each model request. Use that snapshot to build realtime instructions and persist `realtime_active` in the request's turn context. Store the conversation and mode instructions under one mutex so they are installed together when a call starts.

## Testing

Extend the realtime handoff integration test to start and close a call during one text turn, verifying that successive requests include the appropriate start and end instructions.

GitOrigin-RevId: 4c5c2b47b7c0c06ae28167013218dc2e3cd72c42
2026-09-23 17:34:58 +00:00
Eric Traut 8f1490eabe Stream daemon executable hashing off the async runtime (#47591)
## Why

Debug executables can be hundreds of megabytes. Computing their identity previously loaded the entire file into memory and hashed it on an async runtime thread.

## What changed

Stream executable contents into the BLAKE3 hasher using `tokio::task::spawn_blocking`, preserving the existing digest format while avoiding whole-file allocation and moving hashing off the async runtime.

## Testing

Expand the executable identity test to verify compatibility with whole-file hashing for a file spanning multiple reads with a partial final buffer and for an empty file, and to confirm that changing a byte changes the identity.

GitOrigin-RevId: 528103397395313d170ec720fefc8c5ab3676956
2026-09-23 17:08:29 +00:00
Dylan Hurd ae132dc50a Serialize numeric custom reasoning effort as JSON numbers (#47590)
## What changed

Serialize custom reasoning effort values that parse as `u64` as JSON numbers in API requests. For example, `model_reasoning_effort = "64"` now sends `reasoning.effort` as `64`. Keep named values and custom values that cannot parse as `u64` as strings.

## Testing

Expand the request integration test to cover configured named effort, zero, a positive integer, an unknown name, a negative value, and an integer exceeding `u64`.

GitOrigin-RevId: 18ad03a1cd97dfa3f1a3cc49a43b3f7ca7d9b657
2026-09-23 17:02:51 +00:00
Eric Traut e0a64cf2bc Keep unfinished link destinations out of rich streaming previews (#47589)
## Why

An unfinished Markdown link can display its destination across multiple preview rows, then collapse when the closing parenthesis arrives.

## What changed

Keep the link label visible while withholding the opening parenthesis and destination until the link closes. Scan incoming text incrementally, accounting for nested parentheses, escapes, angle-bracket destinations, titles, and inline code. Apply this holdback only to rich prose previews; newline commitment and finalization still render the original source.

## Testing

Add regression tests for character-by-character input, long Unicode destinations, resizing, raw-mode switching, and flushing unfinished links on newline or completion, plus a snapshot of the label-only preview.

GitOrigin-RevId: 9cea680a93dfcd0aea21f0fc12006b27400d4dab
2026-09-23 16:39:22 +00:00
felixxia-oai 7342991f0c Preserve delivered assistant messages in Guardian retained context (#47585)
## Why

Guardian authorization reviews need the assistant message that prompted a user’s approval, even when a post-tool hook blocks the messaging result or compaction removes the original tool call.

## What changed

Retain confirmed delivered assistant text from tool-output metadata at the original call’s position in thread-owned Guardian context. Recover these messages when restoring checkpoints and respect the call’s inherited-context status.

## Testing

Extend authorization coverage to verify that a delivered message remains in the Guardian root snapshot after a blocked tool result, compaction, and resume, and update checkpoint expectations to preserve assistant/approval ordering.

GitOrigin-RevId: df30ec8a3ef21443210a937ab6db119de8a5fd51
2026-09-23 16:16:54 +00:00
felixxia-oai 876ce590e1 Preserve streamed assistant message order in retained context (#47584)
## Why

A user can reply to a streamed question before its completed message is recorded. Assigning the assistant message's order at completion can place the reply before the question in retained context.

## What changed

Reserve an assistant message's order when its source stream starts in thread-owned Guardian context, then reuse that reservation when recording the message. Reserve completion-only messages before publishing their text, and give text and plan output from the same source message a single order.

## Testing

Add streaming regression coverage that accepts a reply before the question completes and verifies question-before-reply ordering both live and after resume. Cover server-provided and generated message IDs, plan output, and text combined with a plan.

GitOrigin-RevId: cb67e7459c804df7beb0841908244202448c655a
2026-09-23 16:16:29 +00:00
felixxia-oai 29aa1df62e Retain assistant context for Guardian authorization reviews (#47582)
## Why

Ordinary user replies can depend on preceding assistant messages. Losing those messages during compaction can leave Guardian without the context needed to interpret a reply's scope.

## What changed

- Retain original assistant messages, including commentary, with their recorded order across checkpoints and resume. Exclude compaction output from this evidence.
- Include assistant context in local and delegated reviews as untrusted context, with separate storage limits and lower budget priority than user instructions.
- Prefer assistant context preceding ordinary replies when selecting bounded root evidence, and report unavailable context without inferring what a reply refers to.
- Preserve inherited context scope and remove assistant evidence beyond rollback boundaries, including during rollout migration.

## Testing

Extend coverage for compaction and resume, checkpoint migration, queued-input ordering and rollback, role labeling, and evidence budgets that preserve user restrictions while dropping assistant context.

GitOrigin-RevId: 886189b0be29ffc3d324b56f5d0b673d6b8d84da
2026-09-23 16:15:55 +00:00
Eric Traut cb1eea3e98 Explain Mermaid rendering fallbacks in the TUI (#47572)
## Why

Mermaid diagrams that cannot be rendered currently fall back to source without
explaining why the preview is unavailable.

## What changed

Show a dimmed notice above the preserved source when a completed Mermaid block
uses unsupported syntax, exceeds renderer size limits, or does not fit the
terminal width. Wrap the notice to the available width and preserve indentation
inside lists and blockquotes. Leave unfinished fences and disabled Mermaid
rendering without notices.

## Testing

Add coverage for fallback reasons, dimmed styling, source preservation, nested
indentation, and suppression of notices for unfinished fences and disabled
rendering. Update the streaming resize snapshot to include the width notice.

GitOrigin-RevId: 6ac7914b398c855e7aed3775ee0de70fb4484b78
2026-09-23 15:15:58 +00:00
felixxia-oai acd5ed9207 Wait for idle before injecting remote compaction test history (#47571)
## Why

Turn completion precedes active-turn cleanup, so the remote compaction test must wait for the thread to become idle before injecting its history fixture.

## What changed

Register the `ThreadIdle` lifecycle contributor and wait after the initial turn in `remote_compact_v2_rewrites_multiple_trailing_function_call_outputs`, covering both manual and automatic compaction cases.

GitOrigin-RevId: 1593b212db0e07b1457f090b5ac7ba2313a28360
2026-09-23 15:15:24 +00:00
iceweasel-oai 6f6af0fce4 Record sandbox backends in command execution analytics (#47568)
## Why

Command execution analytics lack the observed sandbox backend. Older execution servers may omit this information, so an unknown backend must remain distinguishable from an explicitly unsandboxed process.

## What changed

- Carry optional `sandbox_type` metadata through command execution items and emit its metric tag as `sandbox_backend` in analytics.
- Propagate the observed backend through unified execution completion and failure events, including asynchronous exits.
- Preserve missing backend information as `None` and mark executed user shell commands as `Some(SandboxType::None)`.
- Exclude the metadata from serialized command items and generated schemas and TypeScript types.

## Testing

Extend tests for missing and explicit executor backends, backend propagation on failed execution, and analytics payloads, including platform-specific backend tags in app-server integration coverage.

GitOrigin-RevId: 178fe46824a6194910802ec02168ed40ee0b2019
2026-09-23 15:05:59 +00:00
jif d6c4c6aea4 Classify rollout read failures by reason and progress (#47565)
## Why

Rollout read metrics record the failure stage and I/O error kind, but these do not distinguish specific zstd failures, task join failures, or a busy reader, nor indicate whether any line was read before failure.

## What changed

Add bounded `reason` and `read_progress` labels to rollout read counters and duration metrics, captured at the first failure. Distinguish OS errors, reader-busy and task-join failures, and known zstd error categories, with `stream_error` as the fallback.

Record whether the failure occurred before or after the first line. Classify blocking-task join failures during both open and read. Keep error messages, file paths, and rollout contents out of metric labels.

GitOrigin-RevId: 6db302900f504bc2860504d81c18017adcef3efc
2026-09-23 15:01:19 +00:00
jif 30fc6864cc Add an option to disable multi-agent v2 direct messaging (#47540)
## What changed

Add `features.multi_agent_v2.disable_direct_message`, defaulting to `false`. When enabled, omit `send_message` and `followup_task` while preserving spawning, automatic child results, and the remaining agent management tools.

Require an available message-board `post` tool when this option is enabled for sessions using multi-agent v2 collaboration tools, exempting internal worker sessions.

## Testing

Extend configuration parsing tests and run the message-board subscription/resume scenario with direct messaging both enabled and disabled. Verify post search, subscription behavior, and which collaboration tools are exposed.

GitOrigin-RevId: 72ec22ef0b92fa81e02cdeb058d8b4f93aca3be6
2026-09-23 12:09:05 +00:00
jif ec4d27ae80 Test interrupted one-shot command launch failure persistence (#47539)
Add a regression test that fails `exec_command` with a missing working directory, pauses command completion, and interrupts the turn before releasing completion.

Verify that the command emits exactly one start and completion, retains its failure status and launch diagnostic, and persists the completion in the rollout. Check that reconstructed history includes the failed command in the interrupted turn.

GitOrigin-RevId: 5962f0791b298ebb05e752138d02b0e0b3af4c63
2026-09-23 11:42:45 +00:00
jif 0b23f365f8 Route agent lookups and V2 context through AgentControl (#47536)
## Why

V2 tools and model context need to use the controller's agent tree even when the session's local runtime has no registry entries.

## What changed

- Add target resolution and direct-child path lookup to `AgentControl`.
- Move lazy root registration into the controller's resolution and listing methods.
- Build V2 subagent context from controller-provided paths, keeping formatting and size limits in the session layer and preserving loaded-first ordering.

## Testing

Extend the V2 spawn and messaging test with an empty session-local registry to cover relative-path resolution, message delivery, and subagent environment context through the controller.

GitOrigin-RevId: c935b34a6d3314e968ba451ff981cf2a223bbfa8
2026-09-23 11:07:41 +00:00
Peter Steinberger a69d757cd8 Emit command lifecycle events for unified exec launch failures (#47529)
## Why

When unified exec cannot create a process, command lifecycle events are missing, leaving clients without a command failure notification.

## What changed

Emit start and failure events for terminal process-creation errors in both regular and zsh-fork execution. Report no process ID, an exit code of `-1`, zero duration, and the launch diagnostic, while retaining plugin attribution. Once event publication starts, let it finish even if the caller is cancelled.

Preserve approval rejection handling and retryable sandbox denials.

## Testing

Extend app-server tests to cover pipe and PTY launch failures, plugin attribution on failed launches, and zsh-fork launch failures after approval. Assert failure metadata and check for duplicate lifecycle notifications while retaining approval-decline coverage.

GitOrigin-RevId: 26ed191fc69b903ea4710dd1a6c3b031e8caa4eb
2026-09-23 10:18:21 +00:00
jif 27969c0ae9 Route session agent operations through AgentControl (#47520)
## What changed

- Store `Arc<dyn AgentControl>` in session services and route agent tools, turn admission, usage accounting, completion notifications, and shared settings through the trait.
- Add `AgentControlInit` so delegated and guardian sessions inherit the parent's controller and local runtime.
- Move local registry and context helpers to `LocalAgentRuntime`, keep resume, close, inspection, and status subscriptions on the local controller, and simplify synchronous and infallible trait methods.

GitOrigin-RevId: ad3f213eb483ac524bde56d769f20a78f20989a0
2026-09-23 09:39:30 +00:00
alicec-oai 40eac3ce8a Add explicit background control to image generation (#47484)
## What changed

Add the boolean `transparent_background` argument to `image_gen.imagegen` for generation and editing. Map `true` to `transparent` and `false` or omission to `opaque`, replacing the previous `auto` background setting.

Update tool guidance to request transparency for background removal and cutouts, and to preserve existing transparency during edits unless the user asks to change it.

## Testing

Add integration coverage for transparent, opaque, and omitted background arguments across generation, editing, and code-mode generation. Verify that `null`, string, and numeric values return a validation error without dispatching an image request.

GitOrigin-RevId: b10ac200a619c72cc1787da41b49d65d0cde05dd
2026-09-23 07:15:30 +00:00
Henry Levy 0a2eb4696c Parallelize instruction refresh and tool preparation (#47458)
## What changed

Run `AGENTS.md` and thread-instruction refresh concurrently with capability discovery, MCP setup, and tool construction. Box both preparation futures to keep them off caller stacks while they are live together.

Finish delivering returned instruction warnings even when tool preparation fails or is cancelled. Preserve instruction-error precedence and publish the selected-plugin snapshot only after both branches succeed and cancellation is checked.

## Testing

Add tests covering concurrent preparation, warning delivery on tool failure and cancellation, instruction-error precedence, and plugin snapshot publication. Verify that cancellation does not repeat consumed warnings on the next capture.

GitOrigin-RevId: 6b2d7b091aae2dba67ad154a19bdb0ed0f96f6f7
2026-09-23 05:22:16 +00:00
Ruslan Nigmatullin c44deff7b1 Extract WebSocket authentication into codex-websocket-auth (#47447)
## What changed

Move WebSocket authentication arguments, settings, credential loading, and upgrade authorization into a shared crate using `http` types. Update the app server, transport, and CLI to consume it directly, and remove the `AppServer` prefix from the shared types.

Hide token digests and JWT verification secrets from authentication policy `Debug` output.

## Testing

Move the existing argument validation, capability-token authorization, and signed bearer-token verification tests into the new crate.

GitOrigin-RevId: 1dd20043a3f8efbca55af7eda338b62a62e8fd68
2026-09-23 04:25:28 +00:00
Eric Traut 4981037e99 Use secondary text styling for the transcript footer shortcut hint (#47441)
Apply `secondary_text_style()` to the shortcut hint separator and label
so they use a readable foreground color instead of terminal-dependent dimming.

GitOrigin-RevId: 6cd9ced75deca9353c1224d3e5fefc6c4ad6ae8f
2026-09-23 03:57:18 +00:00
Adam Perry @ OpenAI b7add4df3d Stabilize retry timing and WebSocket tests (#47437)
## Why

Retry timing assertions can fail if the test is descheduled before retry telemetry is emitted, and parallel tests can leave shared tracing callsites disabled for the test subscriber.

## What changed

- Measure retry intervals from the failed request, filter HTTP observations to `/responses`, and track WebSocket stream requests as well as connections.
- Keep a tracing interest-cache guard alive and rebuild callsite interest when installing the telemetry capture.
- Reserve the connection-failure test's port with a bound socket until the recovery server starts listening.
- Wait for the WebSocket warmup request and assert `generate: false` before submitting user input in connection-limit, rate-limit, and overload tests.

GitOrigin-RevId: bba39ea2ac29ac8553ae6184139382f1e6cdc7ac
2026-09-23 03:19:13 +00:00
sayan-oai 370cd7cba8 Allow environment selection updates during an active turn (#47435)
## What changed

- Add `environments` to `TurnSettingsUpdate` to replace the selection for subsequent steps without changing future turns.
- Capture model settings and environments together so combined updates apply or reject atomically, while existing steps retain their captured selection.
- Validate environment IDs, working directories, configuration ownership, and permission requirements against the running turn's selections.
- Preserve executor startup behavior when switching environments and use the step's local working directory for tool hooks.

## Testing

Add coverage for workspace switching and restoration on the next turn, atomic model and environment updates, permission validation, executor connection waits, and replacement of pending environment selections.

GitOrigin-RevId: 02b5c57a78fd594b2aed84fc09d9e99eb97be28c
2026-09-23 03:12:33 +00:00
sayan-oai 8a3c4ea3b5 Apply inherited environment settings at turn boundaries (#47428)
## Why

Thread permission updates could affect later steps of a running turn. Keep inherited environment settings consistent throughout the turn and apply saved updates when the next turn starts.

## What changed

Store active thread defaults alongside selected environments and refresh them when activating a new turn, even when its environment selections are unchanged. Resolve new selections from those active defaults while preserving owner-provided configuration, selection workspace roots, and the local Windows sandbox type.

## Testing

Add a regression test that changes permissions during a paused turn and verifies that both steps retain restricted filesystem access while the next turn receives unrestricted access. Update session and MCP elicitation tests to check that permission changes take effect on the next turn.

GitOrigin-RevId: 37ee44198fa40c138d140974dc90c4177d8c1f4c
2026-09-23 02:18:40 +00:00
Ian MacLeod 408a77dc1a Clear pending async question notifications when turns end (#47424)
## Why

An async question notification can outlive its unanswered question and suppress the lower-priority turn completion notification.

## What changed

Clear pending `AsyncQuestion` notifications when collecting question drafts on completion, interruption, or failure, including the error-handling path. Completed turns can then queue their completion notification.

## Testing

Add regression coverage for all three turn outcomes and assertions for error handling and completion after dropped message deltas.

GitOrigin-RevId: 647b2b37acced431fc98fd4f5334c8973a0be241
2026-09-23 01:41:17 +00:00
Ian MacLeod 3032b387fa Preserve history search during background draft recovery (#47423)
## Why

Recovering question answers or interrupted input can cancel an active `Ctrl+R` search or overwrite its preview. Recovery should preserve the search while keeping the recovered input available on cancellation.

## What changed

- Apply background updates to the saved draft without changing the search query or visible preview, including when a query has no match.
- Restore the updated draft on `Esc` or `Ctrl+C`; discard it when accepting a history match. Keep search open when `Enter` has no match to accept.
- Capture the saved draft rather than the preview in draft snapshots, preserving attachments, mention bindings, and pending pastes.
- End search on an explicit fresh draft replacement so cancellation cannot resurrect discarded input.

## Testing

Add regression coverage for recovery on turn completion, failure, and interruption; accepting and canceling search after recovery; Vim undo/redo; pending paste preservation; and clearing drafts after a misalignment policy failure.

GitOrigin-RevId: d3de19bbbcdab2e461c19d47b2b7dca0b28f6ff3
2026-09-23 01:40:52 +00:00