Commit Graph
13033 Commits
Author SHA1 Message Date
Benjamin Carlsson bc4116e4cd Add paginated history reads to the cloud client (#59075)
## Why

`Attach` delivers live events only. Clients also need access to stored turn metadata and item content.

## What changed

- Add `Client::list_turns` and `Client::list_items` using native gRPC history endpoints, with optional turn filtering for items.
- Expose page limits, sort order, access mode, and forward/backward cursors. Each call returns one page in server order without automatic pagination or retries.
- Preserve raw response and row payloads alongside typed summaries and item timestamps. Retain unknown item variants and command sources without typed summaries.
- Document cursor reuse and history/live overlap: history pages do not provide an atomic boundary with `Attach`, and coordinated reconciliation still requires caller-managed state.

## Testing

Add wire-fixture tests for request encoding, explicit pagination, raw payload preservation, unknown data, malformed rows, empty pages, RPC errors without retries, and diagnostic redaction.

GitOrigin-RevId: f507530b8e431236bc7e19d867517af56f74644f
2026-11-03 06:34:51 +00:00
Gan Tu f9e7b19df8 Add optional animated GIF output to image generation (#59073)
## What changed

- Gate GIF output behind `features.image_generation_animation`, disabled by default.
- Accept `gif` options for generation and editing, with optional `frame_count` and `frame_duration_ms` controls. Use `gif: {}` for API defaults.
- Preserve animated output with `.gif` filenames and `image/gif` data URLs while providing a still preview to the model.
- Add guidance for simple animations and spritesheet-based GIF edits.

## Testing

Add integration coverage for GIF generation and editing, explicit frame controls and API defaults, saved animation bytes, and still-preview replay across follow-up turns.

GitOrigin-RevId: 08afa0316ae3675921652157836191a649f563cf
2026-11-03 06:24:24 +00:00
rishab 29eed28082 Enforce strict third-party tool deferral in Code Mode Only (#59071)
## What changed

Restore `code_mode_only_strict_3p_tools` as an opt-in feature under development. When the effective tool mode is Code Mode Only, keep eligible MCP/app and client-supplied dynamic tools deferred and callable through `exec`, regardless of `deferLoading`, `omit_tools_from`, or namespace exclusion and direct-only settings.

Preserve hidden tools, tool policy restrictions, and built-in tool classification. Log conflicting exposure settings without adding warnings to the model prompt. Leave other effective tool modes unaffected.

## Testing

Add coverage for exposure overrides, model mode overrides, built-in name collisions, and hidden or denied tools. Update integration coverage for app access restrictions and MCP catalog refreshes that preserve the cached prompt prefix while `exec` uses the current tools.

GitOrigin-RevId: 0cb085ba9d23bebc48dbc3fa298b982de0a66c47
2026-11-03 06:05:55 +00:00
Eric Traut 9e23a4708a Enable Bedrock onboarding through the local daemon (#59068)
## Why

Bedrock onboarding previously forced an embedded server and was unavailable when connected to a local daemon. Credential discovery uses the server environment, which can differ from the launching shell.

## What changed

- Allow the Bedrock setup wizard to use the local daemon while keeping GCP onboarding on the embedded server.
- Clarify that detected AWS credentials come from the server environment.
- Direct users who export AWS credentials in their shell to run `codex --no-daemon` in that shell.

## Testing

Update wizard eligibility tests and onboarding snapshots, and extend daemon startup coverage to verify discovery of a Bedrock API key available only to an already running daemon.

GitOrigin-RevId: 9502ffaa59250210e8f8bc8db6f82b0803cb6cac
2026-11-03 05:55:13 +00:00
Benjamin Carlsson 7ee5efad4a Add typed item lifecycle events to the cloud client (#59066)
## What changed

Decode live item start and completion notifications as `TranscriptUpdate::ItemStarted` and `TranscriptUpdate::ItemCompleted`, with turn identity, lifecycle timestamps, and summaries for user messages, agent messages, reasoning, commands, and file changes.

Preserve structured agent questions even when message text is empty, optional command output and exit details, and command or patch status independently of lifecycle completion. Keep unsupported or incomplete items as opaque notifications and redact summary fields in debug output.

## Testing

Add fixtures covering lifecycle ordering alongside deltas, identity and timestamps, status and optional-field preservation, structured questions, opaque fallback, malformed payloads, thread ownership, and debug redaction.

GitOrigin-RevId: d6bf2d25ee85be17d895726c5072850a9851b55f
2026-11-03 05:43:27 +00:00
Eric Traut dbaead0106 Classify daemon auto-start failures in TUI telemetry (#59058)
## What changed

Add a `failure_reason` tag to failed TUI auto-start events in `codex.daemon.start`, distinguishing `install`, `spawn`, `early_child_exit`, `readiness_timeout`, and `other` failures. Preserve the original error diagnostics through a classified startup API.

Detect managed child exits during process identity recording and distinguish exits before readiness from readiness timeouts.

## Testing

Extend daemon tests to assert classification of installation failures, spawn failures, early child exits, and readiness timeouts.

GitOrigin-RevId: 7c626f278e9e7f2ecd61b3fd1a90829a113eb232
2026-11-03 04:20:50 +00:00
Eric Traut c5122161fe Tailor MCP doctor remediation to detected problems (#59057)
## Why

MCP checks recommended setting missing environment variables even when the problem was an invalid server configuration or an unreachable URL.

## What changed

Separate configuration errors from missing environment variables and build remediation guidance from all detected issue types. Include server reachability advice for failed HTTP probes, while retaining the option to disable affected servers.

## Testing

Add remediation snapshots for unreachable optional HTTP servers, missing required stdio commands, and a required HTTP server with both a missing token and an unreachable URL.

GitOrigin-RevId: 8e8eb743414297561793be51cf3a25e5bd664f27
2026-11-03 04:20:25 +00:00
Dmitriy Kovalenko 3f958ac2fe Run Bazel CI locally without BuildBuddy credentials (#59055)
## What changed

- Remove automatic BuildBuddy configuration and credential forwarding from Bazel CI, release, SDK, and voice builds. Strip remote execution CI configs in the shared wrapper while retaining explicit remote configurations for local use.
- Use native Windows host tools and audio dependencies for Windows Bazel actions, forwarding the required toolchain and environment settings.
- Initialize message-board MCP servers through a per-session `OnceCell` so server startup does not hold the shared registry lock across an await.
- Expose the message-board test helper to the core Bazel package and update the runtime-auth test call for the `reauth` argument.

GitOrigin-RevId: 5d5c1f4d71fa841090dea8eec8006380981fb65b
2026-11-03 04:08:59 +00:00
Benjamin Carlsson fbf5f0d3a7 Decode live transcript updates in the cloud client (#59047)
## Why

Attach notifications previously exposed only opaque protobuf bytes. Typed transcript events let callers access live text, command output, file changes, and turn state directly.

## What changed

- Add `Event::Transcript` with typed agent-message, command-output, and file-change deltas; patch updates; and turn start/completion events.
- Expose patch kinds and move paths, turn status and failure details, and server-provided timestamps and duration.
- Validate transcript thread IDs. Preserve unsupported or incomplete notifications and other threads' turn lifecycle events as opaque payloads; reject deltas for another thread.
- Keep transcript payloads redacted in `Debug` output.

## Testing

Add independent protobuf fixtures covering Attach decoding, opaque fallback and stream continuation, patch ordering, turn timing and failures, thread validation, repeated oneof variants, unknown fields, and debug redaction.

GitOrigin-RevId: f26b8d4a5b355bb12159136e83310cb57c1546ca
2026-11-03 02:49:40 +00:00
Adam Perry @ OpenAI 7e8143a897 Tie executor attachments to environment selection lifetimes (#59043)
## Why

Removing an executor must detach its selection even when older turn snapshots still reference it. Connection events queued for a removed attachment must not leak into a later selection of the same executor.

## What changed

- Introduce `EnvironmentAttachment` with a detach signal shared by turn snapshots and a guard owned by the selection.
- Preserve attachments across workspace and configuration changes, while giving reselections and child threads independent attachment lifetimes.
- Stop forwarding connection events on detach and discard buffered events from detached attachments.
- Activate initial attachments after `SessionConfigured`, using configured bindings for startup discovery.

## Testing

Add coverage for discarding buffered connection events on reselection and extend snapshot tests to verify immediate detachment, fresh attachments on reselection, and independent parent and child lifetimes.

GitOrigin-RevId: 6cf882e0d17a296030c13d80c6e2866c80e04638
2026-11-03 02:37:20 +00:00
aojiao-oai 16ddd538bd Expose assistant content token counts in completion notifications (#59041)
## What changed

Add optional `contentTokenCount` metadata to `item/completed` notifications, carrying the producer-supplied token count for each completed assistant message in default and plan modes. Counts include any sampled footer and are `null` when unavailable.

Keep this telemetry separate from stored thread items and omit it from subsequent model requests. Update the protocol schemas and generated TypeScript and Python types.

## Testing

Add coverage for per-message counts, including zero, in default and plan modes; missing and malformed metadata; backward-compatible notification decoding; and exclusion from subsequent model requests.

GitOrigin-RevId: 35973037a42650fa2d7569da8e88cb81215cf971
2026-11-03 02:26:29 +00:00
yitaoh-oai e839b828fb Resolve model-selected search providers with policy-aware fallback (#59036)
## Why

Search discovery must account for the active model's supported tools while honoring host search restrictions. Automatic fallback must also preserve the provider that owns existing browsing references.

## What changed

- Resolve search from model metadata, client configuration, and managed requirements, exposing the selected provider's tools.
- Discover hosted search with the model's supported tools and carry the discovered invocation context into calls.
- Allow native fallback for eligible discovery failures only when search policy permits it and hosted search has not already been used. Do not replay failed hosted invocations through native search.
- Keep native fallback references on native search across later turns, discovery recovery, and resume. Release unused fallback offers and coordinate background calls to prevent conflicting provider use.

## Testing

Add app-server and core scenario coverage for provider selection, discovery failures, search restrictions, reference continuity, resume, and concurrent background search. Include a snapshot covering discovery and call history across a model switch.

GitOrigin-RevId: 0f22605722daaa424c4fa34660654cde5a6db049
2026-11-03 02:08:56 +00:00
yitaoh-oai 3c074bb44a Add model Search discovery to MCP bindings (#59034)
## What changed

Add `McpBinding` APIs to discover the model's Search tool profile through an already authorized, host-owned Apps connection. Discovery sends turn metadata, paginates `tools/list`, and returns a scoped binding with the refreshed declaration and connector-provided invocation context.

Require a visible Search tool and an object-valued invocation context. Preserve the context only for calls using the same client, while allowing normal dispatch to recheck visibility, account selection, and approval policy.

Bound discovery to five seconds and distinguish critical timeout, transport, and server errors from unavailability. Expose the existing retryable transport error classifier for this distinction.

## Testing

Add coverage for opaque invocation context extraction and extend transport error classification coverage to HTTP 503 and 403 responses, exercising the exported classifier through a contextual error.

GitOrigin-RevId: 9848d4adb91e3fb2b9406349c31d1fd5c5c47a33
2026-11-03 01:59:24 +00:00
yitaoh-oai b26f682672 Add web search provider metadata and configuration (#59033)
## What changed

- Add optional `ModelInfo.web_search_provider` metadata with `standalone` and `search_mcp` values.
- Add `tools.client_search_provider` and expose its value as `client_search_provider` in app-server configuration responses, with updated JSON schemas, TypeScript types, and Python bindings.
- Register the `hosted_search_policy` feature flag as under development and disabled by default.

GitOrigin-RevId: 263c3f81a61b50f8bb53ff338b9de8186db316e0
2026-11-03 01:58:18 +00:00
sayan-oai f58acd6ede Use prepared MCP owner permissions in Guardian reviews (#59028)
## Why

An MCP server's environment permissions can change after a tool step captures its context. Guardian reviews of direct MCP calls could therefore miss denied paths present in the permissions used to prepare the call.

## What changed

Pass the prepared server environment's sandbox context through MCP approvals and use it to build Guardian's permission evidence, including denied paths and globs resolved for that environment. Keep the sandbox context out of serialized approval actions.

## Testing

Add a regression test that updates a remote MCP owner's permissions after the step starts and verifies that Guardian sees the owner's denied temporary directory. Extend the approval JSON test to verify that supplying sandbox context preserves the serialized action shape.

GitOrigin-RevId: cab0d7c60112a97adf98e5548cdc066b260bb073
2026-11-03 01:41:16 +00:00
rishab 80a8710546 Remove strict third-party tool deferral in Code Mode Only (#59025)
## What changed

Mark `code_mode_only_strict_3p_tools` as removed and stop overriding MCP/app and dynamic tool exposure settings. Code Mode Only now honors `omit_tools_from`, namespace exclusions, direct-only namespaces, and dynamic tool deferral settings without strict-mode exceptions.

## Testing

Update coverage for exposure settings, hidden and policy-denied tools, app access restrictions, and deferred MCP catalog refreshes that preserve the cached prefix while `exec` uses the current tools.

GitOrigin-RevId: 356ccd572f952b5a80ff9a0c31085330b9fe6e8b
2026-11-03 01:31:10 +00:00
Dmitriy Kovalenko 036e160181 Allow concurrent readers of the installation ID (#59021)
## Why

Resolving an existing installation ID takes an exclusive file lock, unnecessarily serializing readers.

## What changed

Read `installation_id` under a shared lock. If its contents are missing or invalid, acquire an exclusive lock and reread the file before generating a UUID, so an ID initialized by another process is reused.

## Testing

Extend the existing UUID reuse test to verify that resolution completes while another shared lock is held on Unix and still restores file permissions to `0o644`.

GitOrigin-RevId: e787d775eddb4d05653d42e809816be9536a94a3
2026-11-03 01:18:58 +00:00
sayan-oai 0585dcb5db Preserve sandbox context in prepared MCP calls (#59020)
## Why

MCP permission profiles need the directory context used to interpret them. Prepared calls must retain that context alongside their captured permissions across runtime refreshes.

## What changed

- Store each server's permission source as thread permissions or a captured environment `FileSystemSandboxContext`.
- Capture environment working directories, home and temporary directories, and materialized workspace roots. Retain the host working directory for thread permissions.
- Expose the captured source through `PreparedMcpCall::permission_source()`, while keeping hosted Apps on thread permissions even when a local environment is attached.

## Testing

Extend binding tests to verify that prepared calls retain environment sandbox paths across refreshes and expose the host working directory for thread permissions. Update elicitation coverage to include hosted Apps with an attached local environment.

GitOrigin-RevId: 87e94605daece324786eebc07b62a507d35e5ced
2026-11-03 01:08:08 +00:00
Ben Romano dec38fc9bb Add WebSocket connection metrics with reauthentication labels (#59018)
## What changed

- Record connection attempts and durations as `codex.websocket.connect` and `codex.websocket.connect.duration_ms`, labeled with `success`, `reauth`, and the configured `product_sku` when present.
- Detect reauthentication by comparing the current auth revision with the last successful connection, preserving that revision across connection resets. Include `auth.reauth` in connection logs and traces.
- Populate session telemetry with the configured product SKU.

## Testing

Extend tests to check reauthentication labels after account switches, product SKU labels for restored sessions, and failed-handshake counts, durations, and labels.

GitOrigin-RevId: 53a38b4460ab9021058dfe2fe104d0441993b18a
2026-11-03 00:59:43 +00:00
Dmitriy Kovalenko c60cda34a3 Make observed thread metadata writes atomic and retryable (#59016)
## Why

A failed memory-mode update could leave other metadata changes applied. Failed observed metadata writes for paginated threads also need to remain pending so persistence can retry them.

## What changed

- Apply observed metadata, memory mode, and optional recency advancement in one SQLite upsert, preserving monotonic recency.
- Require successful SQLite writes for paginated thread metadata when a state runtime is configured, retaining failed writes for retry.
- Use SQLite busy-retry helpers for read-state writes and immediate transactions.

## Testing

Add regression tests that reject SQLite writes to verify pending metadata survives a failed persist and a rejected memory-mode update leaves existing metadata unchanged. Both tests verify a subsequent retry succeeds.

GitOrigin-RevId: 652bf6ebee0197976852aaf9f096b907697fd590
2026-11-03 00:16:13 +00:00
Dmitriy Kovalenko 9e77fb4ad5 Make SQLite schema migrations safe for concurrent startup (#59015)
## Why

SQLx's SQLite migration lock is a no-op, allowing concurrent database openers to race between schema version checks and migration changes.

## What changed

Run schema checks and migrations in one transaction, retrying SQLite busy errors from a fresh snapshot. Databases with a current schema need only a read lock, including on NFS. Include the error cause chain when the app server reports SQLite initialization failures.

## Testing

Add regression tests for eight concurrent database openers applying each migration once and for reopening a current schema while another connection holds a writer reservation with NFS settings.

GitOrigin-RevId: 38004d58a5c637ac1b2be53d07fd9a4c8efec7ab
2026-11-03 00:04:40 +00:00
ioanbudea-OAI 2816088b68 Add optional total token limits to elastic section configuration (#59011)
## What changed

Add `max_total_section_tokens` to `ElasticSectionLimits`, with a builder and accessor. Reject maximums below the section minimum during construction and deserialization. Default to no section maximum and omit the field from serialized output when unset.

Clarify how required evidence uses section minimums and optional evidence can use unused reservations up to section maximums.

GitOrigin-RevId: 850f8ff2795c6e9d2b0d16d3bb0db1c3720e2354
2026-11-02 23:30:58 +00:00
viyatb-oai d92aae5501 Centralize filesystem permission resolution for sandbox enforcement (#59009)
## What changed

- Add `resolve_for_enforcement` to collect filesystem grants, denials, glob patterns, and platform defaults with backend-specific path handling.
- Use the shared result in Linux bubblewrap and macOS Seatbelt policy generation, including Seatbelt scratch access and filesystem policy equivalence checks.
- Pass already-derived filesystem and network policies to Linux seccomp setup instead of converting the permission profile again.

## Testing

Extend the Seatbelt glob test to execute sandboxed commands and verify that relative deny patterns through a symlink block reads and writes while sibling files remain editable.

GitOrigin-RevId: 748603f6b5a6db739b198a0f93a899041612370a
2026-11-02 23:19:47 +00:00
Benjamin Carlsson 26f73fba8f Add host cycling and saved defaults for new TUI conversations (#59007)
## What changed

- With multi-backend support enabled, show the current host before the first submission and use `leader b` to cycle through available connections. Expose the shortcut as `tui.keymap.global.change_host`.
- Preserve the conversation name and composer draft, including cursor position, attachments, pending pastes, and literal versus shell-command interpretation of `!`.
- Save explicit host choices in user-only `tui.default_hosts`, scoped to the local project and user identity. Use the saved host for new conversations, falling back to the first available connection when it is unavailable.
- Prepare the destination and check directory trust before replacing the current conversation. Block switching during voice calls and active turns, and remove replaced blank conversations from the session overview.

## Testing

Add coverage for shortcut visibility and remapping, draft and name preservation, project/user preference isolation, unavailable-host fallback, destination trust and startup failures, and voice-call guards.

GitOrigin-RevId: def7b088951336bec8fe3962954fba9b861f91c6
2026-11-02 23:19:03 +00:00
ioanbudea-OAI 857415f7f2 Preserve Guardian review framing under elastic context limits (#59003)
## Why

Elastic entry caps can shorten review framing and authorization warnings along with supporting evidence. Those boundaries and warnings need to remain intact when evidence is truncated.

## What changed

- Preserve protected framing, host notices, and exact planned actions during elastic entry preparation.
- Carry protection metadata through root conversation, trusted answer, and `node_repl` evidence composition while allowing supporting text to be capped.
- Wrap sender evidence in protected boundaries and a warning that partial context does not transfer permission.

## Testing

Extend elastic-budget regression coverage to verify that exact action JSON, permission boundaries, and sender evidence warnings survive while supporting text is capped.

GitOrigin-RevId: 0b4bebb5a9da3611c92d8176cec99c504e8b7b7b
2026-11-02 23:07:21 +00:00
Adam Perry @ OpenAI 93f9f1a592 Test connection events against active environment selections (#59001)
## What changed

Add an integration test that verifies environment connection events follow the active turn's environment selection:

- A deselected remote environment emits no connection events for that thread.
- Thread startup and reselecting an already connected environment do not replay connection events.
- A reconnected environment notifies threads that select it without duplicate connection events.

Reuse the remote exec-server initialization helper to exercise reconnection.

GitOrigin-RevId: 7e1e630af2e3f051b3367e7cfcb4a0acc0771edc
2026-11-02 22:56:19 +00:00
rhan-oai 52b4526275 Allow hosted child threads to inherit a root session ID (#59000)
## What changed

Expose `InheritedSessionId` so a host can supply a root session ID through `ExtensionDataInit` when starting a fresh child thread. The child retains its distinct thread ID, and the inherited session ID is persisted in rollout metadata and restored on resume.

Reject inherited session IDs for resumed, forked, or native agent threads, and reject an inherited session ID that equals the child thread ID.

## Testing

Add an integration test covering distinct child identity, inherited session metadata, and restoration after shutdown and resume.

GitOrigin-RevId: e3462433f9d8a0bba24251ee2b6d5329557ddb31
2026-11-02 22:45:22 +00:00
Tamir Duberstein adca203576 Preserve steering when returning to a long-running turn (#58998)
## Why

Switching back to a running thread can lose the active turn's state after its `TurnStarted` notification falls out of the bounded replay buffer, breaking steering.

## What changed

Retain the evicted active turn and include it in replay snapshots when it is missing from the stored turns. Clear the retained turn when turns are replaced, the active turn completes, or the thread closes.

## Testing

Add a regression test that evicts the turn-start notification, restores the thread, and submits two steering messages while preserving a queued follow-up. A snapshot verifies the steering messages and queued input remain visible.

GitOrigin-RevId: a4302a2e0990b907207c229361cbcec68ebbbdc4
2026-11-02 22:25:54 +00:00
andrewgu-oai dd2df0aa9d Deliver environment hook decisions while output reads are queued (#58996)
## Why

A completed environment hook can be held up by a queued output-read RPC when its executor is busy, delaying the hook's decision.

## What changed

- Race pushed process events against output polling so a complete, ordered event stream can deliver the hook's output and exit status immediately. Retain polling as a fallback when events are incomplete or unavailable.
- Include launch-parameter preparation in the hook's timeout budget.

## Testing

Extend the executor ownership test to hold the owner's RPC slot while a `PreToolUse` hook finishes. Cover both allowing and blocking commands, checking that the decision arrives before the slot is released and that only the owning executor receives the hook.

GitOrigin-RevId: bc80b99a2a32379e3c2eafefe6db66a6a20f4048
2026-11-02 22:09:34 +00:00
Felipe Coury db227aed42 Add opt-in side conversation panes to the TUI (#58992)
## What changed

- Add the disabled-by-default `tui_workspace` feature for the owned transcript view. At terminal widths of at least 100 columns, show the parent conversation beside its side conversation, with only the focused composer accepting input.
- Retain the inactive conversation's transcript, draft, and status, and restore reading and search state when switching focus.
- Keep drawing and input paused until history replay completes, while refreshing skills in the background.

## Testing

Add snapshots and regression tests for pane resizing and composer styling, retained streaming output, history search after replay, pending skills refreshes, and modal input protection.

GitOrigin-RevId: 68938f263353b0cd3a9e9562e06293bfc8251cc6
2026-11-02 21:47:45 +00:00
Ian MacLeod 23bc6e5f2a Preserve modified Ctrl+C keys in active TUI views (#58990)
## Why

The keypress inspector could not display `ctrl-alt-c` or `ctrl-shift-c` because these keys bypassed the active view as if they were plain `Ctrl+C`.

## What changed

Require the modifier set to be exactly Control for the `Ctrl+C` exception when routing keys to active views. Keys with additional modifiers now reach the active view.

## Testing

Add regression coverage verifying that the inspector displays `ctrl-alt-c` and `ctrl-shift-c`, while plain `Ctrl+C` still closes it for either uppercase or lowercase `C`.

GitOrigin-RevId: cdad4dc73c096e6f07d1a951123db981c4837eac
2026-11-02 21:37:43 +00:00
Charlie Marsh 4460449921 Keep HTTP fallback active for the rest of the session (#58989)
## What changed

Once Responses requests fall back to HTTP after exhausting WebSocket retries or receiving HTTP 426, keep subsequent requests and turns on HTTP for the remainder of the session. Clear cached WebSocket state and remove background recovery probes, recovery trials, and their acknowledgement timeout.

## Testing

Update fallback tests to verify that a second turn stays on HTTP without additional WebSocket attempts. Adjust retry and `Retry-After` request-count assertions to exclude background probes.

GitOrigin-RevId: a4f6376604527c14db8d60f79bd21c3aaf289f70
2026-11-02 21:37:17 +00:00
Won Park ac21e58790 Respect delivery boundaries for injected agent messages (#58988)
## Why

Injected agent messages need to reach active sampling before stale tool calls execute, while messages queued around a final answer must wait for the next task without requesting another response.

## What changed

- Include injected `agent_message` items in mailbox preemption checks when the matching turn still accepts mail and `DeferMailboxPreemption` is disabled.
- Treat injected agent messages as queue-only mail so they do not reopen delivery after a final answer or force a follow-up response.

## Testing

Add a streaming scenario and context snapshot covering idle injection, active sampling preemption, deferred delivery around a final answer, and preservation of message payloads and ordering before the next task.

GitOrigin-RevId: 70f49cbe5074725c11e1fcb33eea05e0e92e17f7
2026-11-02 21:35:56 +00:00
jif 9da07658e2 Move agent message-board backend construction into the extension (#58986)
## What changed

Add `BoardBackend` so the core adapter selects the configured backend and supplies a `MessageBoardHost`, while the extension opens MCP, connected, remote, in-memory, and local boards at thread startup.

Move remote credential handling, HTTP client construction, and backend installation into `codex-agent-message-board-extension`, preserving existing notification delivery semantics.

GitOrigin-RevId: 98fa5525f142596c6cc6b203198fd537546c01d5
2026-11-02 21:22:16 +00:00
rhan-oai 40cf168567 Allow hosts to restrict a thread's root-only capabilities (#58984)
## Why

Hosts need to apply subagent-style capability restrictions without changing a thread's session attribution, agent lineage, or permission profile.

## What changed

Add the public `RestrictRootCapabilities` marker to thread startup extension data. Capture the restriction once at startup and apply it alongside the restrictions native subagents already receive. Hosts must supply the marker again when cold-resuming a restricted thread.

Use the restriction to gate user-input and plugin-install requests, async user messaging, legacy MCP tool approvals, and Full Access MCP form input. Exclude inherited user messages from Guardian's retained authorization context for restricted threads, including after cold resume.

## Testing

Add coverage for host-restricted tool registration, MCP approval rejection, Full Access form-input handling, and inherited instruction authorization after cold resume. Update handler tests to exercise the shared restriction flag.

GitOrigin-RevId: 4d6d7102a20dc747431c7511a74a204c773e8420
2026-11-02 21:09:37 +00:00
richardopenai 6c984676b0 Extend and bound exec-server session recovery (#58983)
## Why

Session recovery needs time for reconnecting and replaying process output, with server retention allowing for differences in when each side detects a disconnect.

## What changed

- Extend client recovery to 50 seconds, reserving the final 5 seconds for process replay, and retain detached sessions and RPC process output for 80 seconds.
- Bound recovery registry requests to 6 seconds and allow 20 seconds for Noise handshake and initialization.
- Abort pending transport tasks when a Noise handshake fails or is cancelled, closing the WebSocket.
- Record recovery timeout stages and retention expiration reasons.

## Testing

Add coverage for closing the WebSocket when a Noise handshake is cancelled and for timing out stalled recovery registry requests while leaving retries to session recovery.

GitOrigin-RevId: 1fe5e41805b7d1bf1aea636f192092d7ec0adcd3
2026-11-02 21:09:09 +00:00
bkotsopoulos 66e3b5a02c Record turn critical path metrics and trace fields (#58980)
## What changed

- Add critical path capture status and duration fields to `codex.turn_profile` traces.
- Emit capture counts for complete and incomplete profiles, and total and component duration histograms for complete profiles, tagged by product SKU and reasoning effort. Record metrics once per turn timing state and skip disabled captures.
- Extend critical path histogram boundaries up to two hours to cover long turns.

## Testing

Add coverage for duplicate reporting, disabled and incomplete captures, product SKU normalization, trace fields, component durations, and extended histogram boundaries.

GitOrigin-RevId: 5b1af9255f1c4a376b61c81eb68c7a74b01ae9ae
2026-11-02 20:57:23 +00:00
Adam Perry @ OpenAI 479c6be7e3 Enable the segment heap on Windows CI runners (#58978)
GitOrigin-RevId: 63f03ec67d19f0ddf08560abe91bbdb923117e40
2026-11-02 20:47:18 +00:00
rhan-oai c725e472e5 Add usage accounting for host-owned agent runtimes (#58975)
## Why

Host-owned runtimes skip controller rollout-budget accounting. Give hosts an optional callback to account for inference spending and signal budget exhaustion.

## What changed

- Add `AgentUsageAccounting`, `AgentUsageReport`, and `UsageAccountingDecision`, captured at startup and supported by host child spawn reservations.
- Await per-response usage reports with thread and turn attribution, including provider budget units and foreground and background compaction usage.
- Map host exhaustion to `SessionBudgetExceeded` and accounting failures to fatal errors without retrying inference. Preserve the original error for incomplete responses.
- Keep controller accounting unchanged and leave accounting disabled for host-owned runtimes without a provider.

## Testing

Add coverage for usage attribution, child accounting, budget exhaustion, nonretryable accounting failures, incomplete responses, and compaction reporting, including background usage charged once to its originating turn.

GitOrigin-RevId: 887703f50fe882497e4e8cb33259072935ec82e0
2026-11-02 20:37:55 +00:00
viyatb-oai 636cdcb7ec Bind final-message output before running sandboxed tools (#58974)
## Why

`codex exec --output-last-message` wrote through a pathname after tools finished, allowing sandbox activity to redirect the final write by replacing that path with a symlink. The related risk is described in https://github.com/openai/codex/pull/25956.

## What changed

- Open the destination before starting the agent and retain its handle until the final write.
- Reject symlinks, Windows reparse points, and multiply linked files; verify that the pathname still identifies the bound file before truncating and after writing.
- Propagate output errors so the command fails when the destination cannot be opened or written safely.
- Preserve inherited Unix output streams, FIFOs, devices, and Windows `NUL` support, while avoiding duplicate final answers when human output targets stdout.

## Testing

Add regression coverage for sandbox-created symlinks across consecutive invocations, redirected stdout, delayed truncation, hard links, replaced paths, and Windows stream binding and filesystem identity checks.

GitOrigin-RevId: 4a31bd28a5eb2d0a9e200cb658eb7d19dc93e933
2026-11-02 20:36:39 +00:00
jif 9c23d93d5b Add opt-in MCP discovery for in-memory agent message boards (#58973)
## What changed

Enable `multi_agent_v2` and the new `agent_message_board_mcp` feature to automatically start a temporary, tree-scoped HTTP MCP message board without plugin or endpoint configuration. The MCP feature defaults off and takes precedence over `agent_message_board`.

Share board state across parent and child agents while retaining each caller's host binding. Keep the server alive while participating threads remain, and serialize board tool calls through the MCP server configuration.

## Testing

Extend the HTTP board integration scenario to cover automatic discovery, parent-child message sharing, child subscriptions and posts after the parent unloads, serialized mutations, and absence of a persistent board database.

GitOrigin-RevId: 613183c14b2ab67dfb1aaf3a3abf338376d1cc05
2026-11-02 20:34:35 +00:00
Ian MacLeod 7accd27956 Fix Escape handling in memory reset confirmation (#58971)
## Why

Pressing `Esc` in the memory reset confirmation could also close the memories settings popup instead of returning to it.

## What changed

Stop forwarding `Esc` to a view's key handler when its cancellation handler has already handled the event, even if the view remains open.

## Testing

Extend the memory reset confirmation test to verify that the first `Esc` returns to settings and the second closes the popup.

GitOrigin-RevId: b842fdaed69a1ac2a6af6fc454e02be2ac8946e6
2026-11-02 20:26:25 +00:00
Eric Traut 8a1d42537d Keep automatic thread title saves off the TUI event loop (#58970)
## Why

Saving a generated title awaited thread metadata reads and name writes in the TUI event handler, delaying its return to keyboard polling.

## What changed

Move automatic title persistence into the background title-generation task. Make metadata reads cancellable and serialize automatic writes with manual renames so a manual name takes precedence, including when an automatic write is already in flight.

## Testing

Extend title tests to check that completion dispatch returns immediately, canceled metadata reads finish, and manual renames wait for in-flight automatic writes. Retain coverage for saving titles to the originating thread after switching threads and preserving existing names.

GitOrigin-RevId: b284a06ca3f0fdcf22fd2fc87b07447f8ab754c0
2026-11-02 20:26:01 +00:00
Eric Traut 6ff7f31cac Avoid unnecessary rendering during TUI history loading and insertion (#58969)
## What changed

- Skip rendered-row counting during history hydration when there is no row budget or no next item page.
- Return early when checking history insertion prefixes if there is no active cell or the placeholder session header must remain active.

GitOrigin-RevId: 669ebf0ceb0fc01c8a7bfd8d2addbcbb6fc6a364
2026-11-02 20:24:40 +00:00
viyatb-oai 0a2d5f556d Move protocol permissions tests into a separate file (#58966)
GitOrigin-RevId: d2fa87eb8502171b93df502187c9511ba0d9de0c
2026-11-02 20:13:51 +00:00
jif 4477dcddf8 Stabilize and enable client tool output retention by default (#58964)
GitOrigin-RevId: 72c1fd5da52a34e39a3a1f2631617aa0c803b61e
2026-11-02 20:11:28 +00:00
rhan-oai d893b14475 Add host-owned turn admission to the agent runtime (#58963)
## What changed

Add `AgentRuntimeOwnership::Host` and an `AgentTurnAdmission` provider so hosts can acquire execution capacity before runtime tasks run, including root turns. Require the provider at startup and retain its execution guard for the task lifetime. Controller ownership remains the default; host ownership skips controller rollout-budget accounting, budget reminders, and subagent roster context.

Keep pending admission interruptible without blocking input submission. Report admission failures through the turn lifecycle, record accepted input before exposing the error, and unwind task setup such as review mode. Preserve recoverable input during suspension. On interruption, skip prompts that still require a `UserPromptSubmit` hook rather than recording them without inspection.

## Testing

Add integration tests for missing-provider startup cleanup, denial and immediate retry, steering during admission, cancellation, execution guard lifetime, submit-hook handling, suspension recovery, and review-mode cleanup. Add a context snapshot verifying retained input reaches the next admitted turn.

GitOrigin-RevId: 9ee85fad2ecfbfb38735bac8ef88888fb179a967
2026-11-02 20:10:37 +00:00
ioanbudea-OAI 9ede2e87ce Preserve Guardian budget policy through review recovery (#58962)
## Why

Deduplicating against optional transcript entries can remove retained instructions or required tool calls even though the optional copies may later be evicted. Elastic instruction caps can also report evidence loss for revisions already delivered in full.

## What changed

- Capture the review's budget policy and use it for feasibility checks, admission, and restoration after compaction.
- Prefer required and protected native messages over optional duplicates, and use only complete, required pending transcript entries as proof of instruction delivery.
- Match elastic instruction duplicates by source revision and discard truncation observations for copies already delivered in full.

## Testing

Extend coverage for compaction recovery under fixed and elastic budgets, required and protected tool-call deduplication, and capped instruction duplicates covered by complete delivery metadata.

GitOrigin-RevId: fe456e645cdba6f782fb16ad582702d3b7ed012c
2026-11-02 20:10:12 +00:00
Charlie Marsh ba0dfd3897 Prefer indexed rollout paths when resolving ancestors (#58960)
## What changed

- Consult SQLite before scanning for ancestor rollouts when no prefetched path is available. Validate that indexed paths resolve to managed storage and match the expected rollout ID and owner.
- Fall back to another copy when an indexed rollout is invalid, preserving the indexed copy's error if recovery fails.
- Skip ancestor cutoff validation when resolving history pages, which read projected rows and only need ancestor metadata for lineage bounds.

## Testing

Add regression coverage for indexed archived and compressed rollouts, invalid paths and owners, fallback recovery during context loading and forking, and history paging with an incomplete compressed ancestor.

GitOrigin-RevId: 486afdc8d49c829130b34d1544f325907c67628a
2026-11-02 19:45:06 +00:00
Charlie Marsh b7ca29d25b Recover inherited history from alternate rollout copies (#58959)
## Why

A fork's inherited history can become unreadable when the preferred ancestor rollout is truncated or has an incomplete compressed frame, even when a usable archived copy exists.

## What changed

- Retry failed ancestor reads using another copy of the same rollout, validating its owner and location before rebuilding the lineage.
- Apply fallback to model-context loading, fork and revert preparation, and paginated history reads. Preserve the original error when no usable replacement exists.
- Validate inherited byte offsets when opening ancestors for consumption, allowing a newer model-context checkpoint to avoid reading an unusable ancestor.
- Limit ancestor materialization to the inherited history boundary while preserving any existing progress beyond it.

## Testing

Add regression coverage for incomplete compressed ancestors, replacement ownership checks, archived-copy recovery during resume and fork, and materialization boundaries. Add an app-server test that cold-resumes a fork and pages inherited turns and items from an archived copy when the active ancestor is too short.

GitOrigin-RevId: 43730c17329ac759f7292b16ddf0d9eb463e3310
2026-11-02 19:44:42 +00:00