Commit Graph
2750 Commits
Author SHA1 Message Date
jameswt-oai 1b80bd9412 Allow per-tool approval reviewers for Codex apps (#62360)
## Why

A connected account or app can choose an approval reviewer, but that
setting applies across its tools. Users may want to review calendar
event creation themselves while keeping automatic review for other tools.

## What changed

Set `approvals_reviewer` on an individual app tool in `config.toml`:

```toml
[apps.calendar.tools.calendar_create_event]
approvals_reviewer = "user"
```

Codex matches the tool by raw name first and falls back to its title.
The tool's reviewer takes precedence over the connected account, app,
app defaults, and session settings, subject to managed requirements.
This applies to tool-call approval prompts and MCP approval requests
that match a verified app tool invocation. The app-server
`config/read` response also exposes the per-tool setting.

## Testing

Extend coverage for reviewer precedence, tool title fallback, managed
review requirements, tool-call approval routing, strict MCP elicitation,
and app-server config reads.

GitOrigin-RevId: c92bd39b9e708dada9d314c19a446b4c580edf91
2026-11-18 20:42:18 +00:00
Alex Chang cc7a62e19c Report API spend limit errors by scope (#62329)
## Why

Generic quota errors hide whether the project or organization spend limit
blocked a request. Reporting the scope tells users which limit to check.

## What changed

Recognize API key, project, and organization spend limit errors across
HTTP, SSE, and WebSocket responses. Show a message that names the scope and
treat the error as non-retryable, even when the provider sends
`Retry-After`. Apply the existing usage-limit handling to goals and
compaction.

Expose distinct `CodexErrorInfo` values in the app-server protocol and
generated bindings so clients can identify the limit in live errors and
failed turn history.

## Testing

Extend the transport tests to cover all three scopes and verify that they
stop retries. Extend the app-server test to check that the error survives
`thread/read` and that a subsequent turn can succeed in the same thread.

GitOrigin-RevId: 03341f7a78daa7540e7baa519f1a29ec07e34509
2026-11-18 18:11:54 +00:00
viyatb-oai 6257fbc4bd Move sandbox preparation into platform backends (#62317)
## What changed

Have `SandboxManager` handle backend selection and shared preparation, then
delegate command wrapping and session setup to the Linux, macOS Seatbelt,
Windows token, and Windows MXC backends.

Centralize Windows managed proxy routing in `codex-sandboxing` so the exec
server and other callers use the same rule for selecting dedicated MXC
listeners.

GitOrigin-RevId: a75886809aefebf6c267bb39dbc104f76bda3409
2026-11-18 17:09:03 +00:00
felixxia-oai 081f205f42 Use Guardian V3 board evidence for synchronous approvals (#62310)
## Why

A pending action can reach approval review before Guardian V3 has routed
the latest user messages to the reviewer's subscribed channels. That
can leave a revocation or renewed approval out of the evidence used to
decide the action.

## What changed

Attach the Guardian V3 reviewer to the synchronous approval path when
available. Start evidence catch-up when the action requests review,
then deliver queued evidence before submitting it for a verdict. If
preparation fails, report the reason and block the action.

Request strict structured output for board routing. Represent channel
description updates as a list, reject duplicate descriptions and empty
routes, and write each source once per distinct destination.

## Testing

Add app-server coverage for subscribed revocation and reapproval,
unavailable evidence, routing failures, and native review when V3 is
disabled or the thread is ephemeral. Add routing tests for duplicate
descriptions, duplicate destinations, and empty routes.

GitOrigin-RevId: 193802d39c120fbad9d77544ab57f4b5d02576b0
2026-11-18 16:18:34 +00:00
Zahan Malkani bd00a8a42e Preserve pending realtime speech when a call ends (#62299)
## Why

A realtime call can end with completed speech that has yet to reach a
Codex turn. The next turn needs that context even if the call's transport
has already disconnected.

## What changed

- For V3 calls with realtime frame history enabled, save pending speech
  as context for the next turn. Restore it on thread reload and exclude
  it from the turn count used by rollback.
- Drain already received transcript events and settle pending handoffs
  before saving the call's closing marker. Report recovery required if
  shutdown cannot confirm that history was saved.
- Keep transport detach separate from ending a call. Reattaching restores
  saved pending speech, and an open call can be ended from persisted
  history after a reload. Use the call ID for TUI attachments so successive
  calls on one thread have distinct history.

## Testing

Add coverage for queued speech at hangup, reconnect and stop after
reload, retries after an uncertain write, and rollback across saved
session-end context.

GitOrigin-RevId: 657491f1d7e446a1a48e22189758810c8bdd82cb
2026-11-18 15:24:29 +00:00
Zahan Malkani 29cb67623c Gate local realtime frame history on paginated storage (#62271)
## Why

Legacy rollout migration rewrites rolled-back history and can disrupt
the realtime stream. Enroll local threads once they use paginated history
so the stream stays intact.

## What changed

- Add the off-by-default `features.realtime_frames_local` flag for
  paginated local threads with a state database. Accept runtime updates
  through the app server and keep threads enrolled once they have a
  persisted canonical session start.
- Add thread-store APIs to recover a realtime session and look up the
  latest session ID from durable history. Route frame completion through
  a store seal so completion acknowledges durable writes.
- Add a local seal for accepted model input that writes source frames
  before the input and lets callers retry an uncertain flush without
  appending the input twice.

## Testing

Cover enrollment for legacy and paginated threads, continued enrollment
after disabling the flag, and retrying a local input seal after a failed
directory sync.

GitOrigin-RevId: 2012feeca3857da90f9b026f077b31a26d15191b
2026-11-18 12:55:14 +00:00
Zahan Malkani 4389a526d5 Derive realtime input receipts from thread history (#62251)
## Why

Accepted handoffs and saved transcript chunks need to appear in realtime
history. Their text can come from the same user message that model history
uses, avoiding a second persisted copy for the receipt.

## What changed

- Reconstruct `turnInputAccepted` and transcript chunk receipts from user
  messages annotated with realtime provenance. Use the stored observation
  time when restoring the realtime clock.
- Replace `sessionEndInputSaved` in the app-server protocol with
  `sessionInputSaved` and a `reason` of `chunk` or `sessionEnd`. Update the
  generated schemas and bindings.

## Testing

Add coverage for reconstructing both receipt types, preserving rollout
order in paginated realtime history, and restoring observation time
across a restart after wall-clock rollback.

GitOrigin-RevId: fcb4e0e539f4e4066726e83fa1e945fb659a2ca8
2026-11-18 11:01:02 +00:00
alexsong-oai 24e236514b Allow Bedrock Runtime selection during setup and login (#62222)
## Why

The app server's Bedrock setup and login flows always selected Mantle.
Clients using Bedrock Runtime had to configure that provider separately.

## What changed

Accept an optional `providerId` in `account/bedrock/setup` for AWS profiles
and environment credentials, and in `account/login/start` for Bedrock API
keys and AWS access keys. Pass `"amazon-bedrock-runtime"` to select
Runtime. Omit the field or pass `null` to keep the Mantle default.

Save configuration for the selected provider and check that provider for
an existing `aws.credential_export` before changing credential sources.

## Testing

Extend app-server tests to cover Runtime setup with profiles and
environment credentials, Runtime login with both key types, and Mantle
fallback. Verify that environment setup selects the Runtime default
model for a new thread and that a configured Runtime credential exporter
blocks profile setup.

GitOrigin-RevId: 6396b638208ab9b12f50f13f13bd517a919d0848
2026-11-18 07:43:45 +00:00
viyatb-oai a4495dd5c9 Keep sandbox preparation with the command through launch (#62205)
## What changed

- Keep the prepared `SandboxExecRequest` intact in core and let
  `command/exec` borrow the prepared command for streaming. Windows
  restricted-token commands continue through the dedicated sandbox launcher.
- Move runtime read-path selection for exec-server commands and filesystem
  helpers into `SandboxManager`. It derives the paths from the executor's
  binaries and, for managed process launches, finds the generated proxy CA
  bundle in the command environment.

GitOrigin-RevId: 8c9d278496d84589bc4a7b7d0ed08cb1b8e6ba21
2026-11-18 06:22:36 +00:00
viyatb-oai 89feadf3cc Preserve saved sandbox permissions when resuming codex exec (#62194)
## Why

`codex exec resume` sends the current process's sandbox defaults as
overrides. A session started with `:read-only` can therefore resume with
workspace write access when the configured default is `:workspace`.

## What changed

- Restore the saved permission selection, working directory, and workspace
  roots by default. Honor explicit overrides and append directories requested
  with `--add-dir` to the resumed workspace roots.
- Recover built-in read-only permissions from older history without widening
  current read access. Require an explicit permission selection when a saved
  named profile cannot be loaded or saved read-only access cannot be restored.
- Report sandbox permissions and writable roots from the running thread.

## Testing

Add regression coverage for a denied write on the first resumed shell call,
legacy read-only history, explicit permission overrides, and workspace root
preservation with and without `--add-dir`.

GitOrigin-RevId: ed2cf3132f9ce34570661f801c9534a55696e3a5
2026-11-18 05:13:56 +00:00
viyatb-oai 6ee9bc1ba7 Select process sandboxes during launch preparation (#62183)
## Why

Workspace-relative permission rules need to resolve against the execution
host's workspace roots so a grant applies to the intended directory.
Restricted launches also need to check that the host can provide the
required sandbox.

## What changed

- Select the platform sandbox while preparing a launch, using the permission
  profile, network requirements, and Windows sandbox settings.
- Pass workspace roots into policy resolution for local commands and shell
  snapshots. Already-bound command profiles validate their concrete paths
  without resolving Windows launcher hints on hosts that do not use them.
- Share local launch preparation between tool commands and shell snapshots,
  and require a platform sandbox for exec-server launches that request one.

## Testing

Cover network-only restrictions and verify that a
`:workspace_roots` write grant allows writes to the configured subdirectory
under the command's working directory while denying writes to a sibling file
and the corresponding subdirectory under the parent. Exercise the path grant
through both app-server command execution and WebSocket exec-server execution.

GitOrigin-RevId: 492fe7ab8deddf30cfd2e2bdabf28d02d67e00c5
2026-11-18 03:59:37 +00:00
Dylan Hurd 345f166d01 Wait for the search connector in hosted web search tests (#62165)
## Why

MCP tool catalogs can change during startup, so a search binding
captured during startup may go uncached. That makes the test's
per-turn discovery request count depend on startup timing.

## What changed

When hosted search is allowed, wait for the thread's connector to
report `ready` before starting the first turn. This lets the test
check discovery reuse with a stable binding.

GitOrigin-RevId: 50d77eca6bfa7a6bfd5657e4c1ed3aad52beb8c5
2026-11-18 02:31:46 +00:00
Dylan Hurd b65d9a3b2d Stabilize app-server app/list integration tests (#62162)
## Why

Fixed delays make notification-order assertions sensitive to when the mock
directory and tool requests finish. Model discovery can also make network
requests while these tests exercise app listing.

## What changed

- Pause mock directory responses until the tests receive the expected tool
  update. During forced refetch, assert that the next notification includes
  the fresh directory so an intermediate inaccessible-only update fails the
  test.
- Use the bundled model catalog through `model_catalog_json` and preserve
  that setting when the thread feature flag test rewrites `config.toml`.

GitOrigin-RevId: 0356d757391f15cdcee99a6ac3311dc78b8df00b
2026-11-18 02:17:25 +00:00
JonLuca De Caro 67d8266e06 Signal workspace routing readiness in account updates (#62145)
## Why

App-server clients receive `account/updated` both when routing is ready
for a saved ChatGPT workspace and when a user logs in, logs out, or
switches workspaces. The notification payload gives clients no explicit
way to identify the initial routing update.

## What changed

Add a nullable `reason` to `account/updated`. Set it to
`workspaceRoutingReady` on the initial saved-workspace routing
notification when the authenticated owner is unchanged, including when
routing is ready before the connection initializes. Login, logout, and
workspace-switch updates send `null`. Update the protocol schemas,
TypeScript types, and Python SDK models.

## Testing

Extend the app-server integration tests to check the reason in the JSON
payloads for saved-workspace discovery, login, workspace switching, and
logout.

GitOrigin-RevId: 96758519985a6bdb07474e48307ed53b125823ee
2026-11-18 00:46:17 +00:00
Owen Lin 06789c7618 Preserve web search provider ownership across thread resumes (#62144)
## Why

Search MCP and native web search produce provider-specific references.
Switching providers after a thread resumes can mix those references and
break follow-up calls that use them.

## What changed

Persist whether a thread has used Search MCP, native web search, or
neither. Restore that state from response history, including compacted
history, and use legacy attribution and fallback markers for older
threads. When resumed history lacks a search state or legacy attribution
checkpoint, withhold native fallback unless a legacy marker identifies
native search.

Require every Search MCP call to claim the thread's search provider
before execution, including calls retained by Code Mode.

## Testing

Cover resuming a thread with Search MCP references after discovery
becomes unavailable, both with a saved search state and with imported
history that lacks search checkpoints.

GitOrigin-RevId: 100d21c92b0bdbf737ec36c3474f0bc020df8efc
2026-11-18 00:45:07 +00:00
matthewdavis-oai 3bf4e138fe Stream partial thread search results and support cancellation (#62132)
## Why

Clients using `thread/search` have to wait for the search to finish before
they can show any matches. A search can also outlive the query that triggered
it, such as when a user changes their task mention query.

## What changed

- Add experimental `thread/search/stream` with best-effort
  `thread/search/partial` notifications. Each notification carries the original
  `requestId` and a batch of verified matches. Clients replace provisional
  matches with the final page, which determines results, ordering, and cursors.
- Support connection-scoped cancellation through `thread/search/stream/cancel`
  and `thread/search/cancel` for their respective search methods. Disconnecting
  also stops active searches and reaps their search subprocesses.
- Cancel superseded or timed-out TUI task mention searches without delaying
  available title matches.

## Testing

Add coverage for incremental results and final-page parity, slow clients,
connection-scoped cancellation and subprocess cleanup, and TUI task search
cancellation.

GitOrigin-RevId: b58abf7a1df424f191c8ede806d1d5266d299548
2026-11-17 23:46:48 +00:00
Dylan Hurd c90234de95 Isolate auth storage attribution tests from account switches (#62131)
## Why

Switching accounts revokes in-flight metric exports, which can interrupt
the auth storage events these app-server tests use to verify client
attribution.

## What changed

- Add a device-code login test that blocks the credential save by making
  `auth.json` a directory. Verify that login reports the failure and that
  the storage metric carries the `codex_vscode` originator. Keep the
  successful login and notification checks in their own test.
- Seed the concurrent-client test with the API key all three clients use
  so their writes keep the same account. Point the turn-cost probe at a
  local mock server and disable online model discovery.

GitOrigin-RevId: e735c2e0f81c6e58fd545943b47ff7bbd11339d7
2026-11-17 23:45:23 +00:00
marksteinbrick-oai 9c60cb0a27 Include classifier turn IDs in Guardian v2 analytics (#62125)
## Why

Guardian v2 classification events need the classifier's turn ID to
correlate outcomes with the corresponding Responses requests.

## What changed

Assign one turn ID per classification and reuse it across request retries.
Once request preparation succeeds, include the same ID from
`client_metadata.turn_id` as `classifier_turn_id` in the classification event.

## Testing

Extend the scoped tool approval integration test to check that the event's
classifier turn ID matches the request metadata.

GitOrigin-RevId: b3ed4bea12cdc06d0b742775f34f296e9c4de376
2026-11-17 23:15:04 +00:00
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
Abhinav 8fca6ffb92 Support OTel header helpers in local managed requirements (#62110)
## What changed

- Allow system `requirements.toml` and MDM requirements to set `otel.headers_helper` and `otel.headers_helper_refresh_interval_ms`, and expose both fields through the requirements API.
- Require an absolute executable path and run managed helpers directly from their installation directory. Reject helper settings from cloud requirements.
- Restrict managed helper headers to OTLP HTTP exporters with nonempty endpoints configured in the same requirements layer. Replacing the helper or an exporter revokes the previous binding.
- Document deployment and rollback requirements, including client compatibility and pausing affected exports until a failed helper recovers.

## Testing

Add coverage for exporter layer boundaries, cloud policy rejection, relative path rejection, managed helper execution and recovery, missing executable diagnostics, and requirements API output.

GitOrigin-RevId: 271058010c2e3090eb97cb357b70be4dc41b43db
2026-11-17 21:10:09 +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
Charlie Marsh 9a56c2b1aa Preserve plugin runtimes across catalog metadata updates (#62105)
## Why

An advertised plugin release or installation metadata change should preserve live MCP sessions and cached skills while the active local bundle remains unchanged, including when an upgrade fails.

## What changed

- Compare runtime identity, enablement, connector ownership, and the active bundle separately from catalog release, policy, and display metadata.
- Track the active bundle's directory version and persisted remote plugin ID so changes made by another process refresh the runtime.
- Retain pending runtime notifications until a host callback is available and deliver them through `plugin/reconcile`.
- Preserve cancellation recovery across retries while avoiding unnecessary runtime invalidation for catalog fetch failures.

## Testing

Add unit and app-server regression coverage for catalog-only updates, failed upgrades, externally activated bundles, deferred notifications, and reconciliation recovery.

GitOrigin-RevId: ab20012c1bfd760adea55614f49fbbc7ef86fe8b
2026-11-17 19:46:24 +00:00
Dylan Hurd 7fb2cd20c8 Stabilize app-server and login integration tests (#62102)
## What changed

- Run guardian action-budget permission hooks locally with a host-accessible working directory, and apply the test timeout to thread startup.
- Use an empty probe file for the process-spawn handshake, removing the content assertion after file creation is detected.
- Remove the explicit graceful shutdown from the config-server login/logout test.
- Wait for fallback login cancellation to finish and assert that it returns an error, replacing the two-second timeout.

GitOrigin-RevId: a696834162bf910bf114c35648366a4f94bb56f2
2026-11-17 19:23:05 +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
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 cac9284d24 Test prompt-prefix preservation across app-server resume (#62071)
Add a persisted-thread resume test with incremental tools enabled. Change the model description between app-server runs to force an updated `spawn_agent` declaration, then verify that resume preserves the original instructions, tools, and input prefix and appends the updated declaration.

Use the released binary from `CONTRACT_EXECUTOR_BIN` for the initial run when available; otherwise, use the current binary for both runs.

GitOrigin-RevId: 4a53d54ca0e8638277b27d9d6bec6ac46bdef5dd
2026-11-17 16:14:00 +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
jif 58627e6fea Fix turn interrupt reply ordering and shutdown handling (#62066)
## Why

A delayed terminal event from an earlier turn could acknowledge interrupts for a later turn. Interrupts could also remain pending after the thread listener shut down.

## What changed

- Associate pending `turn/interrupt` requests with their target turn and reply only when that turn completes or aborts.
- Track the current Core turn through stop hooks and resolve review delegate IDs to the owning turn when validating interrupts.
- Settle pending interrupts with an error on listener shutdown and reject further interrupts against the retired runtime.

## Testing

Add regression tests for delayed terminal events, queued turn starts, review delegates, and interrupt handling during thread revert and runtime replacement.

GitOrigin-RevId: 9695fc3f718baa6b792a14d54136bb87fc003100
2026-11-17 15:33:21 +00:00
Charlie Marsh 9537934ed6 Allow independent app-server thread resumes to overlap (#61934)
## Why

A slow thread resume, such as one waiting for MCP startup, can block unrelated resumes behind the exclusive thread-list permit.

## What changed

Allow resumes using canonical thread IDs to share thread-list access for independent root threads. Keep aliases, paths, supplied history, daemon recovery, and agent-owned or uncertain sources under exclusive ordering.

Check source identity and ownership during resume, upgrading to exclusive access when needed. Preserve probe order during upgrades and keep later list mutations behind earlier probes.

## Testing

Add coverage showing that an independent cold resume completes while another waits for MCP startup, that only canonical ID resumes share access, and that permit upgrades preserve probe order ahead of a queued writer.

GitOrigin-RevId: 23fa6ddd551689be478fcca8e8bac2f8210984e2
2026-11-17 01:43:38 +00:00
Charlie Marsh 4f556fdd6d Encapsulate app-server thread-list locking in ThreadListState (#61928)
## What changed

Introduce `ThreadListState` to wrap the single-permit semaphore shared by thread and project request processors. Centralize exclusive permit acquisition and error handling while preserving the existing locking behavior.

GitOrigin-RevId: e596241d5f2620ea791c3bf95f5d97aabc1e8623
2026-11-17 00:58:52 +00:00
viyatb-oai c9df641eac Preserve native sandbox executable paths and PTY dispatch names (#61910)
## Why

Sandbox helpers with non-UTF-8 paths can lose their exact executable path when converted into command requests. PTY launches with a custom `argv[0]` can also try to execute the dispatch name instead of the configured program.

## What changed

- Carry native executable paths through sandbox requests, local execution, shell snapshots, and sandbox integrity checks.
- Use native Unix PTY spawning when `argv[0]` differs from the executable, preserving the dispatch name and controlling terminal setup.
- Preserve PTY executable lookup through the child environment's `PATH` and fallback to its home directory when the requested working directory is missing.

## Testing

Add regression coverage for non-UTF-8 sandbox helper paths, PTY dispatch names, child `HOME`/`PATH` lookup, controlling terminals, and exit-code preservation.

GitOrigin-RevId: 6a2af0486220d98195f5d67fde2597e3c4515e11
2026-11-16 23:26:42 +00:00
Charlie Marsh 237d8b104e Report remote plugin local versions from matching cached packages (#61865)
## Why

A remote plugin's catalog version can differ from the package available locally. Matching names and versions also do not establish that a cached package belongs to the same remote plugin.

## What changed

- Resolve `local_version` for remote plugin lists, details, and shares from the active local package, requiring a matching remote plugin ID and an existing manifest. Perform these filesystem reads on a blocking task.
- Download the package when a same-version cache has a conflicting or unreadable identity receipt. Preserve migration for older caches without receipts, and retain the original receipt if the replacement download fails.

## Testing

Add coverage for local package identity and manifest requirements, differing catalog and local versions, and preservation of the original receipt after a failed replacement download. Update share expectations to leave `local_version` unset when no matching local package exists.

GitOrigin-RevId: 5d86f834ac3861a4a3d3bf0d042bfe3f991a7cad
2026-11-16 19:28:36 +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
yiqian-oai 35145aba21 Broadcast read-state changes to experimental clients (#61852)
## Why

Clients need read-state updates for threads they have not opened so they can keep thread lists current.

## What changed

Broadcast `thread/readState/changed` to initialized experimental clients whenever a durable read receipt changes, regardless of thread subscription. Preserve filtering through `optOutNotificationMethods` and document refreshing the list after reconnecting to recover missed changes.

## Testing

Add a WebSocket regression test verifying that an unsubscribed experimental client receives updates while clients without the experimental capability and clients that opt out do not.

GitOrigin-RevId: a1a0f29405a856fdf6e379ded1376ed7d3d765cb
2026-11-16 18:20:25 +00:00
jif 090be4df07 Close late command approval items when turns are interrupted (#61841)
## Why

A background command can request approval after its originating turn has completed. Interrupting a later turn cancels the pending approval but can leave the command item marked as in progress.

## What changed

Complete these late command items with `Declined` status when their approval is canceled by a turn transition. Route completion through the thread listener so `item/completed` reaches the thread's current subscribers, preserving the original turn ID and command start timestamp.

## Testing

Add regression coverage for interrupting a turn with a pending approval from a completed turn, and for delivering late command completion to a replacement subscriber.

GitOrigin-RevId: 8c62fa3302fd3754b84e6fb87b3117f678f55164
2026-11-16 16:38:13 +00:00
Charlie Marsh 586203ad13 Avoid redundant store reads for loaded thread metadata (#61837)
## Why

Metadata-only `thread/read` requests for loaded threads reread the store to attach a title after already loading persisted metadata.

## What changed

Reuse persisted metadata and overlay live settings, returning metadata-only responses without another store read. Keep history loading conditional on `includeTurns` and centralize stored-title trimming and legacy preview fallback handling.

## Testing

Extend the in-memory store test to verify that a loaded thread without a rollout path returns its trimmed stored title with exactly one metadata read, while requests with turns still return stored history.

GitOrigin-RevId: 74f20914afb44901d7586eb8e944afdae2640c31
2026-11-16 16:21:42 +00:00
jif 2309bae1ae Isolate app-server turn metadata by turn ID (#61817)
## Why

A turn can complete after the next turn has started. Sharing one turn summary lets late completion events consume the next turn's metadata and clear its command tracking.

## What changed

Track turn summaries and command start times by turn ID so errors, timestamps, final agent messages, and command lifecycle notifications stay associated with the correct turn. Read and remove only the completing turn's state, and clear tracked state when listeners are replaced or removed.

Initialize summaries for inline reviews that can finish before their delegate emits `TurnStarted`.

## Testing

Extend regression coverage to check that overlapping turns retain their own errors, completed turns include start timestamps, and the next turn's approved command emits one start and one completion notification despite a late completion from the previous turn.

GitOrigin-RevId: 91f022d885c67c7d8982091c72325f1d701569a6
2026-11-16 14:08:16 +00:00
jif 662a634e88 Preserve active turn approvals when an earlier turn finishes late (#61801)
## Why

A turn's terminal event can arrive after the next turn has started, cancelling the newer turn's pending approval requests and incorrectly changing the thread's active status.

## What changed

Track the latest started turn in the app server. Only let completion or abort events for that turn cancel pending server requests and update thread watch status, preserving the existing behavior when no started turn is recorded.

## Testing

Add a regression test that delays one turn's completion until the next turn requests command approval, then verifies that the thread remains waiting on approval and the approval can still be accepted to execute the command.

GitOrigin-RevId: 521f4fb74728b3e70572839b2e73d2d2b2735f35
2026-11-16 12:14:18 +00:00
felixxia-oai 4fc37acc87 Clarify managed human command checkpoint stability (#61800)
Document managed `prompt-user` command checkpoints as stable in the interactive
Codex CLI, while keeping app-server integration marked experimental. Clarify
that each matching command requires a fresh human decision, even with automatic
review enabled, and that session or persistent approvals cannot satisfy it.

GitOrigin-RevId: 98c36d00294bd97ab937f32940dfb24310ecbc32
2026-11-16 12:05:55 +00:00
felixxia-oai 9544f09e7b Wire Guardian V3 housekeeping into the app server (#61797)
## What changed

- Install Guardian V3 with a local message-board host when the server enables `features.guardianv3.enabled`, independently of thread overrides.
- Clear inherited user, thread, and project instructions from Guardian V3 private threads and skip repository instruction discovery.

## Testing

Add integration coverage for routing the first live message while the actor is still sampling, for both new and resumed threads. Verify that resumed history is skipped, `AGENTS.md` reaches only the actor, and thread overrides cannot enable or disable server-level housekeeping.

GitOrigin-RevId: 3f3ae1be404c9e17b73eea12c95f5a95c96052cf
2026-11-16 12:03:11 +00:00
Anton Panasenko 75fc67e8f4 Remove numeric positions from project responses (#61771)
## What changed

Remove `position` from app-server `Project` responses, the thread-store project model, and generated schemas and SDK types.

Document that clients should use the returned project order and that `beforeProjectId` places a moved project before another project, or appends it when omitted or null.

GitOrigin-RevId: 5de481e13f524c03260b7fed5c74874f051d6f30
2026-11-16 08:47:49 +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
Charlie Marsh f1ebc7b372 Reuse matching thread inventories for lightweight MCP status pages (#61738)
## What changed

Reuse connected thread tool inventories for paginated `ToolsAndAuthOnly` status requests when registrations, client settings, permissions, environments, and authentication match. Restrict reuse to connections with fixed credentials; discover remaining servers separately and preserve enterprise-managed servers' admitted thread connections.

Bind status configuration to the same environment and permission inputs used by the thread runtime, and limit authentication-failure inspection to the requested servers.

## Testing

Extend status tests to cover fixed-credential reuse, fresh discovery for stored OAuth authority, full resource discovery, and inventories for dormant threads without starting their runtime connections. Verify that paginated lightweight results keep same-named servers in different environments separate.

GitOrigin-RevId: eaca6365fb2a739eaad76eefdc62ec9f796b1024
2026-11-16 03:40:21 +00:00
Dmitriy Kovalenko ca0bbbdf0c Optimize default and attached thread listings with targeted indexes (#61727)
## Why

Default thread listings should stay in timestamp order without scanning subagent threads. Attached-thread listings should use both parent and archive filters even without planner statistics.

## What changed

- Add partial indexes for visible interactive threads sorted by creation, update, or recency timestamps.
- Use literal source predicates for default interactive listings so SQLite can select the partial indexes.
- Extend the attached-parent index to include archive status.

## Testing

Add a query-plan test verifying that the default sidebar listing uses the interactive update-time index. Extend app-server coverage to include `chatgpt` custom-source threads in default interactive listings.

GitOrigin-RevId: 5844622b7af629cad71e15ec95a8960739d6d447
2026-11-16 02:53:45 +00:00
Charlie Marsh 5cb38e7984 Fix config reads with relative working directories (#61663)
Build `config/read` responses from the latest loaded configuration's layer
stack so requests with a relative `cwd`, such as `.`, succeed and reflect
external configuration edits. Reuse that configuration for feature overrides
and preserve precedence for layer read and decoding errors over full-config
validation errors.

Add a regression test that reads with `cwd: "."` before and after an external
model configuration edit and checks that both values are returned.

GitOrigin-RevId: 82eb835f2eac4e53414b01fc9286c2aac71babf2
2026-11-15 15:25:56 +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
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
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