Commit Graph
3014 Commits
Author SHA1 Message Date
nvogt-oai 39a7b53fa4 Trust the bundled Memory session hook without saved hashes (#62112)
## Why

The bundled Memory hook needs to supply context at startup and after compaction without requiring saved hook trust.

## What changed

Recognize the exact bundled Memory `SessionStart` declaration as a built-in hook: the `^(startup|compact)$` matcher, `codex_apps` server, `codex_dream_memory.get_mec` tool, and empty input. Carry the expected app connector identity through discovery for dispatch checks, and hide this built-in hook from hook listings while preserving other plugin hooks.

## Testing

Add coverage for exact declaration matching, hook listings without an Apps connection, and a scenario snapshot verifying memory context injection at startup and after compaction without saved trust.

GitOrigin-RevId: edc0e8ffa955227328345f46afecc2a868c0be49
2026-11-17 21:40:36 +00:00
andrewgu-oai 6c0cee502d Add GPT-6.2 Sol and Astra to model catalogs (#62106)
## What changed

- Add `gpt-6.2-sol` and `gpt-6.2-astra` to the bundled, Amazon Bedrock, and Vertex catalogs, including Bedrock Runtime global and US cross-region variants.
- Make GPT-6.2 Sol the default catalog selection and refresh model ordering, descriptions, and bundled instructions.
- Increase the GPT-6.1 Sol context window to 500,000 tokens.
- Advertise the `ultrafast` service tier for GPT-6.2 Astra on Bedrock.
- Supply the same current model catalog to both executors in the prompt-prefix compatibility test so catalog updates do not cause prefix mismatches.

## Testing

Extend provider, app-server, and TUI coverage for catalog ordering, model fallback, Vertex requests, and GPT-6.2 Astra's Bedrock `ultrafast` selection and clearing behavior. Refresh model-picker and request snapshots.

GitOrigin-RevId: f28940e4a255fcdd88f7114873259bd1f3399812
2026-11-17 20:04:36 +00:00
RJ 6d40c0ac9b Clarify recovery guidance for stale Guardian authorization (#62099)
## What changed

Give `StaleAuthorization` failures specific guidance explaining that the action did not run and the failure is not a policy denial. Instruct the agent to retry once through Guardian if current instructions authorize the action, resolve unclear authorization before proceeding, and avoid bypassing approval or repeatedly retrying a failed review.

## Testing

Extend the authorization refresh tests to verify the blocked tool output includes this guidance when repeated authorization changes exhaust the review budget, for both approval and denial responses.

GitOrigin-RevId: f6fcbe46fdb5131f70ee905220a58c7331b543fd
2026-11-17 19:09:21 +00:00
adi-oai 0122b120cd Centralize app-server turn error conversion (#62096)
## What changed

Add a shared `From<ErrorEvent>` implementation for `TurnError` and reuse it in thread history, rollout projection, and live event handling. Preserve the existing field mappings and keep `additional_details` unset.

Parameterize the compaction replay test by error code and recoverability, retaining the existing `server_error` case, and document retry expectations for WebSocket closes.

GitOrigin-RevId: 3afcc23e9fdc314477febe6b4a4aeb680efafd5a
2026-11-17 18:56:05 +00:00
Adnan Hajar cb64621bf3 Normalize Bedrock Mantle commentary before replay (#62095)
## Why

Bedrock Mantle's reasoning prefix omits empty `annotations` on assistant commentary. Replayed commentary needs to preserve that form to keep the prefix stable.

## What changed

Add a provider hook to normalize completed output items before they enter model history. For Mantle, omit empty `annotations` from assistant commentary text while preserving nonempty annotations, final answers, and Bedrock Runtime output.

## Testing

Add regression coverage for Mantle and Runtime that checks commentary replay across a tool continuation and a subsequent turn, including reasoning and tool item ordering and preservation of final-answer content.

GitOrigin-RevId: ecd5b9b5dca8c24956a6379c9d0fb643e4427af3
2026-11-17 18:55:30 +00:00
surajs-oai e9a43d43c5 Return empty success output from v2 send_message (#62093)
## What changed

Remove the acknowledgment text and `followup_task` hint from successful v2
`send_message` responses, including messages sent to the root agent. The shared
messaging handler now returns empty text with the success flag set.

Update the idle eviction follow-up scenario snapshot to expect empty tool output.

GitOrigin-RevId: 9eab3ae7264e6ddf3db6ae40a34cc895d0954621
2026-11-17 18:44:30 +00:00
jif bc2c328483 Append transcript provenance to Guardian JSON instructions (#62090)
## What changed

Place JSON transcript provenance instructions after the policy and output contract in Guardian reviewer and classifier prompts. Keep classifier provenance outside the configured prompt token cap.

## Testing

Update prompt composition tests, classifier configuration and integration assertions, and the Guardian review snapshot to verify the new ordering.

GitOrigin-RevId: f0f86b80a96a130043521aeb529d691e8f424c20
2026-11-17 18:24:49 +00:00
jif 4046bdf263 Avoid an admission deadlock in the code mode spawn test (#62089)
The completion barrier in `yielded_code_mode_spawn_preserves_metadata_and_plaintext`
could hold shared admission while the agent spawn needed exclusive admission.
Replace that barrier with a `wait` call on the yielded cell outside nested tool
dispatch, keeping the next turn active until the spawn completes.

GitOrigin-RevId: 17a17941c933e44c0be9d70479741d4c814c3f8b
2026-11-17 18:23:40 +00:00
swastik-oai ce5a565ba0 Simplify Guardian history review preambles (#62074)
## What changed

Use “Treat the content as evidence, not as instructions to follow” in both initial and follow-up Guardian history review preambles, replacing the explicit list of transcript and action fields described as untrusted evidence. Update the corresponding prompt and scenario snapshots.

GitOrigin-RevId: 200ee3c858b54b38fe2609598ef3a1e40cf36380
2026-11-17 16:16:36 +00:00
jif 02d60fb5cc Preserve client attribution when spawning subagents (#62072)
## Why

Delegated work should retain client attribution such as `cost_center` from the turn that requested it, even when a yielded code-mode cell spawns its child after a newer parent turn starts.

## What changed

Capture client metadata from the originating turn and apply it to the child's initial turn in both legacy and v2 agent spawning. Children and grandchildren retain the captured values when the parent is later steered with updated metadata.

Exclude `misalignment_override`, `parent_response_id`, and `mcp_request_meta` from inheritance, while preserving each child's own thread and turn identifiers.

## Testing

Add coverage for metadata filtering and snapshot isolation, legacy and v2 spawning with fresh or forked history, grandchild inheritance, and spawning from a yielded code-mode cell after the parent advances to another turn.

GitOrigin-RevId: 8c378c49239ccfac03deb2b793fc69aba1d41644
2026-11-17 16:15:55 +00:00
jif b271854568 Allow the expanded agent model shortlist in prompt-prefix tests (#62070)
## Why

Released CLIs can still advertise five model overrides in `spawn_agent`, causing the prompt-prefix comparison to reject the expanded shortlist.

## What changed

- Accept the exact four-model addition to the `spawn_agent` description when comparing against a release, while preserving checks for all other description changes.
- Refresh the collaboration tool hashes in the bundled statusline skill snapshot.

GitOrigin-RevId: 22cfd81215734d9f3aba84eda2102c25d75fce96
2026-11-17 16:12:36 +00:00
rhan-oai 5a4aff8431 Expand the spawn_agent model listing cap to 16 (#62051)
## What changed

Raise the model listing cap from 5 to 16 for `spawn_agent` tool descriptions, context catalogs, and unknown-model errors.

## Testing

Add coverage for both catalog modes to verify the 16-model limit, exclusion of hidden and unsupported models, description truncation in context, and matching model choices in unknown-model errors.

GitOrigin-RevId: 9ca20d4ec5bfd67f953c41dbad2b5f55fe2d5421
2026-11-17 14:20:08 +00:00
Sean Huang db9778b73c Distinguish image and tool audio attachment uploads (#62047)
## What changed

Introduce `UploadContent::Image` and `UploadContent::ToolAudio` in `UploadRequest`. Keep image filenames and policy tags on the image variant, and carry tool audio's declared MIME type explicitly instead of encoding its type and MIME metadata in tags.

Update image preparation, image generation, and tool audio callers to use the typed content. Preserve inline bytes for both variants and redact their payloads from debug output. Document that persistent backends must verify the declared audio MIME type against the uploaded bytes.

## Testing

Add coverage for inline tool audio byte preservation and audio debug redaction. Update integration assertions for typed image and audio uploads, and verify that Code Mode does not upload audio when `FileBackedToolAudio` is disabled.

GitOrigin-RevId: 7dbd69922b377aead2dc28d1e5b3938cce6343b7
2026-11-17 13:38:34 +00:00
Joe Savona e20ccdfa80 Add custom status line authoring to /statusline (#62037)
## What changed

- Add “Create a custom status line” when `tui_extensions_statusline` is enabled outside cloud mode. Open a new conversation with an editable draft bound to the bundled `create-statusline` skill when available, falling back to a plain request otherwise.
- Preserve the previous thread’s draft and queued input, including input restored by a late interrupt, while switching conversations.
- Guard against stale create actions and held Enter submitting the new draft. Rename the provider action to “Choose a status line provider”.

## Testing

Add regression coverage for draft editing, bundled skill binding, input preservation, activation-key handling, dismissed setup actions, and hiding the create action in cloud mode.

GitOrigin-RevId: d40dd12914cf38968e605987f67d1ddee5ba7dd1
2026-11-17 12:24:05 +00:00
Joe Savona b47df356af Add a bundled skill for authoring MCP statuslines (#62036)
## What changed

Add the explicitly invoked `create-statusline` skill with guidance for building, registering, and selecting a custom Codex CLI footer provider. Include a Python stdio MCP starter that renders the current thread's model and agent state from each resource read's snapshot.

## Testing

Add a scenario snapshot for loading the bundled skill by name and a Python protocol test covering provider discovery, per-read snapshots, and Unicode text.

GitOrigin-RevId: e48fd5064ad93bf37b50b5643028d4153a3b4f59
2026-11-17 12:22:55 +00:00
Benjamin Carlsson 39b5903898 Set explicit image detail in the restored-history prewarm test (#61969)
Construct the injected image as a `ResponseInputItem::Message` with
`ImageDetail::High` in the restored-history prewarm scenario.

GitOrigin-RevId: 6a414d2c52cb4d2195e6721365c97677c49c956e
2026-11-17 05:17:42 +00:00
Adam Perry @ OpenAI d8d840d32a Capture local attachments before queuing turn input (#61962)
## Why

Queued input can outlive its local attachment files. Reading those files only when rendering a model message can lose media submitted while turn admission is pending.

## What changed

- Introduce `ResolvedUserInput` to carry captured image bytes, audio data URLs, or read errors through session queues and agent input.
- Resolve client attachments on the submitting host before queuing, using a blocking task for local file reads.
- Render messages from captured payloads while preserving original paths and text spans for display, along with image position mappings.

## Testing

Add coverage for rendering and serialization after source files are removed, steered audio retained during pending admission, and local audio errors and display content.

GitOrigin-RevId: 4bbb6bda44167439a8cfdae15d3c476a7b1d336b
2026-11-17 04:08:00 +00:00
bkotsopoulos 65a4450886 Prewarm restored file images on cold resume (#61959)
## Why

Cold resumes warm only base instructions, leaving historical file images out of the WebSocket warm-up.

## What changed

- Add the disabled-by-default `restored_history_prewarm` feature flag.
- Start the WebSocket handshake while history loads, then build the warm-up from restored settings and history when it contains file images.
- Retain the socket and normalized-image cache but discard the image warm-up response ID, so generation resends the full current history and subsequent turns continue from the real response.
- Keep base warm-up for history without file images and defer image preparation to generation when the handshake falls back to HTTP.

## Testing

Add request-history tests and snapshots covering text-only history, interrupted and injected images, resuming with a vision model after image omission, and HTTP fallback without duplicate image resolution.

GitOrigin-RevId: 9a828f44ef0952f7335b5a8c0f7844a069f90d80
2026-11-17 03:48:25 +00:00
rhan-oai 44834c58fa Support turn-scoped exhaustion in host usage accounting (#61958)
## What changed

- Add `UsageAccountingDecision::ExhaustedForTurn` so hosts can fail the current response with `SessionBudgetExceeded` while leaving later turns and peer threads eligible.
- Preserve completed response output and token usage before reporting exhaustion, and track posted charges to avoid accounting twice.
- When steering or mailbox preemption stops a stream, wait for accounting of any completion already observed before starting a follow-up request, and propagate budget errors.

## Testing

Add coverage for preserving output and usage on turn exhaustion, successfully starting a later turn, and reporting turn exhaustion during steering.

GitOrigin-RevId: e673bf30775f27a057fdc39d8429b74ff22121db
2026-11-17 03:28:51 +00:00
Adam Perry @ OpenAI 5b3d2c7fce Extract user input preparation into codex-user-input (#61949)
## What changed

Move local attachment snapshotting and conversion from `UserInput` to model request content out of `codex-protocol` into a dedicated `codex-user-input` crate. Update core, the TUI, and the queue extension to use the new crate, replacing the `ResponseInputItem` conversion methods with `from_user_input`.

Move the associated attachment and message conversion tests alongside the implementation, preserving coverage for image positions, media labels, serialization, and error placeholders.

GitOrigin-RevId: 77d0f94a4cd4c2edc008b9e2e63a989995aab058
2026-11-17 02:43:52 +00:00
Ankush Gupta 0637230e89 Include enclosing tool context in nested Guardian approvals (#61946)
## Why

A nested MCP approval can arrive while its enclosing tool invocation is still running. Follow-up Guardian reviews may use a transcript delta that no longer includes that invocation, leaving out the context in which the nested action was requested.

## What changed

- Add the disabled-by-default `guardian_nested_approval_context` feature to include the host-verified enclosing tool name and arguments in synchronous nested approval requests, while preserving the nested action as the action under review.
- Match the enclosing invocation by call ID and omit ambiguous or unavailable evidence. Exclude Node REPL JavaScript preflight requests.
- Admit enclosing-call context only when it fits the remaining fixed or elastic budget, without displacing ordinary transcript evidence or screenshots.

## Testing

Add MCP elicitation coverage and a request-history snapshot for independent nested reviews and transcript deltas. Add tests for call-ID matching, budget-based omission, and screenshot priority.

GitOrigin-RevId: 9c44a0e8f29f84f84a5322b8362f910f2c91ac55
2026-11-17 02:31:45 +00:00
rhan-oai 34c7cbb454 Allow host-started forks to inherit the root session ID (#61945)
## Why

Host-started forks rejected `InheritedSessionId`, preventing hosts from assigning the root session ID to forked children as they already could for fresh children.

## What changed

Accept `InheritedSessionId` for new or forked threads started directly by the host. Resumed threads continue to use persisted session IDs, and native children continue to use their controller's session ID.

## Testing

Extend hosted-child tests to cover prepared forks, verify that inherited session IDs persist across resume while thread IDs remain distinct, and check that explicit session inheritance is rejected for resumed threads and native children.

GitOrigin-RevId: 90fd24a25e4e927c48395dfae7186bb7fd0e537e
2026-11-17 02:15:09 +00:00
ningyi-oai cc356fd384 Preserve partial Git metadata when worktree status is slow (#61939)
## Why

Memory requests have a one-second Git metadata deadline. Waiting for all Git lookups together discards an already observed HEAD or remote URL when the worktree scan exceeds that deadline. Shared status scans can also describe a different HEAD from the independent lookup.

## What changed

- Publish HEAD, verified remote URLs, and worktree status incrementally, retaining available metadata at the memory request deadline.
- Read HEAD and change status together using Git porcelain v2, and reject status observations that conflict with an independently observed HEAD.
- Run a positive-only change probe over up to four recently modified root directories during memory extraction preparation. Use a completed probe only when full status is unknown and its HEAD matches the request metadata, without waiting for it before sending the request.

## Testing

Add coverage for partial metadata at the deadline, delayed lookups, stale and unborn HEAD observations, positive-only probes, shared scans, and porcelain parsing. Extend remote credential redaction coverage to partial clones.

GitOrigin-RevId: e7b7c250bfc0e23fb8962fcd5cd5febd7c69e2bd
2026-11-17 01:59:51 +00:00
jif f8e58064fc Preserve remote compaction summaries when interrupting child agents (#61916)
## Why

Child agents configured to interrupt at item boundaries should retain the summary when interrupted during remote compaction. An interrupt during post-turn compaction should also preserve the answer already completed.

## What changed

- Keep sampling interrupt registration active through summary installation, then honor the pending interrupt without running post-compaction hooks.
- Deliver an already completed answer when post-turn compaction is interrupted.
- Keep queued follow-ups for a new turn instead of continuing the interrupted turn.

## Testing

Add a streaming scenario test and context snapshot covering interrupts during mid-turn and post-turn remote compaction. Verify that resumed requests retain the summaries, the completed answer is delivered, and each queued follow-up starts a separate turn.

GitOrigin-RevId: 939eb8b3ed24dbdbff10c9f62226e38a0198fd6f
2026-11-16 23:58:12 +00:00
jif cff061fca9 Add opt-in item-boundary interrupts for subagents (#61909)
## What changed

Add the multi-agent v2 setting `interrupt_at_item_boundary`, disabled by default. When enabled, `interrupt_agent` lets a subagent finish and retain its current output item while cancelling tools immediately. Later output items are discarded, and retained tool calls that have not run receive an aborted result.

Wait for the interrupted turn's terminal event before starting follow-up input, and prevent idle contributors from restarting the interrupted child.

## Testing

Add streaming tests for retaining an assistant message or tool call, discarding later output, and preserving history and follow-up input when the child resumes. Update configuration and interrupt-routing tests.

GitOrigin-RevId: 8b2b9b1383bfb4eefea7369a40012bebc5fff07b
2026-11-16 23:26:07 +00:00
sayan-oai ce7079b506 Add opt-in UTC dates to environment context (#61897)
## What changed

Add the disabled-by-default `utc_environment_date` feature to compute the model-visible environment date in UTC and render it as `<current_date_utc>`. Preserve local dates when the feature is disabled.

Track the date's time basis in environment snapshots so switching to UTC emits an update even when the date is unchanged. Use the matching date tag when reporting an unavailable clock.

## Testing

Extend coverage for UTC midnight rollover, unchanged dates within a day, legacy snapshot refresh, and date removal and recovery. Update local and remote compaction snapshots to exercise the UTC date tag.

GitOrigin-RevId: 6e983d05ca2914629c9f8575e2efe3ed274a2f77
2026-11-16 22:27:05 +00:00
RJ c0d47262f3 Acknowledge agent messages and clarify how to wake idle recipients (#61894)
## What changed

Return `Message accepted.` from the v2 `send_message` tool. For non-root recipients, also advise using `followup_task` when an idle agent should act immediately. Messages to the root agent receive only the acknowledgment.

## Testing

Assert the acknowledgment when a child messages the root agent, and update the idle-eviction follow-up snapshot to include the guidance for non-root recipients.

GitOrigin-RevId: bb0cf6039d9b693052a1747daa2e75fa25c13522
2026-11-16 22:07:07 +00:00
jif 3257e1b3eb Allow model metadata to control multi-agent tools in code mode (#61854)
## What changed

Add optional `multi_agent_tools_in_code_mode` model metadata to control whether native multi-agent tools follow the model's `tool_mode`. When `true`, expose them according to `Direct`, `CodeMode`, or `CodeModeOnly`; when `false`, keep them direct-only. When omitted, preserve the `multi_agent_v2.non_code_mode_only` runtime setting.

## Testing

Add coverage for metadata overrides and runtime fallback across all three tool modes, plus serialization and deserialization of absent, null, and boolean metadata values. Update the namespace-prefix integration scenario to enable code-mode tools through model metadata.

GitOrigin-RevId: be90f436066226bf9971cbd17f28c396341bb83a
2026-11-16 18:54:05 +00:00
jif e5839cbc59 Preserve aggregate turn diffs across steering (#61820)
## Why

A steer can restart sampling within the same turn. Recreating the diff tracker loses earlier edits, and changing the working directory can change the meaning of relative diff paths.

## What changed

Keep the diff tracker for the lifetime of the turn and retain each environment's first display root. Refresh cached diff headers when new environments are added. Emit the final aggregate `TurnDiff` before `TurnComplete` instead of at sampling completion.

## Testing

Extend regression coverage for steering during the final flush, with and without additional patches and with a changed working directory. Check final diff ordering across continued sampling and header updates when adding an environment.

GitOrigin-RevId: fbd1ebef072d8486a324190c9125fc1446510802
2026-11-16 14:18:24 +00:00
zm-oai 5a6bbd29a4 Clarify shell-specific login guidance for exec_command (#61744)
## Why

The `login` description claimed a fixed default and described Unix shell flags for every shell. In PowerShell, disabling login startup skips profiles, which can make profile-defined commands unavailable.

## What changed

Describe omitted `login` values as inheriting the setting. When a turn environment reports PowerShell, explain that `login: false` skips profiles and advise keeping profiles enabled for commands that depend on them, including unattended commands.

## Testing

Add coverage for shell-specific descriptions, remote environment readiness, and exact normalization of PowerShell wording in portable tool snapshots. Update prompt-prefix compatibility checks and affected snapshots.

GitOrigin-RevId: f6cb29c6c32921241cbd1be0c31f985c5ae274f9
2026-11-16 04:54:23 +00:00
tongzhou wang 3b8bd2ee7e Add request IDs and attempt numbers to model request hooks (#61587)
## Why

Model request hooks need to correlate attempts belonging to the same generation across retries and model fallback.

## What changed

Add `request_id` and one-based `attempt_number` fields to `PreModelRequest` and `PostModelRequest` inputs and their generated schema. Keep the request ID stable across retries and increment the attempt number for each call to open a response stream.

## Testing

Extend hook tests to verify matching request IDs and increasing attempt numbers across retries. Extend the background compaction scenario to verify that its pre/post hooks share an ID distinct from the ordinary sampling request.

GitOrigin-RevId: 2d85ad6fd630505a89a712cebab6ca0f731610c9
2026-11-15 00:39:00 +00:00
tongzhou wang ce82e38b16 Gate new rollout work on shared budget exhaustion (#61582)
## Why

A budget can be exhausted while another thread waits to start work. New requests, tools, and automatic turns must observe that stop without discarding an already-consumed response whose cost exhausted the budget.

## What changed

- Share a work gate across the rollout tree while preserving native and host accounting ownership.
- Recheck the budget before HTTP and WebSocket requests, hook execution, tool dispatch, and compaction. Prevent automatic wakeups and late input from restarting stopped work, leaving pending input queued.
- Record response costs without rejecting the consumed response solely because its bill exhausts the budget, and stop new work when enforced accounting overflows.
- Expose a thread-registration receipt that remains committed after unload.

## Testing

Extend rollout-budget coverage to verify that accepted response text remains in history after exhaustion and that waiting tools observe the shared stop while completed tools retain their results.

GitOrigin-RevId: e583d657c6f29e374d374cdb014bf23fd6c28614
2026-11-15 00:03:23 +00:00
tongzhou wang 2e61e8ec4e Record neutral interruption markers for rollout budget stops (#61581)
## Why

Turns stopped by an exhausted rollout budget need a history marker without attributing the interruption to the user.

## What changed

- Record and flush a `<turn_aborted>` marker before the terminal event for `SessionBudgetExceeded`, respecting the interrupt-message setting.
- Use neutral guidance in a `developer` message for automatic budget stops.
- Centralize tool-start budget checks across parallel dispatch, tool handlers, and MCP handoff, retaining the check after tool-start observers finish waiting.
- Share interruption classification and history recording across turn and compaction paths.

## Testing

Extend the rollout-budget integration test to assert that both the budget-crossing turn and a later denied turn persist `developer` interruption markers.

GitOrigin-RevId: 2a49ac9824a4e95e4799f2d0f638f8c46889e8e8
2026-11-15 00:02:01 +00:00
tongzhou wang c8c3f70893 Account for synchronous MCP post-hook costs in rollout budgets (#61580)
## What changed

Allow successful synchronous `PostModelRequest` MCP hooks to return `extra_codex_rollout_budget_units` in `structuredContent`. Add these charges to rollout spending while preserving provider usage separately, including completed responses without token usage and incomplete responses with reported usage.

Validate prices as finite and nonnegative. Preserve valid sibling charges when another hook reports an invalid price, and surface accounting failures without retrying inference. Carry hook charges and overflow information through host accounting and enforce local budget limits.

## Testing

Extend coverage for hook-driven budget exhaustion, failed hooks, overflow, interrupted responses, and foreground and background compaction accounting.

GitOrigin-RevId: dc54ba53478d82848bcafb55ecef88215019d09f
2026-11-14 23:53:53 +00:00
tongzhou wang c8e4cbcd94 Support fractional rollout budgets and configurable context reminders (#61579)
## What changed

- Add a positive, finite `features.rollout_budget.limit_budget` allowance while retaining `limit_tokens` compatibility. Reject configurations that specify both.
- Preserve fractional balances in reminders and compare thresholds without rounding the balance down.
- Accumulate charges with compensated summation and allow spending exactly the allowance, including floating-point rounding tolerance for cases such as `0.1 + 0.2` against `0.3`.
- Add `reminder_at_context_start`, defaulting to `true`. Set it to `false` to suppress reminders at thread start and after compaction; combine it with an empty threshold list to disable budget reminders entirely.

## Testing

Extend configuration and rollout-budget tests to cover fractional allowances, legacy integer persistence, invalid limits, threshold-only reminders, and enforcement at decimal equality and after overspending.

GitOrigin-RevId: b8e7a2faa8d39e562bcae196364de419698bc67d
2026-11-14 23:53:23 +00:00
tongzhou wang 92c1a4dc2e Add response processing after completion and usage accounting (#61577)
## Why

Streaming can dispatch tools before a response finishes and its usage is accounted for. Allow callers to wait for completion and synchronous post-hooks so budget enforcement can block tools from the response that exhausts the budget.

## What changed

- Add `responses.process_mode = "after_complete_response"` to buffer response items and release them in order after completion, synchronous post-hooks, and usage accounting. Keep `streaming` as the default and deliver safety-buffering notifications immediately.
- Track whether response usage has already been charged to avoid duplicate accounting, including during compaction.
- Stop new tools across the agent tree when the rollout budget is exhausted. Coordinate steering with accounting and prevent buffered tool calls from dispatching after steering or cancellation.
- Bound buffered responses to 65,535 events and reject overflow.

## Testing

Add configuration coverage and extend integration tests for buffered output ordering, synchronous hooks, interrupted responses and resume, steering, invalid usage, and budget exhaustion preventing tool dispatch.

GitOrigin-RevId: bd06811cfd50cb701babe6353465c57dfed2a37a
2026-11-14 23:50:12 +00:00
tongzhou wang 81b995a6c9 Unify model request hook lifecycles across sampling and compaction (#61562)
## What changed

- Pair `PreModelRequest` and `PostModelRequest` hooks per sampling or compaction attempt, with distinct lifecycle IDs and cancellation reporting.
- Add `thread_id` and `kind` to hook inputs, distinguishing `sampling`, `foreground_compaction`, and `background_compaction`. Include the provider's `response_id` in post-hook inputs when available.
- Wait for synchronous post-hooks before releasing terminal response events, accounting for usage, or installing compaction results. Allow streaming output and tool execution to proceed before the hook finishes, and cancel synchronous post-hooks when their owning request is interrupted.
- Preserve incomplete-response, budget-exceeded, and hook-denied outcomes across sampling retries and compaction model fallback.

## Testing

Add coverage for streaming and tool ordering, interrupted post-hooks, per-attempt metadata, and foreground and background compaction accounting and installation ordering.

GitOrigin-RevId: 3e808c5b3bf2d5a6a326d9f5be5bbd0359b2d16e
2026-11-14 19:40:12 +00:00
goodman-oai 65a5410f72 Add trusted request-country metadata to Responses requests (#61535)
## What changed

- Add `RequestCountry` for host-supplied country codes. Normalize two-letter ASCII codes to uppercase, omit the field by default, and serialize explicit unknown (`XX`) as `null` to prevent fallback to request provenance.
- Carry `request_country` through thread defaults and captured step settings into Codex backend HTTP and WebSocket requests. Allow live country updates without enabling `step_model_switching`, and preserve WebSocket continuation reuse when the country changes.
- Propagate the captured country to subagents, reviews, and compaction requests.

## Testing

Add coverage for country validation and serialization, thread and live-turn update lifetimes, prewarm settings capture, agent inheritance and reloads, compaction and reviews, WebSocket country changes, and HTTP fallback.

GitOrigin-RevId: 787cd1fa7ba5d465a4eb64a92f13c79e93d9bca7
2026-11-14 15:44:38 +00:00
sayan-oai b1573f1024 Describe context and permissions per environment behind a feature flag (#61494)
## Why

Selected environments can have different filesystem and network permissions, but context previously described only the primary environment's rules.

## What changed

- Add the disabled-by-default `per_environment_context` feature.
- Group filesystem and network access under each environment ID, including when only one environment is selected. Label shared network requirements separately.
- Scope permission instructions and incremental updates to each environment. Withdraw stale descriptions and use labeled thread defaults when no environment is ready.
- Track approved command prefixes separately so new approvals do not require repeating unchanged permission instructions.

## Testing

Extend rendering and permission snapshots for scoped context, removed scopes, thread defaults, and format transitions. Update the active-turn scenario to cover two environments with different permissions, changing only the second environment's workspace and permissions and restoring its defaults on the next turn.

GitOrigin-RevId: c948089c12da7b15eee378d8c5a23a233d24502b
2026-11-14 09:43:57 +00:00
Zahan Malkani 5943d7acdf Persist timestamped realtime frames before acknowledging completion (#61473)
## What changed

- Record voice transcripts as `frame` items with a `voice_transcript` channel for eligible threads, while retaining legacy transcript support and the existing app-server live and mixed timeline representation.
- Assign first-observed timestamps that never move backward, retain them through completion, and restore the clock floor from history and compaction checkpoints.
- Flush realtime records before completion notifications, including file and initial directory durability barriers for local rollouts.
- Generate a distinct default session ID for each new call, use the call ID when attaching to an existing call, and derive opening record IDs from session IDs.
- Add protocol types for turn-input acceptance and session-end input receipts, excluding those receipts from live notifications and mixed timelines. Update generated schemas and SDK types.

## Testing

Add coverage for frame serialization and required voice payloads, clock rollback and checkpoint restoration, durability barrier failures and retries, per-call session IDs, and persisted transcript availability immediately after completion.

GitOrigin-RevId: 3f6632b517d563861aee085b723475b8945c391c
2026-11-14 06:14:36 +00:00
Ruslan Nigmatullin c2c1ebba0a Add optional tool output rendering for context window hints (#61452)
## What changed

Add the token-budget setting `context_window_as_tool_output`, defaulting to `false`. When enabled, render agent identity, context window IDs, and associated hints as an `agent.thread_hint` tool output. Use the same format for agent identity updates in forked threads.

Preserve this setting when applying model token-budget defaults without treating it as an explicit budget override.

## Testing

Update fork scenario snapshots to cover tool output rendering, including a child agent's window hint after its inherited parent context and a prediction fork above the compaction threshold.

GitOrigin-RevId: e1a7089935bd0aed44ffd15f0ae3ec41a2607218
2026-11-14 02:55:41 +00:00
Anthony Tafoya d26406987e Add explicit cloud catalog refresh before turn admission (#61449)
## Why

Hosts need to refresh cloud plugin and skill catalogs without starting a turn or waiting for step preparation.

## What changed

- Add `CodexThread::refresh_cloud_plugins()` and a turn-independent extension callback that bypass cached catalog reuse and failure cooldowns.
- Run catalog contributors concurrently while serializing publication with step snapshot capture. Invalidate MCP resource caches before explicit discovery and schedule MCP reconciliation afterward.
- Accept complete and partial catalogs, report discovery errors, and keep failed or cancelled refreshes retryable.
- Allow hosts to gate cloud plugin discovery through effective configuration.

## Testing

Add coverage for discovery before turn admission, catalog replacement and reuse, immediate retry after failure, concurrent contributors, and cancellation-safe publication and invalidation.

GitOrigin-RevId: 83e847fcab6562581af2c9e831b1d2a310f2b270
2026-11-14 02:45:51 +00:00
dob-oai 8afe928a76 Avoid starting dormant REPL servers for cleanup hooks (#61437)
## Why

Bundled `turn_ended` hooks can start an unused REPL server solely to clean it up, even though its deferred startup means there is no process to clean up.

## What changed

Allow bundled cleanup calls for `node_repl` and `cua_repl` to return an empty successful result when startup has never been requested. Limit this behavior to configured, unshared local stdio connections using the legacy MCP protocol. Other calls continue to wait for server startup.

## Testing

Add coverage for the connection eligibility checks and extend subagent hook tests to verify that bundled cleanup leaves unused REPL servers dormant while ordinary hooks can still start cached tools hidden from the model.

GitOrigin-RevId: 0a07772fccd670c53348ff7a702b4bee353e263c
2026-11-14 01:34:12 +00:00
Anthony Tafoya 6d919e65e2 Refresh cloud plugin and skill catalogs during step preparation (#61429)
## Why

Installing a plugin without connector tools must still refresh a cached cloud skill catalog so its skills are visible to the next inference.

## What changed

- Rely on step preparation for cloud plugin and skill discovery, removing their turn-start callbacks and the `requires_mcp_runtime` lifecycle hook.
- Request an MCP runtime refresh after every completed plugin install, including skills-only installs.

## Testing

Add regression coverage for skills becoming visible immediately after a connector-free install. Update lifecycle tests to cover discovery after MCP reconciliation, prewarm skipping discovery, cancellation allowing subsequent preparation, and reuse of unchanged connections. Use deterministic DNS lookups in network proxy authorization tests.

GitOrigin-RevId: 76036bd29253fb8987e606c3c28411c689590fc4
2026-11-14 01:11:17 +00:00
Alex Kira 27e2227b2b Enable incremental tools by default for Amazon Bedrock (#61426)
## What changed

Enable `incremental_tools_legacy` by default so both Amazon Bedrock providers publish tool declarations through `additional_tools` input items. Users can still opt out by setting `incremental_tools_legacy = false`.

## Testing

Update the incremental tool scenarios to cover the default behavior and explicit opt-out for both Bedrock providers. Adjust the Bedrock multi-agent test to verify collaboration tools in `additional_tools` declarations.

GitOrigin-RevId: 7a54aed24039d178f9b7d7f5a3f49fe4d588ffa7
2026-11-14 00:56:00 +00:00
Abhinav 4598f33790 Use thread-scoped model catalogs for model lookups (#61421)
## Why

Model lookups through the startup catalog can use the wrong provider's capabilities or instructions after a default provider switch or when a thread has its own catalog.

## What changed

- Resolve model metadata for sampling, prediction forks, and memory writes through the owning thread's catalog.
- Make the thread's models manager available to extensions before startup callbacks and use it for guardian sampler configuration.
- Import external sessions using the destination provider and originator's catalog, loading its offline cache only when no refreshed catalog is available.

## Testing

Add regression coverage for sampling after a default provider switch, parent-specific prediction fork capabilities, thread-scoped model lookups, and imported sessions retaining destination provider instructions and originator.

GitOrigin-RevId: c86081b9e55c5e2b42a7f082966485d7fb5139d4
2026-11-14 00:32:02 +00:00
Anthony Tafoya 0b297ec5ee Retry incomplete cloud catalogs with exponential backoff (#61400)
## What changed

- Keep partial cloud skill and plugin catalogs, and catalogs with warnings, usable while retrying discovery with exponential backoff. Start retries after 5 seconds and cap the delay at 5 minutes; clear backoff after a complete, warning-free result.
- Replace previous catalog entries with each accepted result, including partial results, and clear cached cloud skill resources when publishing a replacement.
- Check catalog freshness across turns and steps using auth and resource identity. Auth or resource changes bypass retry cooldowns, including within the same turn.

## Testing

Add and update tests for retry delays and recovery, concurrent refreshes, auth and resource invalidation, partial catalog replacement, and cloud skill read-cache replacement.

GitOrigin-RevId: 0ce5a9d5596e8a73d7084abbbaeb4fb8cda84aa0
2026-11-13 23:14:47 +00:00
Matthew Zeng e8f5d2bb55 Restore shared connector metadata for Codex Apps tools (#61398)
## Why

When an Apps `tools/list` response supplies connector names and descriptions in shared `openai/apps` metadata, tools need those fields restored to expose the correct namespaces and descriptions to the model.

## What changed

Match tools to shared connector metadata by `connector_id` on each response page and copy nonempty names and descriptions into tool metadata before conversion. Restrict this handling to Codex Apps; regular MCP servers use the standard tool listing path.

## Testing

Add a regression test with two tool pages that verifies both connectors' namespaces and descriptions appear in the model's tools state.

GitOrigin-RevId: d4c8b44007773ff65d3e366669ee5c705a480cb1
2026-11-13 23:05:04 +00:00
ioanbudea-OAI f626b8fde9 Remove legacy sandbox-policy accessors from configuration (#61395)
## What changed

- Remove `Config::legacy_sandbox_policy` and `Permissions::legacy_sandbox_policy`.
- Update core and TUI tests to use permission profiles and filesystem/network policies directly, with explicit conversion where legacy wire formats are required.
- Report the active sandbox label in app-server resume override mismatch diagnostics.

GitOrigin-RevId: cbc5417944e23404523e69dc5516d66d6bfafefe
2026-11-13 23:03:49 +00:00
Hung 5158e9780e Add opt-in file-backed tool audio (#61394)
## What changed

- Add the disabled-by-default `file_backed_tool_audio` feature to prepare fresh function and custom tool audio through the attachment store before persistence. Store returned file IDs in history and preserve them on replay without uploading again.
- Validate and budget mixed text and audio output before uploading retained clips, preserving audio token charges and producer limits. Resolve tool audio durations before continuation compaction checks.
- Keep inline audio on backend upload failures and use text placeholders for invalid or rejected clips. Replace unavailable tool audio files with placeholders in prompts while retaining the original history, so restored files can be used again.
- Treat file-backed tool audio as a competing source when attributing audio or unknown-file errors to user uploads.

## Testing

Add coverage for direct tool and Code Mode audio across follow-up turns, file expiration, restoration, and resume in both legacy and paginated history. Extend tests for truncation before upload, upload failure handling, bounded error placeholders, and error attribution.

GitOrigin-RevId: 66c1e7699c7d92f98c3a2d0f5cecbbd63147eb6c
2026-11-13 23:02:16 +00:00