Commit Graph
13612 Commits
Author SHA1 Message Date
Benjamin Carlsson b7056f3408 Keep agent overview refresh state scoped to each backend (#61596)
## Why

Switching backends while an overview refresh is pending can lose queued pagination or let a late page consume another backend's refill budget.

## What changed

- Track queued refreshes, “Show more” requests, refill counts, and refresh failures per backend.
- Preserve pending work across backend switches and use registered live request handles to refresh the owning backend.
- Cancel stale reads for the affected backend after mutations, event lag, or disconnects, and hide “Show more” when its backend is disconnected.

## Testing

Add regression coverage for pagination across focus changes, backend-specific refills, pin completion, stale reads after event lag, and connection registration during reconnect.

GitOrigin-RevId: 3429b2b3ac93156b4dc4234ad042431d26c84525
2026-11-15 01:50:45 +00:00
Eric Traut e8e5108c97 Scope TUI history item lookups to their owning turns (#61595)
## Why

Item IDs are unique only within a turn. Reusing an ID across turns can misplace completion boundaries or hide unrelated items when loading older history.

## What changed

Carry turn IDs with paginated history items and key completion grouping and hidden review prompt lookups by both turn ID and item ID. Skip completion boundaries that would move backward through the page.

## Testing

Extend regression coverage to reuse item IDs across turns, checking completion ordering, visibility of unrelated tool items, and pagination without overlapping completion footers.

GitOrigin-RevId: 6cc8e16a1731d5aad4cbfb1c27e51c4665b0a655
2026-11-15 01:46:01 +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 eaa25e1f43 Refactor rollout budget checks and turn completion state (#61583)
## What changed

- Centralize generation admission checks before request contributors run for HTTP and non-warmup WebSocket requests.
- Route pending input and inline compaction through dedicated budget checks, and centralize post-compaction budget handling.
- Preserve whether any checkpoint was installed when remote compaction combines a background candidate with foreground compaction.
- Track accepted final answers separately from trailing commentary and encapsulate the response state shared by stop and after-agent hooks.

## Testing

Update the plan-mode contributor test to verify that contributed commentary is tracked separately from final answers, and adapt stream-event assertions to the phase-aware assistant text representation.

GitOrigin-RevId: 43b663e92bfd24ec7e5a0778b711938f16a7fea4
2026-11-15 00:03:59 +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 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
Benjamin Carlsson d659419fe7 Preserve the current Cloud task until navigation is ready (#61490)
## Why

Opening another Cloud task can fail while loading its history. Keep the current chat, draft, and reply stream intact until the replacement is ready.

## What changed

- Prepare Cloud resumes with a scoped history handle and commit the attachment only after initial history hydration succeeds.
- Discard abandoned or failed preparations, reuse healthy existing attachments, and preserve buffered events through the handoff.
- Route Command Center task selections through the owning backend, including tasks found only in history search.

## Testing

Add regression coverage for failed history loading preserving the chat and draft, prepared stream handoffs and cancellation, backend routing, and history requests completing while a large reply stream remains unread.

GitOrigin-RevId: 67aab50bad4e9ce9216716da459fd5447f133ae1
2026-11-14 08:47:48 +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
Benjamin Carlsson 7924f95421 Keep archived threads read-only and support unarchiving in the TUI (#61486)
## What changed

- Show an archived-thread notice and freeze input while preserving the cached transcript, drafts, pending steers, and question answers.
- Allow `U` to unarchive and resume the displayed thread, and automatically resume it when another client unarchives it.
- Preserve archived state across reconnects and thread selection, and retain drafts when recovery fails or encounters a writer conflict.
- Dismiss transient composer searches and suppress automatic submissions when entering a read-only view.

## Testing

Add regression tests and notice snapshots covering archive recovery, external unarchiving, writer conflicts, reconnects, input preservation, and agent navigation.

GitOrigin-RevId: 695c19790b87df83e51095b400f605e37b309fc1
2026-11-14 07:46:36 +00:00
Benjamin Carlsson 6ddb87e700 Allow Ctrl+C to quit during Cloud session switches (#61481)
## What changed

Handle `Ctrl+C` while preparing a Cloud session and before adopting its thread. Clear buffered draft input first; when no draft or modal handles cancellation, request shutdown and abandon the pending switch.

Cancel abandoned Cloud thread-start requests so they cannot replace the active attachment or block subsequent worker commands. Skip queued starts whose caller has already gone away without disturbing existing recovery.

## Testing

Add regression tests for quitting before thread adoption with pending and completed operations, clearing buffered draft input before quitting, and unblocking the Cloud worker after abandoning regular and project thread starts.

GitOrigin-RevId: 11e8cab13f00f4910a382094d5d857faf72a45bc
2026-11-14 07:19:13 +00:00
Zahan Malkani 05229d1874 Add snapshot pagination for persisted realtime history (#61480)
## What changed

Add experimental `thread/realtime/list` reads independent of turn pagination or a live runtime. Support session, observation-time, and event-ID filters, with ordering by observation time or committed position.

Keep cursor pagination within a fixed snapshot and expose positions for catching up on events committed later. Return `unsupported`, `pending`, or `ready` coverage so clients can distinguish unavailable history from events awaiting indexing. Limit fork reads to the child's own realtime history.

## Testing

Add SQLite tests for snapshot stability, late-event catch-up, cursor validation, and coverage tracking. Extend app-server tests to cover filtering, exact event lookup, and fork isolation.

GitOrigin-RevId: 8158df53f10d948ede4911654aa8adbc7297b258
2026-11-14 07:09:26 +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
Abhinav 9825e4b2fe Use the provider default RPC in the TUI (#61438)
## What changed

- Save default provider selections through `modelProvider/default/set` instead of a generic configuration write.
- Use provider display names in save notices, falling back to the provider ID when the name is blank. Replace the restart hint with “New chats now use {name}.”
- Prompt users to update the connected app server when it does not support the default provider RPC.

## Testing

Update provider tests and snapshots to verify the dedicated RPC, display-name confirmation, and upgrade guidance. Check that only ambiguous write failures invalidate the model catalog.

GitOrigin-RevId: cd383a8b85b5d497e7707691cc0b994110716a09
2026-11-14 01:34:43 +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
Celia Chen de83e7674a Instrument MCP OAuth credential store locks (#61430)
## What changed

- Record acquisition counts, wait durations, and hold durations for file and secrets store locks, tagged by store, lock mode, operation, and originating client. Acquisition metrics also report outcome and contention.
- Preserve the resolved credential store's originating client across storage operations and lock release, and exclude nonblocking probes from lock metrics.
- Add `record_global_duration` for standalone durations with the existing buffering limits and metrics opt-out behavior.

## Testing

Extend tests to verify lock metrics for shared and exclusive access, contention, timeouts, probe exclusion, and originating-client attribution. Add coverage for standalone duration buffering, validation, and opt-out behavior.

GitOrigin-RevId: 96de8bd195477d61bc8cd966c5fbf72ae7156273
2026-11-14 01:21:54 +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
Anton Panasenko 005f910210 Require OAuth CONNECT metadata for Portals TCP tunnels (#61428)
## What changed

Require `x-portals-auth-mode: oauth` in CONNECT metadata when the TCP tunnel listener connects to a known Portals gateway. Reject missing or non-OAuth metadata before reading credentials.

Remove local tunnel JWT type and version checks and treat tokens as opaque bearer credentials. Drop the unused `base64` dependency from `codex-tcp-tunnel`.

## Testing

Replace JWT validation tests with coverage that rejects missing OAuth metadata and accepts OAuth metadata with an opaque access token.

GitOrigin-RevId: 746816f0227280524c019dd90df203b182934751
2026-11-14 00:57:54 +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 01806453b0 Refill the transcript viewport when collapsing tool groups (#61424)
## Why

Collapsing a tool group while reading its expanded details can leave the scroll anchor beyond the new bottom limit, leaving available transcript space unfilled.

## What changed

Clamp the reading position to the bottom limit during collapse layout and persist it after the final viewport height is known. Keep activity focus and reading mode intact, including when copy confirmation changes the composer layout.

## Testing

Add regression coverage for collapsing a scrolled tool group, preserving the resulting view across renders, and rendering a collapsed group with clipboard confirmation.

GitOrigin-RevId: f48271720f7b400736bc02b08b6eafefdb60ac63
2026-11-14 00:43:58 +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
alexsong-oai 51f0b53d8b Clear the user endpoint override during GCP setup (#61420)
## Why

A user-configured `model_providers.gcp.base_url` previously blocked GCP setup, requiring manual removal before configuring a project and location.

## What changed

Have `account/gcp/setup` clear the active user configuration’s `base_url` override after obtaining an access token, allowing the requested project and location to determine the Vertex AI endpoint. Continue rejecting configuration layers that would still supply an endpoint override or otherwise conflict with the request. Document this behavior.

## Testing

Update integration tests to cover clearing an existing override on success, preserving it when authentication fails, and rejecting a managed endpoint override.

GitOrigin-RevId: 26a725133d9069ad63dfb0bb06ddf3c5d1545cad
2026-11-14 00:30:18 +00:00
Eric Traut 2d5bfb7931 Resolve pasted Windows paths with wslpath in WSL (#61419)
## Why

Pasted Windows drive paths were mapped unconditionally to `/mnt/<drive>`, even when that mount was unavailable or WSL used a different mapping.

## What changed

Use `/bin/wslpath -u` with a one-second deadline and require an absolute result. Fall back to `/mnt/<drive>` only when the helper is missing and `/proc/self/mountinfo` confirms the mount exists. Reject fallback paths that traverse above the drive root and return no path when conversion fails.

Share the bounded subprocess output helper with tmux probing.

## Testing

Update coverage for quoted and unquoted Windows paths with spaces. Add fallback tests for a mounted drive, a missing drive mount, and traversal above the drive root.

GitOrigin-RevId: f6a05045b2108722a686e9e5b766fc8cb233bea0
2026-11-14 00:21:47 +00:00
jackz ad8b7f1134 Require a government workspace for the government backend (#61418)
## What changed

Reject workspace routing to `gov.chatgpt.com` when the workspace backend is `NO_CONSTRAINT`, whether the backend comes from the required or effective base URL.

Return an invalid-request error from account reads with `reason: "governmentWorkspaceRequired"` and `action: "relogin"`, prompting users to sign in to a government workspace.

## Testing

Add routing tests covering required and effective government backend URLs, including hostname case and the default HTTPS port.

GitOrigin-RevId: a54b990d2b0dc716122124ee6924538aa06d30d2
2026-11-14 00:19:55 +00:00
Joe Savona fb0715949b Expose Codex rate limits in statusline state (#61417)
## What changed

Add `account.rate_limits` to the statusline snapshot, including the `codex` limit's name, primary and secondary usage percentages, window lengths, and Unix reset timestamps. Emit an empty array when no Codex rate-limit windows are available, and exclude other limit IDs.

Preserve raw reset timestamps alongside the formatted display values.

## Testing

Extend serialization assertions to cover both rate-limit windows, a missing reset timestamp, exclusion of other limit IDs, and the empty-array default.

GitOrigin-RevId: f775c281a17ea2b72cbca810db397f00f16ea5e9
2026-11-14 00:19:21 +00:00
Joe Savona 4495f7ce17 Expose the workspace headline in structured status-line state (#61415)
## What changed

Include the cached workspace headline as `account.workspace.headline` in the structured status-line snapshot. Serialize `account` as an empty object when no headline is available.

## Testing

Extend status-line tests to assert headline serialization and the empty `account` object.

GitOrigin-RevId: 50a923ff3f8bc2fdb0bab3487547979e6d837980
2026-11-14 00:17:57 +00:00
Joe Savona 641e2e362c Ignore stale workspace headline requests and archived messages (#61411)
## Why

Workspace headline request counters restart when the chat widget is replaced, allowing a response for the previous widget to match a new pending request. Archived headlines can also be selected for the status line.

## What changed

- Use UUIDs for workspace headline requests and reject refresh events and responses that do not match the current widget's pending request.
- Skip archived messages when selecting the first non-empty workspace headline.

## Testing

Add a regression test verifying that a replacement widget rejects the previous widget's response while retaining its own pending request. Extend headline selection coverage to include an archived headline before the active one.

GitOrigin-RevId: 44b98ab8c6cb70b7cf8e8b9341f27c99c1e1490a
2026-11-14 00:08:20 +00:00
Joe Savona 5ca2007abe Expose thread costs in statusline state and reject stale usage reads (#61410)
## Why

A replacement chat widget can receive a previous widget's usage result for the same thread. Statusline state also lacks the estimated costs available in the built-in status line.

## What changed

- Add optional `thread.usage.cost.total_cost_usd` and `total_credits` fields, using the built-in status line's plan-specific values. Convert micro-units to ordinary units and omit unavailable or negative values.
- Use UUIDs for thread usage requests and verify that each request is still pending before fetching usage or accepting its result.

## Testing

Add regression coverage for rejecting a previous widget's usage result and assertions for serialized costs across supported enterprise plans.

GitOrigin-RevId: 91c3f7cead0249b673979d17cc108ceae1088df2
2026-11-14 00:07:46 +00:00
Joe Savona e87cd55ed9 Expose context usage in statusline state (#61409)
## What changed

Add `thread.usage.context` with optional `context_window_size`, `used_tokens`, and `used_percentage` fields. Use the latest token report for context usage and the built-in footer's window size and percentage calculations. Omit unavailable fields, including the percentage when the context window is unknown.

## Testing

Extend statusline state tests to cover missing usage, unknown context windows, and footer-consistent percentages, with context usage distinct from cumulative token totals.

GitOrigin-RevId: 699b65f6c047e76fcc7d1ba729eebd19a19e4bcd
2026-11-14 00:07:11 +00:00
Joe Savona 91ae3d10bf Expose token usage totals in statusline state (#61408)
## What changed

Add `thread.usage.total` to the provider-facing statusline snapshot with total input, cache-read input, cache-write input, other input, and output token counts. Preserve cache-write counts when converting app-server token reports for the TUI.

Omit totals when usage is unavailable, the breakdown is invalid, or the report represents a synthetic context fill. Keep measured zero totals.

## Testing

Add coverage for the reported token breakdown, cache counts exceeding total input, synthetic context fills, and measured zero usage.

GitOrigin-RevId: 6c506af30d6e51a49a780a0316304ef9c067fe43
2026-11-14 00:05:32 +00:00
Joe Savona 38cdc4d655 Show the primary executor's workspace in TUI status surfaces (#61405)
## Why

The primary executor's working directory can differ from the app-server's. Displaying the app-server directory can misidentify the workspace, and abbreviating a remote path using the TUI's home directory can be misleading.

## What changed

- Carry the primary environment's working directory through thread initialization, restoration, and settings updates.
- Use it for the status line and terminal title's current-directory item, and expose it as `thread.workspace.cwd` in the statusline state.
- Preserve the known environment directory when settings omit environments; fall back to the app-server directory when the environment list is empty.
- Apply home-directory abbreviation only to server-local workspaces on local connections.

## Testing

Add regression coverage for remote executor paths, omitted and empty environment settings, local-only directory abbreviation, and workspace state for inactive threads. Update the resumed-thread snapshot to display the executor directory.

GitOrigin-RevId: 9f3bcad186e07f942ea00d1f4233cf09f022571f
2026-11-13 23:49:59 +00:00
Joe Savona 68847438b5 Add a structured status-line snapshot for the displayed thread (#61403)
## What changed

Add a serializable `StatuslineState` containing app and status-line configuration, thread identity, agent state, model settings, approvals, and permissions. Reuse the displayed status line's run-state and profile logic, and serialize status-line items with their canonical configuration IDs.

Omit the snapshot for read-only history or when no thread is attached. Omit service-tier, approval, and permission fields until thread settings are confirmed. Use an inferred child thread's reported model and reasoning effort without inheriting the parent's collaboration mode.

## Testing

Add coverage for serialized settings and canonical item IDs, inferred child-thread values, settings confirmation, and snapshot availability before and after interactive resume.

GitOrigin-RevId: 512bdff9b92d886a7764f16955206109f56437d3
2026-11-13 23:27:43 +00:00
jamy-OAI 61bedf383f Update Daybreak links in TUI cybersecurity notices (#61402)
## What changed

- Point `Apply for Daybreak` to `https://chatgpt.com/admin/status-and-access`.
- Point the Astra notice’s `Learn more` link to the Daybreak overview’s model-specific reduced-refusals section.
- Update notice snapshots to reflect the new URLs and line wrapping.

GitOrigin-RevId: 14068e8d6e56ec1a3bf3a0f896b5c36204a9eff8
2026-11-13 23:17:13 +00:00
Celia Chen 43ca762a59 Release MCP OAuth read locks before keyring access (#61401)
## Why

Encrypted MCP OAuth reads hold a shared file lock while accessing the keyring, blocking writers until the keyring lookup and decryption finish.

## What changed

- Add `LocalSecretsSnapshot` to capture ciphertext under the file lock, then release shared read locks before keyring access and decryption. Keep exclusive locks across conditional credential updates.
- Reuse the loaded passphrase when updating existing secrets, avoiding a second keyring lookup. Return an error when an existing encrypted file has no keyring passphrase instead of generating a replacement.
- Update login storage error fixtures to use directory reads that fail consistently across platforms.

## Testing

Add regression coverage for releasing read locks during keyring access, updating secrets with one keyring lookup, rejecting missing passphrases on cached reads, and reading captured snapshots after later writes.

GitOrigin-RevId: add8f60dba52f71c8f8bc10ae8b8ae2f3379ccac
2026-11-13 23:15:54 +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