Commit Graph
2873 Commits
Author SHA1 Message Date
felixxia-oai d57d72b3b7 Return Guardian channel summaries on first subscription (#65335)
## Why

Guardian reviewers need earlier user instructions to assess a pending
action. A channel subscription delivers future messages, so reviewers
previously had to look up earlier posts separately.

## What changed

- Keep `guardian_board.get_channels` focused on channel names. On a new
  subscription, `guardian_board.subscribe` returns the selected channel's
  cumulative summary when available and within the tool output budget.
- Guide reviewers to use clear summaries as evidence of earlier user
  grants and restrictions, give later original user instructions
  precedence, and consult original posts when a summary is missing,
  ambiguous, or conflicts with other evidence.

## Testing

Extend the Guardian housekeeping integration test to cover name-only
listings, summary delivery through Code Mode on the first subscription,
and delivery of a later original revocation before the next review.

GitOrigin-RevId: be6582f4497e2a053b1c3caa0cc81fc3ec6e5586
2026-12-02 21:24:47 +00:00
Alex Ionescu 7670578418 Report remote plugin archive verification in install telemetry (#65330)
## Why

Remote plugin install telemetry needs enough detail to distinguish archive
verification failures from other bundle errors and associate those failures
with a specific release when its ID is available.

## What changed

- Include the archive verification outcome in successful app-server install
  events. Classify verification failures by reason and attach the
  `plugin_release_id` when available. Use the catalog plugin ID for bundle
  events when it is available.
- Export `codex.plugins.archive_verification` through the configured
  OpenTelemetry logger during standalone CLI installs.

## Testing

App-server tests check successful and failed install analytics. A CLI
integration test checks that an archive verification failure exports the
expected event fields and leaves the plugin uninstalled.

GitOrigin-RevId: ea6cab1d04467d63f43fbd17e3d0a122fad15435
2026-12-02 20:34:56 +00:00
felixxia-oai 587c151188 Keep cumulative summaries in Guardian evidence channels (#65324)
## What changed

Ask the Guardian housekeeper to update each channel description from its prior
summary and newly routed evidence in source order. The summary captures relevant
activity, user intent, authorized actions and targets, conditions, exclusions, and
later corrections. The housekeeper attributes authorization to original user
instructions and distinguishes it from assistant proposals and tool reports.
Approval decisions remain with the reviewer.

Apply the same summary guidance with default and custom routing instructions.
Request updates only for new, missing, or changed descriptions, with each summary
limited by the prompt to 250 UTF-8 bytes and 40 words.

## Testing

Update the housekeeping fixture to carry forward staging approval alongside a
new restriction on publishing the release. Verify that the stored description
persists when a later routing response omits it.

GitOrigin-RevId: 72607fb370c18a9e2c570158bef70caa25be338c
2026-12-02 20:09:20 +00:00
felixxia-oai 0d36af2039 Guide Guardian to reuse topic channel names (#65323)
## What changed

Tell the Guardian v3 housekeeper to reuse the exact channel name when a
topic continues. For new channels, ask for a descriptive name that
identifies the topic and its project or target within 128 UTF-8 bytes.
Reflect the naming guidance in the routing schema.

## Testing

Update the recorded review request snapshot and adjust the housekeeping
test fixture so two of the three later evidence items still fit in the
model window with the longer prompt.

GitOrigin-RevId: 5beb4fc6c0ad496c22f3411ed3a8479e6bbbea6e
2026-12-02 20:08:40 +00:00
thomas f85a6e05eb Support explicitly declared hooks in Agent Plugins (#65316)
## Why

Codex skipped hooks in the Agent Plugin format even when the root
`plugin.json` explicitly declared them.

## What changed

- Discover hooks through the root manifest's `extensions.com.openai.hooks`
  declaration. File declarations must point to regular files inside the
  bundle without traversing symlinks.
- Apply the existing hook approval flow and give Agent Plugin hooks the same
  isolated `PLUGIN_DATA` directory as the plugin's stdio MCP servers.
- Include declared hooks in plugin details and capability detection without
  requiring a writable data directory. For remote catalog entries,
  `plugin/read` gets hook summaries from the matching installed bundle.

## Testing

Cover invalid hook paths and runtime data directory failures, verify that an
approved `PreToolUse` hook writes to isolated plugin data, and check remote
plugin reads with matching, different, and absent local bundles.

GitOrigin-RevId: 86311780865f7c598db22d873e88be2699750b75
2026-12-02 19:09:13 +00:00
Steve Coffey a5d572b651 Record Guardian token usage on the requesting turn (#65312)
## Why

The requesting thread's rollout lacks per-response token usage for
Guardian work, including requests that consume tokens without producing
a usable result.

## What changed

Persist reported token usage from Guardian reviews, background review
compaction, and classifier requests in the requesting thread's rollout.
Each record identifies the requesting turn, response, and model, and
marks incomplete responses that report usage. These records stay
separate from the thread's cumulative token totals and are excluded from
forked history.

## Testing

Cover review attribution and unchanged parent token totals, compaction
that reports usage without a usable summary, and thread shutdown waiting
for an interrupted classifier's usage write.

GitOrigin-RevId: da5d3711cdb7c7aeab829d3537ef59b724c57171
2026-12-02 18:40:08 +00:00
Tom Leach (@toml) 4e2490ec82 Introduce a request type for enqueueing thread messages (#65297)
## What changed

Use `EnqueueRequest` to pass the thread ID, turn input, and optional
Responses API client metadata through a single `enqueue_item` method.
Migrate the app server and queue service tests to this method, and
deprecate `enqueue` and `enqueue_with_metadata` while keeping them as
forwarding wrappers.

GitOrigin-RevId: 9a4e96ca5e7f30b0b6ac7f33ee6c10420df12dba
2026-12-02 16:46:59 +00:00
ioanbudea-OAI 01192c6e19 Enforce session ownership in V1 multi-agent tools (#65287)
## Why

V1 tools could use a thread ID to reach agents in another session. A
thread ID can also resolve to a different runtime after a thread is
unloaded and reloaded.

## What changed

- Check session ownership before sending input, interrupting, waiting on,
  closing, or resuming a V1 agent. Keep live operations bound to the
  runtime that passed the check.
- Check ownership in saved rollouts before resuming agents and their
  descendants. Follow the recorded parent chain for legacy rollouts that
  lack a session ID. Release the agent slot when closing a known ephemeral
  agent that has already been unloaded.
- Preserve failed `wait` calls in thread history and show the failure in
  the TUI without listing rejected targets as completed agents.

## Testing

Add regression coverage for cross-session input, close, and resume
requests, slot reuse after closing an unloaded ephemeral agent, legacy
session recovery, and failed wait history and display.

GitOrigin-RevId: 4712a53315d24d5658d746ed277738e00a4e2dac
2026-12-02 16:21:14 +00:00
jif 1396b2e0e7 Correlate Guardian failure reports with review and response IDs (#65276)
## Why

A turn can contain multiple Guardian reviews, and denial reconsideration
can produce multiple responses for one review. Thread and turn IDs alone
cannot identify which review and provider response produced the recorded
decision.

## What changed

Add `review_id`, `reviewer_request_id`, and `reviewer_response_id` to opt-in
Guardian failure reports when available. Keep the provider IDs with the
selected decision, including the original denial when reconsideration
fails and falls back to it.

## Testing

Extend tests to check the recorded IDs for initial and
reconsidered denials and verify that an invalid retry preserves the
original denial's IDs.

GitOrigin-RevId: 4bd906bfb9a80808cb3c2a8ac71c5354d4caad1f
2026-12-02 15:17:02 +00:00
Dmitriy Kovalenko ac2a31a717 Prefetch Git attribution policy when a thread starts (#65241)
## Why

The first turn could spend up to five seconds waiting for the workspace
attribution setting. Starting the request during thread initialization
lets it overlap with MCP startup.

## What changed

Fetch the policy in the background for threads using Codex backend
authentication. Reuse the pending lookup on the first turn when it
matches the thread's current authentication generation, and cancel any
unclaimed lookup on thread shutdown.

Cache a disabled policy after a timeout until its retry deadline. Once
the deadline passes, the next lookup can fetch the setting again.

## Testing

The app-server test waits for the settings request before starting the
first turn. The extension test covers retry deadlines across turns for
both prefetched and cached policies.

GitOrigin-RevId: 6f66f6299b56affc6c95558c94381e476a5cc1d8
2026-12-02 11:46:51 +00:00
jif 258cae0778 Default eligible OpenAI sessions to automatic approval review (#65236)
## What changed

When `approvals_reviewer` is unset, default to `auto_review` for sessions using the OpenAI model provider with `guardian_approval` enabled, effective workspace-write permissions, and an effective approval policy of `on-request` or `granular`. Otherwise default to `user`. Explicit reviewer settings still take precedence over the default, subject to configuration requirements.

When the TUI starts a replacement session on a remote app server, use the server's configured reviewer if the client has no explicit reviewer setting. Update the configuration and app-server schemas to document the new default.

## Testing

Cover reviewer eligibility and managed requirements in configuration tests, manual overrides and empty workspace roots in app-server thread-start tests, and remote reviewer precedence in the TUI replacement-session test.

GitOrigin-RevId: fd05687accddb8a3ab99df0486b93f3f595fef65
2026-12-02 11:38:20 +00:00
alexsong-oai 986dc881be Expose gateway spend in app-server account rate limits (#65193)
## Why

Clients need to show the spend and cap for the account behind a thread's
model provider. The existing ChatGPT usage read cannot provide those
figures for a gateway account.

## What changed

- Route `account/rateLimits/read` through the provider's configured
  `usage_url` using the provider's credentials. An optional `threadId`
  selects a loaded thread's provider for the account-wide read. Omitting it
  selects the default provider.
- Return `usageUnavailable` for a thread whose provider has neither a
  usage endpoint nor first-party authentication. Surface gateway errors
  without falling back to ChatGPT usage.
- Report monthly gateway spend in `individualLimit` as exact USD decimal
  strings, with `limit: "unlimited"` for uncapped accounts. Use
  `spendControlReached` for the gateway's cap status. Spend snapshots
  identify their unit as `usd` or `credit`, with omitted units defaulting
  to `credit` for compatibility.

## Testing

Add integration coverage for thread-specific provider selection, gateway
usage taking precedence over ChatGPT without fallback, and reuse of an
existing gateway OAuth session without interactive login.

GitOrigin-RevId: e6ec9d83eecc3084fcc98e72e2c031bd3e53a2cd
2026-12-02 07:59:18 +00:00
alexsong-oai badc482b81 Add monthly spend reads for custom model providers (#65168)
## What changed

Add an optional `usage_url` to model provider configuration and carry it
through remote thread configuration. Expose `read_provider_usage` to
fetch the current user's monthly USD spend, optional cap and percentage
used, and reset time.

Use the provider's own credentials for the request. Reject redirects,
disable interactive gateway login, and enforce same-origin validation
for gateway OAuth configurations that require it.

## Testing

Cover capped and uncapped spend, percentage rounding, and malformed
responses. Verify usage URL validation and remote configuration
round-tripping.

GitOrigin-RevId: ed805a756aab6e55c24751f0285bfe73b9091f07
2026-12-02 04:59:30 +00:00
Dylan Hurd 350d8a47c4 Stream provisional text from thread/sample (#65167)
## Why

Clients had to wait for the entire sample before they could display any
assistant text.

## What changed

Set `stream: true` to receive `thread/sample/textDelta` notifications
while a sample is in progress. Each notification goes to the requesting
connection and carries the original JSON-RPC `requestId` and a text
`delta`. The stream excludes commentary and reasoning.

The final RPC response still provides the complete sample and token
usage. Discard provisional text if the request fails or the final
`text` is null. Omitting `stream` or setting it to `false` returns
only the final response.

## Testing

Integration tests cover deltas arriving before completion, text supplied
only when an output item completes, and custom tool calls producing a
null sample even after provisional text has been streamed.

GitOrigin-RevId: b2ad960420ce7789722e03f9f283781030cf61fb
2026-12-02 04:56:45 +00:00
aakash-oai 6adca62116 Measure model catalog lookups and HTTP GET attempts (#65123)
## Why

A model catalog lookup can use a cached snapshot or bundled fallback without sending a request. A lookup that reaches the endpoint can send multiple requests through retries. Measuring both lets readers of the metrics distinguish cache behavior from endpoint traffic.

## What changed

- Record one `codex.remote_models.lookup.outcome` observation per completed catalog lookup with its purpose, result, and the source of the snapshot actually selected. Record observations without taking the exporter lock on the lookup path.
- Count dispatched requests in `codex.remote_models.http_get_attempt`, including retries. Tag them by purpose and whether they match the configured endpoint when that context is available. Keep endpoint URLs out of metric labels.
- Mark background refreshes as maintenance and apply metrics enablement changes to cached global handles when the process reloads telemetry settings.

## Testing

Add coverage for cache and fallback attribution, retry counts, auth failures before dispatch, and metrics collection across exporter disablement and replacement.

GitOrigin-RevId: b970207a69432030b4511c7e84acb6696b6f824b
2026-12-02 00:44:37 +00:00
Owen Lin 88eff82bd7 Wait for reader cancellation in the RPC delay test (#65113)
## Why

The reader task can take more than ten scheduler yields to drop the
reader after a write error, causing the test to fail even when
cancellation works.

## What changed

Have the test reader signal its drop with Tokio's `Notify` and give
`write_error_cancels_reader` up to five seconds to receive that signal
after asserting the broken-pipe error.

GitOrigin-RevId: fdb1fc8d9aaccaa72f85b51e11184df483420f80
2026-12-02 00:00:35 +00:00
Owen Lin a1deffb5b2 Pass the last inherited turn ID when creating a fork (#65111)
## Why

A thread store that resolves the last inherited turn during fork preparation
can reuse that ID when creating the child instead of resolving it again.

## What changed

Forward the optional `last_inherited_turn_id` from `PreparedFork` to
`CreateThreadParams` alongside the inherited history position. Omit the
field from serialized creation parameters when no ID is available.

## Testing

Add a regression test that checks the in-memory thread store receives the
turn ID supplied by the prepared fork when it creates the child.

GitOrigin-RevId: 709c8cc4a744b2f893af6233e825026a27732873
2026-12-01 23:56:56 +00:00
iceweasel-oai 80d0a67185 Share runtime registration across app-server startup clients (#65106)
## Why

Statsig starts before the model catalog. When runtime agent instances are
enabled, separate auth managers can cause Statsig and model discovery to
register the same app-server runtime twice.

## What changed

Pass a shared runtime auth slot to Statsig and model discovery in both
standalone and in-process app-server startup so they use the same runtime
registration.

## Testing

Extend the CLI startup integration test to require exactly one runtime
registration and verify that both Statsig evaluations and model discovery
send `AgentAssertion` authorization headers.

GitOrigin-RevId: 132521b685c5c7c617e7067c648de65b9a4287b2
2026-12-01 23:12:29 +00:00
vishnu-oai 4c75131c9c Validate config server policy before replacing login credentials (#65066)
## Why

An explicit `codex login` can reuse a saved config server grant, leaving
users without a way to switch accounts through that command. Saving a new
grant before validating its managed configuration can also displace a
working session if the policy fetch or validation fails.

## What changed

- Start a fresh config server sign-in for explicit browser and device-code
  logins, even when a grant is already saved.
- Hold the new grant in memory while fetching and validating its managed
  configuration. Save the grant and then update the policy cache after
  validation succeeds.
- Recheck config server and proxy settings and reload local network rules
  before fetching policy. Reject logout while a config server sign-in owns
  the login lock, including during the first sign-in.

## Testing

Cover successful grant replacement and preservation of the saved grant
when authorization, policy fetch, or policy validation fails. Verify that
network restrictions can block the policy fetch and that logout detects
an in-progress first sign-in.

GitOrigin-RevId: 427a70d556f92fd96c43f6e8737371aa3651e70c
2026-12-01 19:33:48 +00:00
Eric Traut 214b9007dd Restore token usage after compaction on paginated thread resume (#65035)
## Why

A compaction checkpoint can leave the turn's `TurnStarted` event outside
the replay window. When `thread/resume` excludes turns, the app server
can then miss the turn ID and omit the saved token usage update.

## What changed

Fall back to the latest saved `TurnContext` in the active turn when
that turn starts at a compaction checkpoint. Use its turn ID to replay
the saved `thread/tokenUsage/updated` notification.

## Testing

Extend cold resume tests to check the turn ID, total and last token
counts, and context window after compaction. Cover a rollback that
leaves the usage owner unknown and verify that replay is skipped.

GitOrigin-RevId: 4ea4f5e7a561fbba00fbe6b063f632a23193bc5a
2026-12-01 16:53:34 +00:00
jif 6dab58d9f7 Preserve read-only permissions across repeated thread resumes (#64829)
## Why

A cold resume can save a read-only profile with concrete read paths
derived from the current configuration. On the next cold resume, those
paths make the saved profile ineligible for direct reuse, so the thread
can fall back to a writable default.

## What changed

When restoring a saved read-only profile with restricted network access
that cannot be reused directly, rebuild its read grants from the current
configuration while keeping writes disabled and network access
restricted. Preserve read denials from both the saved profile and the
current configuration. For deny globs, use the larger scan depth when
both contributing policies are bounded and keep the scan unbounded if
either contributing policy is unbounded.

## Testing

Cover two consecutive cold resumes under a scoped writable default, and
test that restoration respects the current read allowlist, preserves
saved path and glob denials, merges glob scan depths, and drops the
configured network proxy.

GitOrigin-RevId: 04c91804e83d396402e1c8a985e4c3ff006f7e91
2026-11-30 23:48:15 +00:00
Charlie Marsh b0b5cfcab8 Connect plugin MCP servers over launcher-provided Unix sockets (#64828)
## Why

A launcher that already hosts an MCP server needs a way for Codex to
use it without starting a separate subprocess for the plugin.

## What changed

The stdio app server accepts socket bindings from its immediate parent
on Unix. A binding applies to a local plugin's stdio MCP server only
when the plugin ID, server name, and binding ID match a single entry.
Codex uses the stdio wire protocol over the socket and retains the
original declaration for policy checks.

Before sending MCP traffic, Codex requires a user-owned socket
directory with mode `0700` and verifies the listener's PID and UID.

## Testing

Add tests for binding scope and ambiguous matches, and for rejecting
unexpected listener PIDs, insecure directory permissions, symlinked
socket directories, and relative socket paths.

GitOrigin-RevId: 3d669dd59a0812b04727e4a1e458774007f054ba
2026-11-30 23:34:32 +00:00
felixxia-oai 02a15f1244 Cancel Guardian V3 shadow reviews on interruption (#64813)
## Why

A Guardian V3 shadow review could keep running after its live review or
owning turn was interrupted, leaving the reviewer slot occupied.

## What changed

- Cancel the shadow when a pending live review is cancelled or dropped,
  and let the live review finish its cleanup on cancellation.
- Cancel in-flight shadows when their owning turn is aborted, even if
  the live verdict is already available, and prevent new shadows for
  that turn. On normal turn completion, shadows can finish independently.

## Testing

Cover tool cancellation during live-review cleanup and turn interruption
both during review and after approval. The app-server test also checks
that a later turn can start a shadow and complete while it is still
running.

GitOrigin-RevId: 45df0575853d5f8ca7ef7282fcd0fa1f22fed6c5
2026-11-30 21:35:13 +00:00
Aismit 1108cbcbef Require fresh Guardian review after tool input rewrites (#64810)
## Why

A `PreToolUse` hook can change a tool's arguments while keeping its call
ID. An asynchronous risk score for that ID still describes the original
action, even if the score arrives after the rewrite.

## What changed

Require synchronous Guardian review when a hook changes the tool payload
and discard the original assessment. Preserve normal review behavior
when the hook returns an identical payload. Also require synchronous
review for MCP elicitations without an associated tool approval context.

## Testing

Add regression coverage for unchanged hook output, rewritten patches
whose original scores arrive before the rewrite or during review, and
MCP elicitations with missing approval context or rewritten inputs.

GitOrigin-RevId: 994519d61d52c69edcdec9517766a8e3051587d5
2026-11-30 21:32:28 +00:00
fahad-OAI dac56a1ca2 Remove special-case instructions from the web search tool (#64788)
## What changed

Remove the `web.run` instructions to check local code first and limit
browsing to official OpenAI sites for OpenAI product questions, to rely
only on primary sources for technical questions, and to explicitly flag
inferences from sources.

Update the thread sampling and web search scenario snapshots to reflect
the revised tool description.

GitOrigin-RevId: d35dcaaeb69940af5d7f9df19aba337fd0ab6426
2026-11-30 18:51:22 +00:00
felixxia-oai 10a8d4ff15 Retire Guardian V3 shadow boards when intake stops (#64784)
## Why

An intake failure blocked new shadow reviews but let in-flight reviews
continue after the board stopped receiving thread history. Loaded child
threads could also retain references to the stopped board.

## What changed

Cancel in-flight shadow reviews and release board resources in the
background when intake stops. Keep completed verdicts in the comparison
with Guardian V2 and count eligible reviews skipped because intake
stopped across the root and its child threads. Allow a fresh board when
shadow enrollment is turned off and back on.

## Testing

Cover cancellation while a shadow response is still pending, board
cleanup while child threads remain loaded, and retirement waiting for
a finishing review to release its slot.

GitOrigin-RevId: a95bf5527ef3251d37207d07d76430f6557cd420
2026-11-30 18:29:43 +00:00
felixxia-oai 457ea27b0b Shadow fresh Guardian V2 approvals with Guardian V3 (#64782)
## Why

Collect Guardian V3 verdicts for actions that require a fresh Guardian V2
review while keeping Guardian V2 in control of approval and tool execution.

## What changed

When Guardian V3 shadowing is enabled and an enrolled reviewer is available,
run a single background review for eligible fresh approvals and log the
outcome with the live review ID. Skip shadowing when the reviewer is busy,
shadow intake has stopped, or a rollout budget is configured.

## Testing

Add app-server coverage for immediate approvals, ordinary synchronous
reviews, and fresh reviews with and without a rollout budget. Hold a shadow
denial in flight to verify that the tool and turn can finish, a second
request skips the busy reviewer, and stopped intake prevents new shadow
reviews while the in-flight verdict can still finish.

GitOrigin-RevId: 5e31f3d7e3b0433455b8f2a5fb52e483588b1b29
2026-11-30 18:27:38 +00:00
jif 808f3345e9 Support the V3 multi-agent selector on the V2 runtime (#64735)
## Why

Enabling `multi_agent_v2` forced the V2 tool version before a fresh
thread could use the model selected for its first turn. The shared
runtime needs to support both V2 and V3 selections.

## What changed

- Let the first turn select V2 or V3 from the active model, with V2 as
  the fallback when the shared runtime is enabled.
- Pass the selected version to fresh and forked subagents, including
  through host-prepared child creation.
- Report both selections as `v2` in app-server model metadata because
  they use the same runtime.

## Testing

Extend integration tests to cover model switches between V2 and V3
before the first turn and V3 inheritance in fresh, forked, and
host-prepared children.

GitOrigin-RevId: de1fd9836d8cb3c4dc19805507462f4f5cfe3959
2026-11-30 13:51:38 +00:00
jif bda8fc3c04 Centralize multi-agent V2 runtime checks (#64731)
Add `MultiAgentVersion::uses_v2_runtime` to identify versions that use
path-addressed workers and turn-scoped execution slots. Use it to gate
runtime behavior such as subagent spawning and resumption, forked
history handling, and message routing. The predicate matches only
`MultiAgentVersion::V2`, preserving existing behavior.

GitOrigin-RevId: 712243c5df310c0745bf69c4faff660a44f05be5
2026-11-30 13:09:06 +00:00
Charlie Marsh dfd76bb740 Filter MCP server status tools by connector ID (#64527)
## Why

A single MCP server such as `codex_apps` can expose tools from multiple
connectors. Clients that need one connector's tools currently have to
filter the server's tool inventory themselves.

## What changed

Add an optional `connectorId` parameter to `mcpServerStatus/list`. It
keeps only tools whose `_meta.connector_id` or `_meta.connectorId`
exactly matches the requested string. Servers with no matching tools
still appear with an empty `tools` map and their status. Omit the
filter or pass `null` to return all tools, and repeat the filter on
each page when paginating.

## Testing

Add integration coverage for standalone and thread-scoped requests,
including both metadata spellings, an unknown connector ID, and an
omitted filter.

GitOrigin-RevId: d6ad367dff72002b239db7b5012145ba1811ccac
2026-11-29 01:29:23 +00:00
jif 30ffdd0619 Preserve command approval items through turn interruption (#64349)
## Why

The app server could show a command awaiting approval before core had
recorded its start. Interrupting the turn or abandoning launch after
approval could leave the live command item and saved history out of sync.

## What changed

Have core publish the command item before prompting for approval and
retain it across approval and sandbox retries until execution takes over.
Complete abandoned items as declined when interrupted while awaiting
approval, or as failed when interrupted after approval but before launch.
Wait for pending approval item writes during shutdown.

## Testing

Extend the app-server interrupt test to restart the server and verify
that the interrupted turn contains exactly one declined command item with
the original approval item ID.

GitOrigin-RevId: c9f027fc7096d091dc8cf1936c88aa69d3eed8c1
2026-11-27 16:25:10 +00:00
jif 6bf1e3e687 Persist command completions when approval is declined or fails (#64341)
## Why

The app server completed command items for rejected approval responses
directly in the live stream. That bypassed core's history recording, so
clients could see a completed command live and lose it when reloading
the turn.

## What changed

Keep top-level command items with their pending approvals in core.
Record and emit the command completion before unblocking the turn.
Declines and cancellations produce a `declined` item, while invalid
responses and approval request failures produce a `failed` item.

## Testing

App-server integration tests cover cancellation, decline, and malformed
responses. They check that `item/completed` precedes `turn/completed`
and that paginated history returns the same command item after restart.

GitOrigin-RevId: d3d95272c8a6af2fa65fa980f312260313cc5e32
2026-11-27 15:31:18 +00:00
Eric Traut df06542138 Fix Unicode highlighting in fuzzy file search (#64214)
## Why

The fuzzy matcher reports grapheme positions, but the terminal file picker
uses Unicode scalar offsets. When a path contains a joined emoji or a
combining mark, the picker can highlight the wrong characters.

## What changed

Let callers choose the unit for match indices. The terminal and CLI use
scalar offsets that cover every scalar in each matched grapheme. The
terminal's file picker and mention renderer now consume the same offsets.
The app server returns grapheme offsets for both one-shot and streaming
searches.

## Testing

Add regression coverage for basename and full-path matches with joined
emoji and combining marks, grapheme offsets in both app-server search
modes, and terminal highlights in file and mention results.

GitOrigin-RevId: 2da357a404396550333c785640d2c4121cb2ed3f
2026-11-26 20:37:00 +00:00
Felipe Coury 475e13ab1a Save and cycle through side chats in TUI scrollback mode (#64207)
## Why

Scrollback mode could switch between a parent conversation and a live side
chat, but it could neither save side chats nor reopen them after resuming
the parent.

## What changed

- With the TUI workspace feature enabled and a compatible local backend,
  save new scrollback side chats as attached threads. Use `Ctrl+/` to
  discover saved chats and cycle from the parent through them and back.
- Show the current side chat's position and loading status. Keep input in
  the source draft while a switch is pending, and let `Esc` cancel it.
- Delete the parent and its saved side chats in one `thread/delete`
  request. The experimental `savedSideChatIds` parameter lets the server
  verify that each requested chat belongs to the parent and check for
  blocking attachments before deleting anything.

## Testing

Add coverage for cycling after resume, preserving pasted drafts during a
pending switch, and limiting parent deletion to verified saved side chats.

GitOrigin-RevId: 7c797f1b69dff73ff0343eb73dd3c048e856b319
2026-11-26 19:54:18 +00:00
jif dd6d2c3d66 Test and document MCP message board notification delivery (#64179)
## Why

The app-server integration test covered delivery from detached boards.
The automatic in-memory board uses a separate delivery path through the
host's `notify` callback.

## What changed

Document callback delivery for the automatic launcher and explain how
runners with a separate app-server can use `AppServerNotifications` with
`launch_in_memory_with_app_server` to deliver notices through
`thread/inject_items`.

## Testing

Extend the integration test to post through the automatic in-memory
board alongside the detached SQLite and in-memory boards. Assert that
each notice appears exactly once in the intended worker's model requests
with the expected sender, recipient, and payload.

GitOrigin-RevId: e2f4beefb80702e6ad75e7999294a7705db2c856
2026-11-26 16:06:46 +00:00
swastik-oai ad7176f787 Use Guardian V3 to assess recorded tool calls (#64157)
## Why

`thread/guardianReview` used the transcript reviewer even when the app
server was configured to use Guardian V3 for live approvals. Recorded
calls can now be assessed with the same reviewer as live calls.

## What changed

When Guardian V3 is enabled at app-server startup, `thread/guardianReview`
waits for pending injected history to reach the Guardian board, then
returns a fresh assessment without executing the tool call or caching an
approval. When V3 is disabled at startup, the endpoint uses the
transcript reviewer.

V3 requires a fresh, idle, non-ephemeral root thread with paginated
history and rejects `rootEvidence`. Recorded browser calls receive the
same browser policy as live calls.

## Testing

Add coverage for sequential history batches without tool execution,
unsupported thread types, routing failures and timeouts, and preservation
of the initial denial when reconsideration stalls.

GitOrigin-RevId: a8ad15cd2bb2d6d5d105c672f64c6cc71dfc6ff8
2026-11-26 14:14:59 +00:00
Anthony Tafoya 963d4f5717 Honor per-executor plugin settings in capability discovery (#64052)
## Why

A plugin can be installed in several executor environments. Disabling one
installation should leave the others available, while a thread-wide exclusion
needs to apply across environments.

## What changed

- In executor capability discovery V2, allow an executor to list its own
  plugin installations subject to marketplace policy. A named entry such as
  `"notes@market": {}` inherits the executor default when the thread has
  no enablement preference. A default alone does not list any plugins.
- Apply thread enablement preferences across installations and scope executor
  opt-outs to the affected installation. When MCP server names are shared,
  use the first enabled installation.
- Preserve connector mappings for explicit `disabledPluginIds` exclusions
  so Apps tool search can honor them even when the executor has already
  disabled the installation.

## Testing

Add regression coverage for marketplace filtering, thread and executor
precedence, installation-scoped exclusions, and Apps connector suppression
after an executor opt-out.

GitOrigin-RevId: d3465a38f3ebf5042d5c45dabfdb32f8ada81727
2026-11-26 02:32:11 +00:00
iceweasel-oai f39c3c78d7 Initialize Statsig feature gates across Codex launch modes (#64001)
## Why

Enabling `statsig_gates` can only load evaluations if the process starts
the Statsig runtime. Several Codex entry points never started it.

## What changed

Start Statsig in standalone and embedded app servers, the TUI when it
connects to a separate app server, eligible `codex sandbox` launches, and
local and remote exec servers. This also covers `codex exec` through its
embedded app server. Use the serving or local account where applicable
and installation identity for remote execution. Share the runtime with
the embedded TUI and flush it on normal shutdown.

## Testing

Add a CLI integration test that checks which evaluation endpoint each
launch mode requests, including signed-in and signed-out sandbox launches.
Supply a bundled fixture key in Bazel and nextest CI builds so the test runs.

GitOrigin-RevId: 64df9933c1a9783a86be8712fa012b495f34b0f8
2026-11-25 22:46:26 +00:00
jif 06c718ae68 Remove the shadow skill ranking experiment (#63993)
## What changed

Remove the background ranking of skill candidates and the metrics that
compared those rankings with skills actually used. Drop the experiment's
per-thread state and metrics wiring.

Continue accepting `skill_search` in existing feature configurations as
an ignored compatibility key.

## Testing

Extend the feature configuration test to cover both `true` and `false`
values for `skill_search`.

GitOrigin-RevId: 9492533bdeea58d4976bc9fbcffb6b82036b7894
2026-11-25 22:41:36 +00:00
Charlie Marsh a089ec6a93 Use lightweight settings for app-server thread metadata (#63990)
## Why

Enriching loaded thread results builds a full configuration snapshot,
including an execution permission profile, just to read display settings.

## What changed

Read the configured model, reasoning effort, environment selections, and
session source directly from the loaded thread when enriching results.
The environment data still includes the working directory and runtime
workspace roots.

## Testing

Extend the core test to verify that reading display settings matches the
configured snapshot's display fields without triggering a model lookup.
Extend the app-server test to verify that thread reads and lists return
explicit runtime workspace roots.

GitOrigin-RevId: f7053554fdb0f02bebb51b4cafda2ef39e6e81a5
2026-11-25 22:40:22 +00:00
felixxia-oai d800b00e88 Restart Guardian v3 shadow intake when Auto Review resumes (#63988)
## Why

Switching an enrolled thread to user approvals stops Guardian v3 shadow
intake. Previously, switching the same thread back to Auto Review left
intake stopped for subsequent turns.

## What changed

Restart intake in the background with a fresh evidence board after
checking that the thread still routes approvals to Auto Review. Start
at the end of persisted history so the new board only receives new
evidence. Existing child threads can attach to the new board on their
next turn.

## Testing

Add app-server coverage for routing later turns after Auto Review
resumes without replaying earlier turns. Extend the host test to cover
stale settings notifications, cancellation of a queued restart, and
creation of a fresh board and reviewer.

GitOrigin-RevId: 5201d7f7a7e3f2c045c69b9584b036467a5767d7
2026-11-25 22:39:08 +00:00
jif c6bbf8a413 Extract shared network policy types from the proxy crate (#63986)
## Why

The protocol and feature configuration crates depend on the network proxy
crate for data types. Give them a smaller dependency that contains the
shared definitions.

## What changed

Move environment network policies, domain and Unix socket permissions,
policy decisions and their sources, and credential provider definitions
into `codex-network-policy-types`. Use the new crate directly from
`codex-protocol` and `codex-features`.

Re-export the moved types from `codex-network-proxy` and keep environment
policy conversion and application, along with credential provider
validation, in the proxy crate.

GitOrigin-RevId: 8af684da746830bce45ac00135aed8052dba3824
2026-11-25 16:09:51 +00:00
felixxia-oai 06f334aa4b Add opt-in shadow intake for Guardian V3 (#63949)
## What changed

Add the default-off `features.guardianv3_shadow` flag and ignore it in
project config. When Guardian V2 handles Auto Review and Guardian V3
is disabled, enroll eligible new threads in background evidence intake
while Guardian V2 keeps making approval decisions.

Share an in-memory evidence board between the root and its child agents.
Keep shadow reviewer sessions ephemeral and suppress their events in
the parent thread. Retry failed intake startup on a later turn, and
stop shadow work when the root leaves Auto Review or shuts down.

## Testing

Cover enrollment for opted-in new threads, startup retry, child
attachment and cancellation, and the absence of an on-disk board.
Verify that project config cannot set the flag.

GitOrigin-RevId: 7c31c1d831498ba012193579123ac87779b76b85
2026-11-25 16:07:45 +00:00
felixxia-oai d1e982d7eb Let Guardian V3 review actions while evidence routing is pending (#63941)
## Why

Guardian V3 approval reviews waited for the housekeeper to catch up on
conversation history before they could start. Slow evidence routing could
delay an action review, and a routing failure could prevent a verdict.

## What changed

Each review attempt, including retries, drains the reviewer's available
inbox when it reserves the reviewer. The housekeeper flushes and routes
history independently in response to thread activity.

## Testing

Cover reviews that start with an empty board or while evidence routing
resumes after a root thread reload. Verify that a revocation published
during an in-flight verdict is available to a subsequent review.

GitOrigin-RevId: f84f424b57538fa9562d8f4d47e38ce7a0a84dcd
2026-11-25 15:37:35 +00:00
felixxia-oai 34fcbc8caf Keep Guardian V3 verdicts valid across unrelated context updates (#63940)
## Why

An unrelated thread goal update could invalidate a pending Guardian V3
approval and trigger a second assessment even though the update never
reached the attached reviewer.

## What changed

Let attached Guardian V3 reviewers finish with the evidence admitted for
the current attempt. Later evidence can inform subsequent reviews. Keep
the cancellation, deadline, and root history checks for attached verdicts.

## Testing

Update the app-server regression test to change the thread goal while
an MCP approval is pending and verify that the original approval stands
after a single assessment.

GitOrigin-RevId: 6e7ffad243c7c59f0f97bdbe555886ff58531835
2026-11-25 15:36:14 +00:00
Dylan Hurd e8fb104cd6 Make the context spill threshold configurable for MCP hooks (#63922)
## Why

MCP hooks could only use the default spill threshold. Hooks that return
larger context, such as a session-start memory hook, need a way to keep
more of that context inline.

## What changed

Allow `mcp_tool` hooks to set `additionalContextLimit` for events that
can emit `additionalContext`. Plaintext context spills to disk above
approximately 2,500 tokens by default. MCP hooks can set a threshold
from 1 to 10,000 tokens. A value of 0 or above 10,000 warns and uses
10,000. Hook trust hashes use the effective threshold.

Expose the setting in app-server configuration requirements and hook
list responses.

## Testing

Cover limit normalization, warnings, trust hashes, and app-server
reporting. Verify that a bundled memory hook with a higher threshold
injects its full context at startup and after compaction.

GitOrigin-RevId: 318704ac1532267b3eb2f138f130b6799863a5c0
2026-11-25 14:03:11 +00:00
Eddie Chen 1ed2a3f22d Record root turn IDs in Guardian review analytics (#63837)
## Why

The review's `turn_id` alone can't identify the root turn of the action
being reviewed. For example, a background terminal can request network
access during a later turn.

## What changed

Add an optional `root_turn_id` to `codex_guardian_review` events. When
a verified execution tag ties a network request to a registered tool
call, use the root turn ID captured when the call started. Leave the
field unset when the reviewed action's root turn is unknown.

## Testing

Extend the MCP approval test to check the reported root turn ID. Cover
untagged network requests and verify that a cross-turn network review
reports the active turn's `turn_id` alongside the issuing turn's
`root_turn_id`.

GitOrigin-RevId: f0ae40ec4fc441891b4d843912f823a2385fa36f
2026-11-25 06:19:21 +00:00
Jackson Moody e2c31f625a Use ChatGPT account preferences for Codex voice chat (#63810)
## Why

Codex stored voice selections in `realtime.voice` and supplied voice overrides when starting realtime sessions. Reading and saving the ChatGPT account preference lets Codex use the same voice selection as ChatGPT.

## What changed

- Add experimental `account/voiceSettings/read` and `account/voiceSettings/write` methods. The terminal voice picker shows the selected voice and available display names, then saves the chosen voice ID to the connected app server's ChatGPT account, including when the server is remote.
- Require ChatGPT sign-in for terminal voice chat and create its WebRTC calls through the ChatGPT backend.
- Remove voice overrides from realtime session startup. Existing `realtime.voice` entries still parse but are ignored.

## Testing

Cover voice picker loading and saving, remote catalog failures, the ChatGPT sign-in requirement for local calls, and omission of voice overrides from realtime call payloads.

GitOrigin-RevId: 9e6f30b8020c47701d3c1604075063924f191685
2026-11-25 02:31:54 +00:00
jamy-OAI 986a6b3b11 Preserve the saved Daybreak choice across live goal continuations (#63809)
## Why

Automatic goal continuations could lose the thread's saved Daybreak
choice, even when the thread was enrolled in Daybreak propagation.

## What changed

Capture the saved choice when an externally created live goal first
becomes active. For goals created by a tool, carry forward the
originating turn's choice and preserve explicit access program
overrides.

Keep the captured choice in memory for the life of the goal and check
it against the current account and model on continuation. Changing
the thread's Daybreak setting takes effect for new goals.

## Testing

Add coverage for enrolled and opted-out threads, including blocking
a goal when the model lacks Daybreak support and starting a new goal
after turning Daybreak off. Also cover account changes and isolation
from foreground turns.

GitOrigin-RevId: 0baf08f06baf267595cb5a2b3b1fe033db52ad06
2026-11-25 02:31:14 +00:00
smurching-oai 07963a34f2 Discover model catalogs from HTTPS gateways (#63807)
## Why

A custom gateway can serve a Codex model catalog at its existing
`/models` route. Requiring a separate `model_catalog_url` leaves that
catalog undiscovered when only `base_url` is configured.

## What changed

Probe `/models` automatically for custom providers with a query-free
HTTPS base URL and no explicit catalog URL. Use a valid Codex catalog
as the model picker inventory. If discovery fails, keep the picker
usable with an available catalog or the bundled models. Gateway login
and token refresh errors still propagate.

## Testing

Add HTTPS app-server tests that verify the authenticated
`/v1/models` request, picker population from a Codex catalog, and
fallback to bundled models for a generic OpenAI model list or a
`403` response.

GitOrigin-RevId: 654095be1c221d79d932acde8b7289bc4cad0437
2026-11-25 02:29:04 +00:00