Commit Graph

9208 Commits

Author SHA1 Message Date
Felipe Coury
d09cf7e5f4 Preserve user message styling when wrapping long URLs (#38380)
## Why

Terminal autowrap for oversized URL tokens can drop the user-message gutter and background on continuation rows.

## What changed

- Explicitly wrap long URLs within the available message width.
- Preserve the complete OSC 8 hyperlink destination on every wrapped fragment.
- Keep the user-message gutter and background styling across continuation rows.

## Testing

Add history-cell and VT100 coverage for URL content, hyperlink targets, gutters, and backgrounds across wrapped rows.

GitOrigin-RevId: 59514eee4ab967bd937b55574b9f8d0d1c82df7c
2026-08-13 13:52:18 +00:00
jif
a7e9fb5480 Constrain Guardian reviews to parent filesystem permissions (#38377)
## Why

Guardian review sessions must not gain access to paths that the parent turn is
not allowed to read.

## What changed

- Derive Guardian permissions by intersecting managed parent filesystem rules
  with read-only access, preserving denied paths and restricting network access.
- Offer Guardian execution tools only when a managed sandbox can enforce those
  rules.
- Include the selected environment IDs in the review-session reuse key so a
  session is not reused across different environment sets.

## Testing

Update the Guardian reuse integration test to verify that a review cannot read
a parent-denied file or write a local file while consecutive reviews still
reuse the same session.

GitOrigin-RevId: 20f17a6c379f1eda651e8508459d642a51e4ce94
2026-08-13 13:41:08 +00:00
jif
a7b8c074b5 Add the Guardian V2 Luna sampler (#38368)
## What changed

- Add a `LunaSampler` that opens an authenticated Responses WebSocket and reuses it for structured, tool-free `gpt-5.6-luna` requests.
- Carry the host's provider, authentication, proxy, attribution, and service-tier configuration into the connection and requests.
- Require strict JSON schemas, preserve per-request reasoning effort and turn metadata, and reject missing or oversized output.

## Testing

- Add a WebSocket test covering authentication and attribution headers, connection reuse, structured request fields, per-turn metadata, reasoning effort, and returned output.

GitOrigin-RevId: aef85fd8ddcfcb7c76a9ede0d3191e3a0321656b
2026-08-13 12:35:56 +00:00
jif
72fa74fbc9 Persist security risk scores in rollout history (#38363)
## What changed

- Add a `SecurityRiskScore` rollout item containing a category and numeric score.
- Persist the item in both thread history modes while excluding it from model context, user-visible thread history, search text, forks, and reconstructed conversation history.
- Re-export the score type from the extension API.

## Testing

- Cover serialization, persistence and loading, thread history projection, session reconstruction, append planning, and memory filtering.

GitOrigin-RevId: 1926fe366aeaa75052708a6da589f45a38eefb52
2026-08-13 12:04:29 +00:00
jif
9ed0047a61 Stabilize exec-server byte-budget tests (#38362)
## What changed

- Send the scripted HTTP response before queuing body deltas in the
  single-stream byte-budget test.
- Allow 30 seconds for barrier requests in both byte-budget tests while
  retaining the default timeout for other operations.

GitOrigin-RevId: ac65580b479d93fcbcca787f15e04c084f0aa56b
2026-08-13 12:00:19 +00:00
jif
4ca1af77a5 Test hook rejection for explicitly started queue items (#38361)
## What changed

- Add dedicated coverage for explicitly starting a queued item that a prompt hook rejects.
- Verify the rejected item is consumed and no model request is sent.
- Keep the automatic queue dispatch test focused on consuming a rejected item while allowing later queued input to proceed.

GitOrigin-RevId: e01cefb9d8581b0d4be05d4595f279d61e628e83
2026-08-13 11:55:10 +00:00
Charlie Marsh
80ceab7aaa Optimize orphan output normalization (#38358)
## What changed

- Collect borrowed call IDs in a single pass instead of cloning IDs across
  separate sets.
- Record orphan positions and compact the history only when orphan outputs are
  present, while preserving the existing matching and error behavior.

GitOrigin-RevId: de399ba92ff451cb12fc69218d60d3ac29fccb3d
2026-08-13 11:39:57 +00:00
jif
c30a3e49c9 Support sandboxed file streaming in exec-server (#38356)
## Why

Streaming reads previously rejected requests that used a platform filesystem
sandbox.

## What changed

- Open streamed files in the sandbox helper and return the open file to the
  exec-server by passing a file descriptor on Unix or duplicating a file handle
  on Windows.
- Advertise support through the `sandboxedFileStreaming` environment capability.
- Preserve close-on-exec behavior for transferred descriptors, including the
  required inherited-descriptor cleanup on macOS.

## Testing

- Cover bounded sandboxed streams, continued reads after path replacement, and
  rejection of symlink escapes outside readable roots.

GitOrigin-RevId: 677b2444b74e834b78b87a8554bc119c1c6e08b2
2026-08-13 11:11:26 +00:00
jif
fe614a6304 Add Guardian V2 extension scaffold (#38336)
## What changed

- Add the `codex-guardian-v2` crate with an extension install entry point that does not register contributors yet.
- Register the crate in the Cargo workspace and add its Bazel target.

GitOrigin-RevId: 7c0c9479c6722d65f0f0dad9b0fd4a756e4649b3
2026-08-13 09:00:23 +00:00
Channing Conger
e0de12a126 Make gRPC code-mode yield tests deterministic (#38321)
## What changed

- Use a never-resolving promise when verifying that a session continues to
  enforce its yield limit after terminating a cell.
- Use `yield_control()` to create the yielded cell in the notification-draining
  test instead of relying on timer scheduling.

GitOrigin-RevId: 01cdaa94e5b8b5c89c6fa98c4bbdb28a690678e0
2026-08-13 07:26:27 +00:00
viyatb-oai
902bd9e06b Protect inline visualization viewers from sandbox writes (#38306)
## Why

Inline visualization viewer documents must remain outside locations that a
sandboxed session can modify before they are opened in a browser.

## What changed

- Materialize viewer documents in a dedicated cache under `CODEX_HOME`, keyed
  by the source and artifact thread IDs, instead of alongside visualization
  artifacts.
- Create visualization links only when the active filesystem policy cannot
  write to the viewer cache. This also disables links for full-disk-write
  sessions and applies the policy consistently when loading transcript history.
- Reject viewer cache paths containing symbolic links and track materialized
  documents in memory so unchanged viewers are reused without trusting existing
  file contents.

## Testing

- Verify that rendering an unchanged visualization reuses the existing viewer
  file, while an updated fragment refreshes it.

GitOrigin-RevId: 12b7fbe522a68076e5d683a987b7801940d131c2
2026-08-13 04:08:23 +00:00
Owen Lin
363427b5e3 Add interrupted turn recovery (#38303)
## What changed

- Add `RecoverTurnRequest` and `CodexThread::recover_turn_if_idle` to resume an interrupted regular turn with its existing turn ID and updated thread settings.
- Treat recovery separately from automatic idle work so it can resume in Plan mode without injecting an empty user message.
- Reject recovery while another turn is active without applying settings or queuing input.

## Testing

- Cover successful Plan-mode recovery, turn ID preservation, and the absence of an empty user message.
- Cover active-turn rejection and verify that it leaves settings and pending input unchanged.

GitOrigin-RevId: 2376fdc78b5d48b571633981960741ba269ab1ef
2026-08-13 03:27:19 +00:00
Dylan Hurd
357696c5e7 Route network access through the shared approval pipeline (#38299)
## What changed

- Represent blocked network requests as approval actions so permission hooks,
  automatic review, and user review use the common approval flow.
- Route network requests using the active turn's review settings, including for
  background terminals started by an earlier turn.
- Record the final applied network decision in tool telemetry without exposing
  the destination or assigning an approval source.
- Persist deny amendments and keep the blocked request denied.

## Testing

Added coverage for strict automatic review, cross-turn background network
requests, deny amendment persistence, and destination-safe telemetry.

GitOrigin-RevId: a2a9d106962f407ed93f4d198f40ced15f090b8e
2026-08-13 02:40:49 +00:00
Owen Lin
b1373b74a2 Add durable reverts for paginated threads (#38292)
## What changed

- Add `ThreadStore::revert_thread` to retain history before a selected turn by creating a new immutable rollout and atomically switching the thread's stored rollout path.
- Preserve the logical thread ID and session metadata across repeated reverts.
- Track every rollout owned by a thread so archive, unarchive, and delete operations handle the complete lineage and restore moved files when metadata updates fail.
- Prevent deletion when forks still reference any rollout in the thread's lineage.

## Testing

- Cover repeated reverts, compressed source rollouts, lifecycle operations over reverted histories, reference-aware deletion, and cross-process unarchive locking.

GitOrigin-RevId: 1c05a6db3d0036ee91b562263d7ca200c6a0ea71
2026-08-13 01:56:24 +00:00
rhan-oai
8d637ae398 Remove unused apply_patch prompt fallback (#38291)
## What changed

- Delete the unused standalone `apply_patch` instruction template and its
  `codex-prompts` export.
- Simplify prompt-caching coverage to assert that requests use the model's base
  instructions.

GitOrigin-RevId: 8c0dc9426d9ac0184d587272622db608a75e8436
2026-08-13 01:52:02 +00:00
Channing Conger
5104cb649e Support gRPC code-mode hosts in app server (#38288)
## What changed

- Accept root `http://` and `https://` URLs in `--code-mode-host` and use the
  shared gRPC session provider for those endpoints.
- Keep `ws://` and `wss://` URLs on the existing WebSocket transport.
- Reject paths, queries, fragments, and credentials where unsupported, without
  exposing gRPC URL credentials in command-line validation errors.

## Testing

- Cover argument parsing and transport selection for both remote protocols.
- Exercise a gRPC host shared across app-server threads and verify credential
  rejection does not disclose usernames or passwords.

GitOrigin-RevId: b6516a85cf76db5c4cea620f89ef866d8af30cf0
2026-08-13 01:32:42 +00:00
Charlie Marsh
e766f75989 Move codex-execpolicy to protocol dev dependencies (#38285)
## What changed

Declare `codex-execpolicy` as a dev dependency of `codex-protocol`, matching
its use exclusively by tests.

GitOrigin-RevId: a19c18fc89a04560d80b16e2e530abb633d1ee35
2026-08-13 00:43:23 +00:00
Kyle Brown
9579479d28 Collect plugin metrics from remote executors (#38283)
## What changed

- Resolve manifest-declared metric operations against the executor filesystem for remote plugin commands.
- Create the measurement sidecar in an executor-native, owner-private temporary directory, stream its bounded output back for validation, and clean up the directory afterward.
- Extend the exec-server protocol with the executor temporary directory and atomic private-directory creation.

## Testing

- Cover remote unified-exec measurements for foreground and background commands.
- Verify private directories use owner-only permissions on Unix and fail closed on unsupported platforms.

GitOrigin-RevId: dbbd0a84717b91237fc5728e510e18994eb46dd4
2026-08-13 00:39:04 +00:00
Felipe Coury
1e71e35df6 Add thread usage to TUI status surfaces (#38282)
## What changed

- Add `thread-credits` and `estimated-thread-cost` items to the configurable
  status line and terminal title for Enterprise workspaces.
- Fetch one shared thread usage estimate only when either item is selected,
  omit unavailable values, and refresh the display after turns complete.
- Preserve the last nonzero estimate while usage settles, with bounded delayed
  refreshes and retries for transient failures.

## Testing

- Add coverage for configuration, rendering, previews, plan availability,
  replay handling, retries, and post-turn settlement.

GitOrigin-RevId: dd69ee621c5bca0e5d9edd32b2bba42487eb1500
2026-08-13 00:34:39 +00:00
Felipe Coury
f1a1fce26a Show estimated thread usage in /status (#38281)
## What changed

- Extend `account/usage/read` with an optional `threadId` request and a
  backward-compatible `threadUsage` response containing estimated credits,
  optional USD cost, and model, reasoning, speed, and token breakdowns.
- Fetch thread usage for eligible Business and Enterprise plans when `/status`
  is opened, then update the rendered status card asynchronously.
- Preserve terminal scrollback when replacing a visible status-card tail, and
  append a refreshed card when the original tail can no longer be updated.

## Testing

- Add app-server coverage for authentication, canonical thread IDs,
  unavailable billing routes, and malformed IDs.
- Add TUI coverage for usage formatting, stale responses, retries, history
  updates, terminal reflow, and scrollback preservation.

GitOrigin-RevId: 49300914b3fba917c0f08e8595363e04e5ba6d37
2026-08-13 00:30:08 +00:00
Adam Perry @ OpenAI
27a98dde4d Use protobuf's built-in Bazel proto rule (#38280)
## What changed

- Load `proto_library` for the code-mode protocol directly from the
  `com_google_protobuf` repository.
- Remove the now-unneeded direct `rules_proto` module dependency.

GitOrigin-RevId: 5a01191b2c46c7fafd263ed93f153a878b09aaa8
2026-08-13 00:26:06 +00:00
Kyle Brown
c38d59fca0 Add app-server coverage for plugin measurement analytics (#38278)
## What changed

- Add end-to-end tests for curated plugin measurements through classic shell execution and unified exec.
- Cover unified background commands whose measurements arrive after the turn completes.
- Verify command attribution and measurement payloads, including values, dimensions, execution IDs, and thread, turn, and item IDs.

GitOrigin-RevId: 866103aafef8d3454123c40aee7041912ad0b7fc
2026-08-13 00:08:57 +00:00
Kyle Brown
96e8afbfb8 Track plugin metrics for background unified exec commands (#38276)
## Why

Unified exec can yield while a command is still running. Plugin measurement
collection must remain active until that background command exits, including
when its item completion arrives after the turn has completed.

## What changed

- Keep the plugin metrics sidecar with the stored process and let either the
  exit watcher or a poll that observes completion finalize it exactly once.
- Retain completed turn analytics state while tool items are pending so late
  command completion events can be emitted without duplicating the turn event.

## Testing

- Verify that a background command completed after its turn emits a command
  execution event and does not emit a second turn event.

GitOrigin-RevId: ecf715b3e047aa29ca9a417d12d955257fed8557
2026-08-13 00:04:57 +00:00
Owen Lin
cbb7e82a8b Unify turn input submission and routing (#38275)
## What changed

- Add `TurnInputRequest` and typed submission results for atomically starting a turn, steering the active turn, or declining input with a specific reason.
- Expose `start_or_steer_turn`, `start_turn_if_idle`, and `steer_turn` on `CodexThread`, and migrate Core consumers to these APIs.
- Make app-server `turn/start` steer an active regular turn and return that turn's ID. Reject incompatible output schemas and non-steerable turns without applying settings or enqueueing input.

## Testing

- Cover concurrent start-or-steer submissions, accepted and rejected settings updates, output-schema compatibility, idle-start rejection, and app-server steering.

GitOrigin-RevId: dd9b5528d76ec650c019e97af420bc13190ea86a
2026-08-13 00:00:16 +00:00
Tamir Duberstein
4b07886d59 Represent persisted world state as JSON objects (#38274)
## Why

World-state snapshots and merge patches are keyed collections of sections. Allowing
their persisted `state` field to contain any JSON value required replay code to
handle shapes that cannot represent world state.

## What changed

- Type `WorldStateItem.state` and snapshot patches as JSON object maps.
- Reconstruct full snapshots directly from those maps and apply patches without
  fallible arbitrary-value conversions.
- Regenerate the app-server protocol schema for the object-only representation.

GitOrigin-RevId: 3d7662b74f3dd1f3ccc5fdd0200074c13a73cbe5
2026-08-12 23:56:45 +00:00
ashwinnathan-openai
361fe2d202 Stamp conversation history items with creation times (#38272)
## What changed

- Add fractional Unix creation times to locally authored user, developer, agent, and tool-output items when they enter durable conversation history.
- Preserve any creation time already supplied with an item across subsequent requests, remote compaction, and resumed history.

## Testing

- Cover timestamp assignment and preservation in session, client, tool, agent-spawn, and remote-compaction tests.

GitOrigin-RevId: 431d1770b9746005c808bc0a43953845166d68ad
2026-08-12 23:04:42 +00:00
Felipe Coury
842fae26c9 Add per-thread usage queries to the backend client (#38270)
## What changed

- Add `Client::get_thread_usage` for querying authoritative estimated credit
  and dollar usage for a thread across both supported backend path styles.
- Expose usage totals and optional model, reasoning effort, speed, and token
  breakdowns through `ThreadUsage` and `ThreadUsageBreakdownGroup`.
- Reject responses that do not include the requested thread.

## Testing

- Cover endpoint paths, request serialization, complete and partial usage
  responses, and mismatched thread IDs.

GitOrigin-RevId: 16c83590b2c804e0182b4493cf2aa39206029c77
2026-08-12 22:58:46 +00:00
jif
5664a5c07c Expose executor skill roots from skills.read (#38268)
## Why

Executor-backed skills can include bundled scripts, so skill readers need the
skill directory in the executor filesystem to locate them.

## What changed

- Add `skill_root` to `skills.read` responses for executor-backed skills.
- Derive the root from the parent directory of the skill's main resource and
  omit the field for other skill authorities.

## Testing

- Verify executor skill reads return the expected root for both `SKILL.md` and
  a referenced resource.

GitOrigin-RevId: b7035c7e2e62155890795fb508fefe3a1c17805b
2026-08-12 22:54:35 +00:00
chess
631bbb33cc Use bounded fallback ports for Windows managed proxies (#38265)
## What changed

- Try the explicitly configured Windows HTTP or SOCKS5 proxy port first, then scan the protocol's preferred port range when that port is unavailable.
- Reserve HTTP and SOCKS5 listeners independently so a SOCKS5 collision does not replace an already available HTTP listener.
- Retain ephemeral loopback fallback when all preferred ports are unavailable, and document the HTTP (`3128-3159`) and SOCKS5 (`8081-8112`) ranges.

## Testing

- Cover bounded HTTP and SOCKS5 fallback, independent listener reservation, and ephemeral fallback after preferred-port exhaustion.

GitOrigin-RevId: 002c641f5bd70fedf04cca96c65c5fee2c5ebcac
2026-08-12 22:33:18 +00:00
jif
130c7c93a9 Resolve skill package aliases in skills.read (#38261)
## Why

Skill catalogs can present shortened package locators, but callers previously had
to expand those aliases before reading a skill.

## What changed

- Resolve catalog aliases automatically when `skills.read` looks up a
  model-visible executor or orchestrator skill package.
- Update skill prompts and tool documentation to tell models to pass the listed
  package locator directly.

## Testing

- Exercise reading an executor skill through its shortened package locator when
  the skills catalog exceeds its context budget.

GitOrigin-RevId: d1cdfd64002510b616146929deb5b7077850b951
2026-08-12 22:10:55 +00:00
cooper-oai
18dcc7646f Unify external authentication provider handling (#38258)
## What changed

- Use each `ExternalAuth` provider's error classification for resolve, refresh,
  and validation failures.
- Allow runtime providers to be replaced, clearing any recorded permanent
  refresh failure after the replacement resolves successfully.
- Preserve workload identity as immutable, host-managed authentication while
  sharing external ChatGPT credentials through the process-local store.

## Testing

- Cover provider replacement after a permanent failure, provider-defined error
  classification, workload identity immutability, and refreshed headers after
  an unauthorized response.

GitOrigin-RevId: ec75cf9224dc82d3fd10063606c724e3b06fb1e7
2026-08-12 22:04:27 +00:00
Channing Conger
bde723ae7d Reconnect gRPC code-mode sessions after host restarts (#38257)
## What changed

- Reopen a cached code-mode session when its gRPC host stops, while
  serializing concurrent reconnection attempts and coordinating shutdown.
- Scope cell IDs to the new host generation so callbacks remain consistent
  and stale `wait` or `terminate` requests are rejected.
- Accept both `unix://` and `unix:` endpoints for gRPC hosts on Unix systems.

## Testing

- Cover host restart recovery, concurrent execution after reconnection,
  generation-aware callbacks and cell operations, stale cell rejection, and
  Unix socket execution.

GitOrigin-RevId: 548e168fdcef7f7d54bd32262e614886bf7bdd32
2026-08-12 22:00:20 +00:00
Dylan Hurd
020f6c963e Report the latest rejection from multiple network reviews (#38256)
## Why

A single execution can trigger multiple network approval reviews. Its tool
result should reflect the latest specific rejection.

## What changed

- Let each explicit network review outcome replace the previously recorded
  outcome for the execution.
- Keep generic blocked-request messages as fallbacks that cannot overwrite an
  explicit review outcome.

## Testing

- Add unit coverage for outcome precedence.
- Add an integration test that rejects two network requests from one execution
  and verifies that only the latest rejection is returned.

GitOrigin-RevId: 644a01e5c49855adcdc48ba8f91baededce26875
2026-08-12 21:55:31 +00:00
Kyle Brown
6e7daed1e9 Collect plugin metrics from unified exec commands (#38253)
## What changed

- Create a metrics sidecar for attributed local plugin commands launched through unified exec, and grant the sandbox access to its output file.
- Publish valid measurements when the initial command exits, while discarding the sidecar when the process remains live for later polling.
- Strip inherited or configured `CODEX_PLUGIN_METRICS_OUTPUT` values so each command can only use its own sidecar.

GitOrigin-RevId: 43e669e4c77171aec8a798de0c12ca13bfb8adee
2026-08-12 21:27:30 +00:00
Kyle Brown
9ca0337dbf Collect metrics from plugin shell commands (#38252)
## What changed

- Provide matching local plugin commands with a sandbox-writable temporary output file through `CODEX_PLUGIN_METRICS_OUTPUT` when analytics is enabled.
- Validate successful command output against the plugin's `analytics.yaml` declaration, including measurement names, enum dimensions, finite values, duplicate rows, and size limits, before publishing analytics events.
- Keep the output path reserved from user overrides and clean up the temporary file after execution.

## Testing

- Cover output validation, limits, cleanup, sandbox permissions, environment handling, and path replacement.
- Verify measurement collection through both classic and zsh-fork shell runtimes.

GitOrigin-RevId: 88af0f87dc2f207fcbcca6af498f5c940d79349d
2026-08-12 21:23:21 +00:00
pakrym-oai
8bb8d60234 Read model ETags from WebSocket metadata events (#38251)
## What changed

- Extract `x-models-etag` from `codex.response.metadata` events and emit it as a `ModelsEtag` response event.
- Stop reading or reporting the model ETag from WebSocket upgrade headers.

## Testing

- Update the WebSocket response-stream test to deliver the ETag through a metadata event and verify that it is emitted.

GitOrigin-RevId: 9b9cff3d8a0a914549aca62d8d316483a9a47f69
2026-08-12 21:18:15 +00:00
xl-openai
379cb68444 Add dynamic HTTP header helpers for MCP servers (#38245)
## What changed

- Add `http_headers_helper` configuration for local streamable HTTP MCP servers. The configured shell command runs once per connection and returns a JSON object of headers that is cached across requests.
- Apply helper headers to MCP startup and OAuth flows while restricting them to the server origin, stopping redirects, rejecting reserved or duplicate headers, and enforcing output and execution limits.
- Reject helpers for remote or managed-disabled servers, use the local environment working directory, and redact helper commands from `codex mcp list` and `codex mcp get` output.

## Testing

- Cover configuration validation, helper lifecycle and output parsing, origin isolation, OAuth discovery and token refresh, managed requirements, environment selection, and CLI redaction.

GitOrigin-RevId: 84e0e26ce75520b0869d37c72b1678e033bd6818
2026-08-12 20:36:32 +00:00
Owen Lin
8d4d57387a Resolve paginated thread history by rollout ID (#38244)
## Why

`thread/revert` keeps the logical thread ID while selecting a new immutable
rollout. Using the thread ID for persisted history can therefore read or update
the wrong rollout.

## What changed

- Centralize resolution of a thread's current rollout across live writers,
  SQLite metadata, and filesystem fallbacks.
- Key history materialization, lineage traversal, paging, turn lookup, and fork
  boundaries by immutable rollout ID while retaining the thread ID for the
  logical thread.
- Treat SQLite's selected rollout as authoritative for paginated threads so a
  filesystem scan cannot select an older rollout after `thread/revert`.

## Testing

Add a regression test showing that update-ordinal item paging reads from the
selected rollout ID when it differs from the thread ID.

GitOrigin-RevId: 1101e548a6e6c6d319996e24cb650e5b03ab7fbb
2026-08-12 20:31:52 +00:00
rka-oai
0e0ef5d818 Track client-authored developer messages in rollout history (#38243)
## What changed

- Mark developer messages received from clients with `client_authored` harness
  metadata when `retain_client_developer_messages` is enabled.
- Carry that provenance through pending input and persist it alongside rollout
  response items without adding it to provider requests or the serialized
  `TurnInput` payload.
- Preserve existing behavior for unannotated response items and when the
  feature is disabled.

## Testing

- Cover client item injection before and during turns, additional application
  context, rollout replay, image resize notices, and serialization boundaries.

GitOrigin-RevId: f385c177732becde732272e4b8440eb91f5c1039
2026-08-12 20:05:49 +00:00
Charlie Marsh
3d7bb2dd2e Cache stable active-cell layout measurements (#38242)
## What changed

- Reuse desired and rendered heights for active transcript cells that report a stable height.
- Invalidate the cached layout when the cell identity, revision, width, render mode, or syntax theme changes, and when the active cell is removed.
- Continue rebuilding display lines on every frame so animated content stays live, while dynamic-height cells bypass the persistent cache.

## Testing

- Add rendering tests for height reuse, bottom-anchored overflow, cache invalidation, animated display lines, and dynamic-height cells.

GitOrigin-RevId: 414cc4269bfb6b68105837c82e31787272d335a7
2026-08-12 19:43:32 +00:00
Ankush Gupta
74004b5397 Include Node REPL policy in turn metadata (#38241)
## What changed

- Parse `node_repl_auto_review_required` and `node_repl_disabled` from model catalog entries and include their values in each turn's Responses API metadata.
- Treat both fields as reserved metadata so client-provided values cannot override the selected model's policy.
- Use the selected review model's catalog entry when building metadata for review turns.

## Testing

- Cover metadata propagation across model switches, review turns, Responses API requests, and MCP tool calls.

GitOrigin-RevId: c1f63426eeb8e559abff439fbc618716a4908aff
2026-08-12 19:37:51 +00:00
Kyle Brown
d6eefb26a6 Add bounded plugin measurement analytics (#38239)
## What changed

- Add `PluginMeasurementsInput` and `PluginMeasurementRow`, plus an analytics
  client method for recording batches and checking whether analytics are enabled.
- Emit each valid row as a `codex_plugin_measurement_event` with thread, turn,
  item, plugin, execution, and operation context.
- Bound batches at 100 rows and reject non-finite values, invalid identifiers,
  and rows with more than eight dimensions.
- Treat measurement events as plugin events when routing API-key analytics.

## Testing

- Cover batch limits, row filtering, serialized event payloads, and API-key
  plugin-event routing.

GitOrigin-RevId: f949ed06246ee1e22466df2660076f2d4f556444
2026-08-12 19:14:09 +00:00
Kyle Brown
dc8562d672 Add manifest-defined metrics for trusted plugin scripts (#38238)
## What changed

- Load version 1 `analytics.yaml` manifests from trusted plugin roots and map declared operations, measurements, and enum dimensions to exact script paths.
- Expose resolution types and bind a declared operation to the plugin identity returned by fresh command attribution.
- Reject malformed, oversized, ambiguous, or unsafe manifests without disabling normal script attribution.

## Testing

- Cover exact script resolution, measurement names shared across operations, and invalid manifests including duplicate keys, path traversal, symlink escapes, invalid identifiers, and oversized files.

GitOrigin-RevId: 1e2f221b9f2c3d7faffe578c7a8499ad4ed933ca
2026-08-12 19:09:48 +00:00
Eddie Chen
1f4ea79853 Track root turns across delegated Codex requests (#38232)
## Why

`parent_turn_id` identifies the immediate caller of a nested request, but not the
top-level turn that initiated a multi-level chain of work.

## What changed

- Add `root_turn_id` to turn state, submissions, and Responses API metadata.
- Propagate the root through spawned agents, delegated work, review sessions, and
  turn-triggering inter-agent messages.
- Omit the root when background work has no user turn or combined input makes the
  root ambiguous.

## Testing

Added coverage for nested agent resumes, reviews, mailbox delivery, steered input,
and reserved metadata handling.

GitOrigin-RevId: 60057db2ee81f4efefa946a9f63c74ff98b93929
2026-08-12 18:11:13 +00:00
ryanleeoai
9df9ff6ad9 Detect implicit skill invocations from PowerShell reads (#38228)
## What changed

- Recognize `Get-Content` reads of indexed `SKILL.md` files as implicit skill invocations.
- Support the optional `-Raw` flag, quoted paths containing spaces, and Windows paths without stripping backslashes.

## Testing

- Add unit coverage for the supported `Get-Content` forms and Windows path parsing.

GitOrigin-RevId: 681f2e2fff9a597326bc94b97a31e311ef21b949
2026-08-12 18:04:20 +00:00
rka-oai
1ad4397821 Add a flag to retain client developer messages (#38227)
## What changed

- Register `retain_client_developer_messages` as an under-development feature
  that is disabled by default.
- Expose the feature in the configuration schema.

GitOrigin-RevId: dc56c48fe79a9f288b7fe0a11d97af992d36797f
2026-08-12 17:49:36 +00:00
jif
7093e8c480 Start required cached MCP servers lazily for subagents (#38217)
## Why

Subagents can reuse cached MCP tool definitions without opening another server
connection immediately, but marking a server as required previously forced eager
startup even when its cached tools were available.

## What changed

- Allow required MCP servers with usable cached tools to remain dormant under
  the lazy startup policy.
- Treat those cached tools as satisfying required-server validation and tool
  catalog capture until the server is needed.
- Preserve eager startup for required servers without cached tools and start a
  dormant server when one of its tools is called.

## Testing

Extend the cached HTTP MCP subagent test to cover both optional and required
servers, verifying that the required server stays dormant until its cached tool
is called.

GitOrigin-RevId: 48ea20b9ae447eef27461caee2320ea78465bb6a
2026-08-12 16:50:23 +00:00
Tamir Duberstein
91d6f48992 Avoid allocations when sanitizing TUI user text (#38214)
## Why

Sanitizing user messages and pasted text always allocated a new string, even
when the input contained no terminal control characters.

## What changed

- Return a `Cow<str>` from `sanitize_user_text` so clean borrowed input remains
  borrowed.
- Reuse owned input buffers when sanitization leaves the text intact or only
  removes content at the edges.
- Update transcript rendering, history cells, and paste handling to consume the
  borrowed-or-owned result without unnecessary cloning.

## Testing

Add sanitizer coverage for clean text, control sequences, Unicode control
characters, incomplete escape sequences, buffer reuse, and multi-fragment
output.

GitOrigin-RevId: 9e39cbc0d83c5791941b37a7eb4bb918c1a05f68
2026-08-12 16:33:32 +00:00
Dylan Hurd
95aada11c4 Enforce non-interactive approval policy for Codex delegates (#38205)
## What changed

- Require delegated Codex sessions to use the `never` approval policy and reject
  delegate creation with any prompt-capable policy.
- Stop forwarding delegate approval and permission requests to the parent
  session. Approval-requiring commands and MCP tool calls are denied within the
  delegate instead.
- Skip prompts for missing skill MCP dependencies when approvals are disabled.

## Testing

Add coverage for review and Guardian delegates to verify that command
escalations, MCP approvals, and skill dependency installation do not prompt or
execute approval-gated actions.

GitOrigin-RevId: fee96a97624352cd25c904592ba7eebe2ae3fd63
2026-08-12 15:31:47 +00:00
jif
3d7f9b4637 Fuse recent and lexical skills in shadow selection (#38204)
## What changed

- Add the `lru_plus_lexical_v1` selector, combining the 50 most recent skills
  with weighted lexical matches through reciprocal rank fusion.
- Include the combined selector in the shadow-selection experiment and propagate
  query and candidate truncation metadata from both inputs.
- Generalize the existing reciprocal-rank fusion helper to accept a rank
  constant while preserving the existing lexical/character selector behavior.

## Testing

- Cover lexical-only selection, merging recent and matching skills, promotion
  from agreement between both rankings, and weak overlaps.
- Extend the skills extension test to verify invocation metrics for the new
  selector alongside `lru_v1`.

GitOrigin-RevId: 1b7b82bc97ea919c719cd05a009351b701019306
2026-08-12 15:17:54 +00:00