Commit Graph
6443 Commits
Author SHA1 Message Date
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 f226c9ccfb Recheck rollout budgets before starting tool work (#61578)
## Why

A rollout budget can be exhausted while a tool call waits for an execution slot, approval, or a lifecycle callback. Checking only when scheduling the call can allow new work to start after the budget is exhausted.

## What changed

- Recheck the budget after acquiring an execution slot, immediately before starting a handler, and immediately before handing an MCP request to the server.
- Report refused calls as aborted in tool outputs, lifecycle callbacks, and dispatch traces, while allowing already-running work to complete.
- Track handler start time separately from dispatch waiting and preserve terminal outcomes when cancellation arrives during completion callbacks.

## Testing

Add regression coverage for queued calls and calls paused in start callbacks when the budget is exhausted. Verify MCP requests are blocked before handoff and retain successful results after handoff, and assert budget-stop state during remote compaction.

GitOrigin-RevId: 573730391452256592d3512f15929a2fbdf03c57
2026-11-14 23:52:50 +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
ningyi-oai 048431dcbe Harden Git remote collection and limit remote URL metadata (#61488)
## Why

Parsing `git remote -v` can mistake partial clone filter text for remote entries. Large remote URLs can also push turn metadata beyond the Responses API's 8,096-character limit.

## What changed

- Read fetch URLs from NUL-delimited Git configuration, sanitize credentials, and let Git resolve `insteadOf` rewrites and empty URL resets without contacting remotes.
- Resolve ambiguous URLs with bounded concurrency and a shared deadline, and expose an observer that publishes verified URLs as they become available.
- When turn metadata exceeds the limit, fit complete remote URLs into the remaining budget while preserving other metadata. Prioritize `origin`, then shorter entries; omit URLs rather than truncate repository identities. Apply this to both client metadata and compatibility headers.

## Testing

Add regression coverage for partial clone filter injection, URL rewrites and resets, malformed and non-UTF-8 configuration, `GIT_CONFIG` overrides, progressive updates, and long remote URLs. Add metadata tests for the exact size boundary, oversized remote omission, ASCII serialization, and preservation of other fields.

GitOrigin-RevId: 522ffe291db6113ca9856fc98309609c8abe4ac0
2026-11-14 08:26:47 +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 336b19ab26 Move JSON byte counting into codex-utils-string (#61465)
Export `serialized_json_bytes` from `codex-utils-string` and update core callers to use the shared helper. Preserve byte counting without retaining the serialized output.

GitOrigin-RevId: 9c75b05592d3171b9a0d54517f8f3a4281fde987
2026-11-14 05:00:21 +00:00
Ruslan Nigmatullin ecf54824c6 Refactor session mail recording and compaction metadata capture (#61461)
## What changed

- Consume the optional delivery handle directly when recording inter-agent messages.
- Capture compaction resume metadata before constructing the `CompactedItem`.
- Move the existing inter-agent message rollout and resume test into `mail_publication_tests.rs`, preserving its assertions for turn IDs, timestamps, persisted metadata, and restored history.

GitOrigin-RevId: 761a837922377d5a72266d775622211e43fa87d3
2026-11-14 04:16:22 +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
Brent Traut 32cec881b7 Add thread ID inclusion filters to thread/list (#61446)
## Why

Clients reconciling saved thread IDs need to retrieve matching summaries within the current list filters, including threads beyond the first page of history.

## What changed

- Add `includedThreadIds` with up to 100 entries, applied before pagination alongside existing filters. Exclusions take precedence, and results retain the requested list sort.
- Treat omitted or null inclusions as unrestricted and an empty array as matching nothing. Reject invalid IDs and oversized arrays without truncating them.
- Use indexed metadata and primary-key lookups for local inclusion queries, without scanning rollouts for repairs. IDs absent from the index do not match.
- Update protocol schemas, generated bindings, and documentation, including guidance to verify server support before treating missing saved IDs as removals.

## Testing

Add coverage for saved IDs across project moves and archiving, pagination, exclusions, validation limits, and combinations with search, account, and relationship filters. Add a SQLite query-plan test for primary-key lookups across scopes.

GitOrigin-RevId: 90b02a12aee5716f872a9d5d6168d23cf86c6333
2026-11-14 02:23:37 +00:00
Charlie Marsh e9919f4b4e Add process-local launch directories for shared MCP servers (#61444)
## What changed

- Add hidden app-server options `--plugin-mcp-launch-cwd` and `--mcp-launch-cwd` for host-supplied local stdio server launch directories without writing them to shared configuration.
- Apply these directories when both `mcp_shared_repl_cwd` and `mcp_connection_sharing` are enabled. For configured servers, require a matching executable and preserve any explicit working directory.
- Attach thread-specific sandbox state to direct MCP tool calls for servers advertising support, stripping caller-supplied sandbox and launcher metadata first.

## Testing

Add regression tests for launch-directory feature toggling and executable matching, and for direct MCP calls using each thread's sandbox working directory despite forged caller metadata.

GitOrigin-RevId: d7f78ea92163ec0ee9311f68ef17e87a6694b13b
2026-11-14 01:54:53 +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
Max Johnson 9ac8c3f8d7 Close abandoned tool dispatch traces as aborted (#61434)
## Why

Interrupting a turn while a tool awaits approval can leave its rollout trace execution marked as running without an end timestamp.

## What changed

Record an `Aborted` end event when a tool dispatch trace is dropped before producing a result. Make completion and failure methods consume the trace handle so each dispatch is closed once.

## Testing

Add coverage for dropping a pending dispatch and for interrupting a turn with a pending command approval, verifying that replay reports an aborted execution with an end timestamp.

GitOrigin-RevId: 63cf68312fcbff8c6b85a01a7713cf4460c9d795
2026-11-14 01:32:55 +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
Felipe Coury 68c63d72d3 Add keyboard table selection to the transcript (#61422)
## What changed

- Add configurable `pager.mark_markdown`, bound to the leader followed by `v`, to mark the table cell under the selection caret.
- Use arrows or `hjkl` to extend a rectangular cell selection, `o` to swap corners, and `y` to copy. Press `v` to select text within the active cell without including neighboring cells, including across wrapped lines.
- Show table-specific footer hints and route the marking chord in both the main transcript and transcript overlays.

## Testing

Add coverage for cell rectangles, header-only selections, empty cells, wrapped text, Unicode and escaped pipes, Markdown copying, search cancellation, mouse takeover, and chord routing with remapped find and leader keys.

GitOrigin-RevId: 81ed9e52092bba3c7ef064e95043d2c070df0f4c
2026-11-14 00:32:35 +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
Alex Zamoshchin f941a5fb92 Add optional release IDs to cloud plugin source locations (#61393)
## What changed

Add `release_id: Option<String>` to `PluginSourceLocation::Cloud` to carry the opaque release ID selected by the cloud catalog for a plugin declaration. Update catalog and discovery test fixtures to supply the new field, including a populated release ID in catalog reconciliation tests.

GitOrigin-RevId: 1d60e25bd5fb8efd84e6e825305ad68b847fc1ee
2026-11-13 22:44:55 +00:00
viyatb-oai f5fb19fc4a Normalize managed network requirements before merging (#61391)
## Why

Managed network requirements support both legacy tables and `permissions.network`. Equivalent declarations in one source should be accepted, while older runtime clients still need the top-level network field.

## What changed

- Normalize `network_proxy` and `experimental_network` into `permissions.network` before merging requirements, preserving source attribution and explicit empty allowlist replacements.
- Accept legacy and nested declarations in one source when they describe the same policy, comparing domain and review selectors by their canonical identities. Continue rejecting mixed surfaces across sources.
- Populate the legacy output field for compatibility and preserve legacy selector text when both forms are supplied.
- Include contributing requirement sources in cloud bundle errors without exposing submitted TOML.

## Testing

Add coverage for equivalent and conflicting declarations, empty allowlist overrides, loader compatibility, and debug output. Add a proxy regression test verifying that a saved grant cannot bypass managed loopback restrictions.

GitOrigin-RevId: e0d2a600f5c7c6c07a665ccc0e18a72ff172fd6d
2026-11-13 22:31:23 +00:00
Dylan Hurd 347143f140 Preserve active additional context across compaction (#61390)
## Why

Compaction can drop active client context while deduplication prevents unchanged values from being sent again on subsequent turns.

## What changed

Track additional context by history item ID and restore active items when installing complete or prefix compaction results. Preserve their history order, refresh retained items with their original bounded payloads, and leave queued updates to arrive with their input.

## Testing

Add regression coverage for local compaction with message context and remote compaction with tool-output context. Verify that current context survives exactly once, stale values are absent, and restored context precedes the preserved user prompt.

GitOrigin-RevId: a3114f387c6a4ae1a2d1651993d0f7a101be7dd5
2026-11-13 22:19:12 +00:00
Charlie Marsh 1c76c0bc08 Reduce session submission channel memory with boxed payloads (#61389)
## Why

The bounded submission channel reserves all slots at session startup, including space for a full `Submission` in each slot.

## What changed

Send `Box<Submission>` through the channel so each slot reserves only pointer-sized payload storage, allocating full submissions as needed. Update submission producers, delegate forwarding, and test helpers to pass boxed submissions, and unbox them in the submission loop.

GitOrigin-RevId: d8d9c613683076d74fcb3e2f2cb6244c5857bca2
2026-11-13 22:18:34 +00:00
Alex Zamoshchin 42f950cd11 Refresh plugin recommendations when tooling state changes (#61387)
## Why

Cached recommendations can keep offering a plugin after installation. Refreshing the shared catalog during step preparation can also leave the recommendation prompt and install handler with different candidates.

## What changed

- Check `tooling_changed_at` before reusing recommendations, with a one-second reuse window and a 250 ms deadline that includes authentication. Refresh the catalog when the marker changes, preserving cached recommendations on failure and retrying on a later poll.
- Scope recommendation and featured-plugin caches by product, backend, and account identity, and share concurrent recommendation refreshes.
- Use the same recommendation snapshot for a step's prompt and install handler, while allowing later steps to observe updated recommendations.

## Testing

Add coverage for marker changes, missing markers, refresh failures, concurrent and cancelled requests, and the authentication deadline. Extend integration tests to verify consistent step candidates and stop offering an installed plugin while preserving the original recommendation block in conversation history.

GitOrigin-RevId: 44fa6723a623d9604f0c768118bc6889d2d3b693
2026-11-13 22:16:32 +00:00
Anthony Tafoya 826b6e8199 Reuse cloud plugin catalogs across turns until invalidated (#61386)
## Why

Cloud plugin discovery previously ran each turn even when authentication and Apps resources were unchanged.

## What changed

- Reuse complete, warning-free catalogs across turns, including empty catalogs, while authentication and the Apps resource cache key match.
- Retry partial catalogs and catalogs with warnings on subsequent turns, preserving failure backoff.
- Reject discovery results if authentication or Apps resources changed while discovery was in flight. Hosts must invalidate Apps resources when the remote plugin catalog changes.

## Testing

Extend lifecycle tests to cover populated and empty cache reuse, resource and auth invalidation during discovery, and reuse of the empty catalog after plugin revocation.

GitOrigin-RevId: f0f0f4fd5a83179d722ba3cb917deec7eef18458
2026-11-13 22:01:26 +00:00
surajs-oai 14813d3616 Add configurable idle heartbeats to Code Mode gRPC streams (#61385)
## What changed

- Add `code_mode.heartbeat_interval_s` to configure heartbeats after inactivity on session-event and tool-call streams. The default value of `0` disables heartbeats.
- Pass the interval through session options and gRPC requests, preserving provider defaults when overriding it.
- Ignore heartbeat messages in the client without admitting tool callbacks, and reject tool-call heartbeats that carry invocation data.

## Testing

Add coverage for disabled heartbeats, repeated idle heartbeats and timer resets after traffic, callback handling, and configuration loading. Extend TCP integration tests to verify heartbeats on both streams and continued session operation after idle periods.

GitOrigin-RevId: bf0b6d3081b5541837d07f35931e0dd3e5472c3b
2026-11-13 21:53:25 +00:00
Ruslan Nigmatullin 4aac2eacc5 Make clock reads synchronous and remove client clock requests (#61382)
## What changed

- Make `TimeProvider::current_time` and `CodexThread::current_time` synchronous, with clock reads required to avoid yielding or calling back into the session.
- Remove the experimental `currentTime/read` app-server request and its client-backed clock and sleep polling implementation.
- Require a host-provided `TimeProvider` for external clocks. App-server thread startup now fails when `features.current_time_reminder.clock_source = "external"` has no provider.

## Testing

Add coverage for external provider selection and rejection of app-server thread startup without an external provider.

GitOrigin-RevId: 09479d6eb28453b343dee78b3673092e73ae5d73
2026-11-13 21:51:53 +00:00
Vivian Fang e40b0e62e2 Update the harness provenance comment in context history (#61381)
GitOrigin-RevId: f53e93d355bb97737859b0f4c50862bda961872b
2026-11-13 21:51:23 +00:00
Alex Zamoshchin a46c5be77e Delegate installed plugin recommendation filtering to the endpoint (#61374)
## What changed

Request plugin suggestions with `includeInstalled=false` and use the endpoint results without filtering against loaded plugins or the local installed-plugin cache. Retain disabled-tool and client eligibility filtering, and remove plugin loading that was only needed for recommendation filtering.

## Testing

Update tests to verify the query parameter and confirm that endpoint recommendations survive local installed-cache filtering while disabled tools remain excluded.

GitOrigin-RevId: a1b199f9ac8da7dae40abe46b6ccfaf1d8230a5c
2026-11-13 21:00:04 +00:00
ioanbudea-OAI 400a1e1e82 Use native permission profiles for diagnostics and sandbox checks (#61369)
## What changed

- Derive sampling diagnostic and rollout trace labels directly from permission profiles instead of constructing legacy sandbox policies. Rename the trace metadata field from `sandbox_policy` to `permissions_profile`.
- Extract `with_workspace_write_cwd` to share default workspace metadata protections between legacy policy conversion and the TUI's sandbox-mode compatibility check. Build the check's workspace-write profile from filesystem and network permissions directly.

## Testing

Add a regression test confirming that the sandbox-mode compatibility check accepts standard workspace metadata protections and rejects a profile with an additional writable `.git` root.

GitOrigin-RevId: f20d23afd80dff6347865df3d6a94d6f5e90e1e0
2026-11-13 20:22:45 +00:00
Krish Chainani ae12a9d645 Add deferred MCP reprojection for the next regular turn (#61356)
## What changed

Add `CodexThread::reproject_mcp_on_next_turn()` to request an MCP reprojection after `TurnStarted` and before tools are bound. Repeated requests coalesce, and idle reconciliation or prewarming leaves the request pending until the next regular turn.

## Testing

Add coverage for deferred requests surviving prewarm and idle reconciliation, coalescing into one reprojection, and exposing refreshed tools in the turn's first model request. Verify that discovery starts after `TurnStarted`.

GitOrigin-RevId: 260b2381013291a47eb9a7f736c129de76c5897f
2026-11-13 18:52:09 +00:00
Sean Huang 76a8ca3914 Upgrade Bazel rules_rs to 0.2.3 (#61355)
## What changed

- Use the `rules_rs` 0.2.3 registry release instead of an archive override, and upgrade `platforms` to 1.1.0.
- Disable root crate alias targets and migrate explicit dependencies to package labels such as `@crates//tokio`. Disable root crate data for the argument comment linter's crate repository.
- Refresh the retained `rules_rs` patches, remove the zlib snapshot URL backport, and drop extra dependency declarations from `exec-server` and `v8-poc`.

GitOrigin-RevId: c354413a19b45964104457063c613028f5325bc0
2026-11-13 18:51:30 +00:00
viyatb-oai d87330d91e Add managed CA defaults for Deno and Google Cloud SDK (#61349)
## What changed

Set `DENO_CERT` and `CLOUDSDK_CORE_CUSTOM_CA_CERTS_FILE` to the managed proxy CA bundle when unset, preserving explicit values, including empty strings. Keep these client settings separate from the CA roots imported into the proxy trust bundle.

Preserve shell startup overrides when replaying snapshots, regenerate managed CA defaults instead of capturing them, and allow sandboxed processes to read the managed bundle referenced by these variables.

## Testing

Extend regression coverage for default CA settings, explicit overrides, trust-root selection, shell snapshots, and restricted sandbox access to the generated CA bundle.

GitOrigin-RevId: 2761706b54e0bb230c37bd4c515204c6eba0c650
2026-11-13 18:48:18 +00:00
ioanbudea-OAI 6919e2cd8e Apply elastic entry caps to Guardian classifier evidence (#61346)
## Why

Trusted classifier evidence needs to fit configured entry limits while preserving complete records and metadata that reflects only delivered reviews.

## What changed

Apply elastic caps before rendering trusted tools, trusted skills, and previous reviews into developer messages. Omit oversized tool attestations and review fragments whole, retain only complete skill paths that fit, and record omissions for the request's omission notice. Keep review IDs aligned with retained fragments and preserve fixed-budget behavior.

## Testing

Add coverage for whole-record omissions, retained review IDs, and omission notices. Exercise orchestrator connector evidence with both fixed budgeting and an elastic tool entry cap.

GitOrigin-RevId: 729db452026f93b59765a3936730b9b6dddfcf9a
2026-11-13 18:47:15 +00:00
ioanbudea-OAI a655b50de9 Add opt-in elastic budgeting for asynchronous Guardian requests (#61345)
## What changed

- Add `async_elastic_budgeting` and `async_elastic_sections` under `[features.guardianv2]`, independently of synchronous budgeting and disabled by default.
- Apply section limits and elastic allocation to new classifier evidence after accounting for setup and retained conversation history. Preserve the configured elastic policy when applying model defaults.
- Keep permission context whole during elastic allocation and record truncation observations when image preparation rejects an image.

## Testing

Add coverage for configuration validation, fixed and elastic conversation budgeting, retained history and cursor preservation, and complete classifier requests that retain evidence beyond the fixed entry limit.

GitOrigin-RevId: 2955f0482f7c3e18325e296fc2ccb6592ffcb73a
2026-11-13 18:46:45 +00:00
Vivian Fang c33002259e Add per-item retention policies for injected history (#61344)
## What changed

Allow `thread/inject_items` to accept wrapped items with `retention: "default"` or `retention: "always"`, while preserving support for raw response items. Persist explicit policies separately from legacy client-authored metadata.

Carry explicitly retained items through local and remote compaction, context-window changes, and child-agent creation, subject to retention budgets. Preserve history order and keep retained tool exchanges together; require matching calls and outputs to be adjacent in the injection request and both marked `always`.

Update Quinn dependencies and record exceptions for additional Hickory DNSSEC advisories where DNSSEC is disabled.

## Testing

Update injection tests for explicit retention metadata and extend the compaction scenario to cover a retained tool exchange across repeated compaction and restart.

GitOrigin-RevId: 1195a4ed62dc162a62e58bc2ad733262fbabea27
2026-11-13 18:46:13 +00:00
Vivian Fang 7844815bd7 Add opt-in prompt image sanitization (#61341)
## What changed

- Add the disabled-by-default `safe_image_decoder` feature to decode and re-encode prompt images without source metadata, with byte and decoded-pixel limits.
- Apply JPEG orientation and supported ICC color conversion to sRGB, emitting PNG for PNG/GIF inputs and JPEG for JPEG/WebP inputs.
- Use the selected decoder for image preparation, `view_image` validation, and MCP image validation. Include the decoder in image cache keys.
- Preserve original inline images in history metadata so resume and fork can regenerate prepared images without repeated JPEG encoding changing their bytes.

## Testing

Add regression tests for identical JPEG replay after history serialization and for preventing legacy cache entries from bypassing sanitization.

GitOrigin-RevId: 718cd83d0a233e2eb8efd1a64c14d8944e44c350
2026-11-13 18:44:31 +00:00
tongzhou wang 9d12d007b2 Record host-confirmed Code Mode wait targets in rollout traces (#61338)
## Why

Inferring wait targets from request arguments can abort trace replay on malformed arguments and link waits to cells the host never resolved.

## What changed

Record an explicit `CodeCellWaitTargetResolved` event when the host confirms a live cell, and expose its runtime handle as `resolved_wait_runtime_cell_id` on the tool call. Build cell wait links from these observations, preserving links while cell source is pending and preventing late confirmations from linking to recycled handles after thread resume.

Older traces no longer infer wait links from request arguments, so an empty `wait_tool_call_ids` list does not establish that nobody waited on a cell.

## Testing

Extend dispatch and replay tests to cover live, missing, and invalid wait targets, pending cell source, legacy traces, and runtime handle reuse across threads and resume.

GitOrigin-RevId: 0f13b291c197c5487258b6ce36276cf1f19e2b6d
2026-11-13 18:43:21 +00:00
viyatb-oai c79dfb1d9c Centralize managed network proxy startup (#61337)
## What changed

Add `NetworkProxy::start_managed` and use it in core and exec-server to share proxy construction, startup, and error context. Keep approval-policy selection in core and pass the active decider and blocked-request observer to the shared helper.

## Testing

Expand session coverage for a full-access to workspace-write profile change: verify decider calls with approvals enabled, approvals disabled, and a final managed allowlist, and verify blocked-request notifications in each case.

GitOrigin-RevId: 97abdaa9af698166f46d74e0f231ec557d346200
2026-11-13 18:42:34 +00:00
smurching-oai 69231e119b Add and preserve the marketplace auto-update setting (#61286)
## What changed

- Add `marketplaces.<name>.auto_update` to the configuration type and schema, defaulting to `false`.
- Preserve `auto_update` when re-adding a marketplace with the same source type and source, including equivalent normalized local paths. Drop it when the source changes.
- Preserve existing marketplace entries when converting an inline `marketplaces` table for editing.

## Testing

Add regression tests for re-adding the same Git source, replacing it with another source, and re-adding an equivalent local path.

GitOrigin-RevId: 8a4108f1c8fc5a20a8564ead5baeef57e7ccfa19
2026-11-13 08:25:41 +00:00
sayan-oai c899e21cda Accept explicit contribution context for MCP runtime configuration (#61283)
## What changed

- Make `McpManager::runtime_config` accept `McpServerContributionContext` and honor its originator, selected environments, and disabled plugin IDs.
- Add `McpServerContributionContext::for_host` to carry thread initialization data, originator, and session source without live extension state or discovery.
- Pass explicit global contexts from threadless discovery and control paths.

## Testing

Extend the thread manager test to cover host-only contribution identity, originator headers, and server restrictions for disabled plugins and pending environments.

GitOrigin-RevId: 04ea2c8951187d9014867f0020223b6a7dd94d8d
2026-11-13 07:35:46 +00:00
viyatb-oai 5045589550 Consolidate Windows filesystem helper sandbox preparation (#61276)
## What changed

Remove `SandboxDirectSpawnTransformRequest` and `transform_for_direct_spawn` in favor of `SandboxManager::for_file_system_helpers().transform()`. Keep Windows wrapper preparation specific to filesystem helpers, and return `SandboxUnavailable` when a Windows token sandbox is requested for a filesystem helper on a non-Windows executor.

Record the helper permission entry count during launch policy preparation, before adding runtime read grants.

## Testing

Cover Windows helper executable read access and explicit workspace write grants, including empty workspace roots. Verify rejection of non-native policy working directories and Windows token helper sandboxes on Unix. Extend the helper isolation test to exercise sandboxed writes as well as reads.

GitOrigin-RevId: f95bb94e12d8d7c6e5c773644abb7b59b47ffc4a
2026-11-13 06:39:52 +00:00
Max Johnson 72be450854 Refactor session window access and async compaction test setup (#61263)
## What changed

- Read response window metadata through `current_window_from_state` with an explicit session state lock, releasing it before assembling response metadata.
- Name the token budget feature check used when restoring a forked child window.
- Pass an explicit `TestEnv` into the async compaction test helper and build with `build_with_environment`.

GitOrigin-RevId: 7ad852dbd65689e814f62cad645330ac5dac80f4
2026-11-13 05:15:59 +00:00