Commit Graph

9386 Commits

Author SHA1 Message Date
Ben Romano
45cf6cbc19 Propagate caller metadata to rendezvous connections (#39073)
## What changed

- Add `x-cluster-name` from `OPENAI_CLUSTER` and
  `x-openai-internal-caller` from `DD_SERVICE` to rendezvous WebSocket
  handshakes when the environment values are nonempty and valid HTTP header
  values.
- Apply the rendezvous headers to both client and remote executor connections
  while preserving the existing W3C trace context headers.

GitOrigin-RevId: fead0244ba24fa208990b92d2170a9ae76ff2ceb
2026-08-17 20:36:10 +00:00
Andrew Wilkes
682f57254f Persist generated images through turn executors (#39072)
## Why

Image generation did not save its result when the extension host did not provide a host-local save root.

## What changed

- Save generated images under the turn environment's `generated_images` directory through its sandboxed filesystem executor when no host save root is configured.
- Limit executor-written images to 32 MiB, reject symlinked output directories and existing destinations, and continue returning the image if persistence fails.
- Include the saved workspace path in the tool output hint while preserving host-managed persistence when a save root is available.

## Testing

- Extend the granted-turn-permissions integration test to verify the image and path hint are written to the turn workspace without creating a host-local artifact.

GitOrigin-RevId: 3d24381a75fe4595641b5250e19fac8ed473b2cd
2026-08-17 20:32:41 +00:00
felixxia-oai
d24507a59b Remove skill model delegation support (#39068)
## What changed

- Stop parsing and exposing the `model` field from skill frontmatter.
- Remove the skill model delegation types and instruction generation.

GitOrigin-RevId: 01198c68c095da5062e8abec417cc3539099d9d5
2026-08-17 20:19:04 +00:00
chess
51a9edc083 Add desktop security enforcement diagnostics (#39067)
## What changed

- Add a `desktop.security.enforcement` doctor check for macOS that assesses the app with Gatekeeper and classifies recent Gatekeeper and XProtect events.
- Add the same check on Windows by inspecting recent Microsoft Defender, AppLocker, and Windows App Control events for Codex executables.
- Report blocked or quarantined executions as failures, audit-only or unavailable evidence as warnings, and include actionable remediation while bounding and redacting collected event details.

## Testing

- Add coverage for platform event classification, trusted executable matching, unavailable diagnostics, remediation, and bounded redacted evidence.

GitOrigin-RevId: 792844390cd2cf92d3bc20e6a0973020b4364e51
2026-08-17 20:15:37 +00:00
Charlie Marsh
d327527a3d Limit terminal hyperlink layout to the visible viewport (#39065)
## What changed

- Skip hyperlink layout for wrapped rows above the scroll offset and stop once
  processing reaches the bottom of the viewport.
- Resolve each rendered link destination once while marking its visible cells.
- Add coverage for hyperlinks that span visible wrapped rows after scrolling.

GitOrigin-RevId: c1506d47fa3f1b895966dc2cde7d5b859c201792
2026-08-17 20:06:41 +00:00
Benjamin Carlsson
1aa3a68e7b Restrict queued-message editing to its dedicated binding (#39064)
## What changed

- Stop treating Vim normal-mode history-up as an alias for editing the latest queued message.
- Continue to edit queued messages through the configured `chat.edit_queued_message` binding.

GitOrigin-RevId: d830e0976a38725e948d420c1a5f374bb13fe945
2026-08-17 20:02:50 +00:00
Charlie Marsh
b6e153c985 Render only visible rows in the transcript pager (#39063)
## Why

Scrolling the transcript pager previously rendered a scratch buffer containing
all rows through the visible viewport, including hidden content above it. This
made rendering work and buffer size grow with the scroll offset.

## What changed

- Add viewport-aware rendering for committed transcript cells and the live tail.
- Forward scrolled rendering through cached and inset renderables while keeping
  the full-height fallback for renderables that do not support it.
- Keep hyperlink metadata aligned with scrolled text.

## Testing

Add coverage comparing viewport-aware output with the full-height fallback
across wrapping widths, offsets, insets, styles, hyperlinks, and live tails.

GitOrigin-RevId: 630c30c4a61969a50f2b34701ca1dd87788a4298
2026-08-17 19:59:22 +00:00
Charlie Marsh
386a7b629c Avoid rerendering streamed code fences (#39061)
## Why

The streaming TUI rerendered the entire mutable Markdown block whenever a
newline-bearing delta arrived. For long fenced code blocks, this repeatedly
parsed and syntax-highlighted the growing fence.

## What changed

- Detect open, top-level, language-tagged code fences and append newly
  completed lines directly to the existing render.
- Preserve Syntect parser state across appended lines so multiline syntax and
  the active theme remain consistent.
- Fall back to the canonical Markdown renderer for ambiguous fence syntax,
  theme changes, incomplete lines, and highlighting limit transitions.

## Testing

Added coverage that compares streamed output with full renders across syntax
styles, Unicode, links, blank lines, fence variants, theme changes, and
highlighting limits. A long-fence test also verifies that the rendered prefix
is retained as new lines arrive.

GitOrigin-RevId: 036db2b7bc93607083b8001f8b4fa3cbb58c713e
2026-08-17 19:49:47 +00:00
chess
80e925c28b Add desktop app diagnostics to codex doctor (#39060)
## What changed

- Detect installed Codex desktop apps on macOS and Windows and report their version, running state, and redacted log location.
- Inspect bounded log data for the active desktop session and report the latest local app-server handshake outcome without exposing other log fields.
- Add a dedicated Desktop App section to human-readable doctor reports.

## Testing

- Cover local versus remote handshakes, failed handshakes with sensitive fields, bounded log reads, and stopped desktop sessions.

GitOrigin-RevId: ecfb4bd7af3589263624771ec9413b51953280eb
2026-08-17 19:43:09 +00:00
thomas
14973840e0 Tag Codex Apps protocol discovery metrics (#39058)
## What changed

Add `server_kind=openai_codex_apps` to the
`codex.mcp.protocol_discovery` counter and its duration metric when protocol
discovery runs for the Codex Apps MCP server. Other MCP servers retain the
existing `mode` and `outcome` tags.

GitOrigin-RevId: aadbdc54642f2c103a9f1bab39308e962c115f75
2026-08-17 19:38:18 +00:00
Tamir Duberstein
796325f1e5 Rate-limit TUI frames from their actual emission time (#39057)
## Why

Recording a late frame's requested deadline as its emission time can leave the
rate limiter with a stale timestamp, allowing the next frame to be emitted
immediately in a redraw burst.

## What changed

Record the current time when the frame scheduler sends a draw notification so
the 120 FPS limit is measured from the actual emission.

## Testing

Add a paused-time regression test that submits an overdue draw and verifies the
next frame waits for `MIN_FRAME_INTERVAL`.

GitOrigin-RevId: 8c9a5ac0bf858b2ad87838f6d7c67c9470fdfc61
2026-08-17 19:34:05 +00:00
sayan-oai
4a7b51c560 Add network policy metadata to environment configuration (#39055)
## What changed

- Add `EnvironmentNetworkPolicy` as a serializable view of portable domain,
  Unix-socket, upstream-proxy, and local-binding restrictions without exposing
  controller-owned proxy runtime settings.
- Add an optional `network_policy` field to `EnvironmentConfig` and re-export
  the policy and related permission types through the core APIs.
- Reject owner-provided network policies during environment preview and
  readiness until runtime enforcement is implemented, while preserving the
  existing controller policy when the field is absent.

## Testing

- Cover rejection through both environment preview and readiness, including
  preservation of the existing environment selection.

GitOrigin-RevId: 80ad4cf4d4a45632daa7a823e6cf568eb0e8bb80
2026-08-17 19:22:45 +00:00
Charlie Marsh
fe5889928c Use installed callable apps for TUI mentions (#39051)
## Why

The app directory is a discovery catalog and can include apps that are not
callable in the active thread. Using it for `$` suggestions can therefore
offer mentions that cannot be used.

## What changed

- Load mention candidates from `app/installed`, enrich callable apps through
  bounded `app/read` batches, and retain compatibility with app servers that
  do not support `app/installed`.
- Keep the mention catalog separate from the `/apps` directory cache and scope
  results to the current thread, workspace, and account.
- Refresh mentions after app notifications, enablement changes, configuration
  updates, and apps MCP readiness, while immediately removing disabled apps.

## Testing

Add coverage for batching and fallback behavior, stale scoped results,
notification refreshes, enablement changes, MCP startup races, and filtering
non-callable apps from mentions.

GitOrigin-RevId: 4d9e20794aed30cc97120170792fb555b86fe1e7
2026-08-17 19:11:34 +00:00
Felipe Coury
d7d526b81d Prepare the telemetry shutdown worker during initialization (#39050)
## Why

Creating the telemetry shutdown thread during shutdown can fail under resource
pressure, including when the native thread guard page cannot be allocated.

## What changed

- Start and verify a dedicated shutdown worker when `OtelProvider` is created.
- Send the provider to the prepared worker for bounded shutdown, while preserving
  timeout behavior and avoiding a potentially blocking destructor if worker
  preparation failed.
- Rename the fallible provider constructor to `try_new`.

## Testing

Add Unix regression coverage that injects guard-page allocation failures, plus
coverage for worker preparation failure, successful shutdown, and timeouts.

GitOrigin-RevId: 3656298078a800a7fa392437c2ee4a68753092e3
2026-08-17 19:06:53 +00:00
Benjamin Carlsson
1a8bac9405 Avoid rendering sub-agent activity twice in the TUI (#39049)
## Why

The app server sends sub-agent activity in both item-started and item-completed
notifications, causing the TUI to add the same activity to history twice.

## What changed

Render live sub-agent activity when the item completes instead of also rendering
it when the item starts. Preserve the existing replay behavior.

## Testing

Add a regression test that sends matching started and completed notifications
and verifies that the activity produces one history cell.

GitOrigin-RevId: 76a66f3657fe297f37067ed672ab9642997b4499
2026-08-17 19:02:05 +00:00
Charlie Marsh
0c901fd141 Skip plugin hook loading when hooks are disabled (#39047)
## What changed

Gate plugin hook resolution in `hooks/list` on both the hooks and plugins
feature flags. When hooks are disabled, return the default empty plugin hook
outcome without loading plugin hook sources or warnings.

GitOrigin-RevId: 166070576effaba248b790c4f2a47e6e9a7b1112
2026-08-17 18:54:49 +00:00
Eric Traut
ff770113ca Restrict MCP HTTP redirects to the configured origin (#39046)
## Why

MCP requests can contain sensitive headers and tool-call bodies. Following a
cross-origin redirect could disclose them to another server.

## What changed

- Follow redirects only when every hop remains on the configured server's
  origin, and require HTTPS for redirects on non-loopback hostnames.
- Preserve standard redirect method and body handling while sharing the
  original timeout and enforcing a 10-hop limit.
- Avoid replaying plaintext proxy credentials across redirects, while leaving
  OAuth requests that stop at redirects unchanged.

## Testing

Add coverage for same-origin and cross-origin redirects, redirect methods,
headers and bodies, proxy credentials, timeouts, hop limits, and legacy MCP
tool calls.

GitOrigin-RevId: 3e267911a1665ad8c2fc63825099a758770f4d68
2026-08-17 18:46:12 +00:00
Shijie Rao
06418909a0 Add managed gates for in-app chat and dictation (#39045)
## What changed

- Register `in_app_chat` and `in_app_dictation` as stable, default-enabled feature gates for desktop apps.
- Allow requirements to disable either capability and expose both keys in the generated configuration schema.

## Testing

- Add configuration tests that verify enterprise requirements can disable each gate.

GitOrigin-RevId: 5bba35d710fb0b6924aa55df98b2e013fa288f6d
2026-08-17 18:41:50 +00:00
Abhinav
0f21cb3413 Enforce managed authentication backend settings (#39043)
## What changed

- Add `cli_auth_credentials_store` and `chatgpt_base_url` as exact managed requirements loaded from local requirements configuration.
- Apply these requirements to runtime and bootstrap authentication configuration, overriding user-configured values.
- Expose the managed values through `configRequirements/read` and reject attempts to change them through config write APIs.
- Ignore these local-only authentication requirements in cloud-managed requirement layers.

## Testing

- Cover requirement loading and composition, runtime and bootstrap overrides, app-server responses, and read-only config writes.

GitOrigin-RevId: 8ea9c096386072036ca5441f3d48af8707988a65
2026-08-17 18:35:54 +00:00
iceweasel-oai
d0fd4e830a Preserve foreign paths in managed network approvals (#39040)
## Why

Unified exec could drop network approval registration when a selected environment used a Windows working directory on a non-Windows host because the trigger path could not be converted to a host absolute path.

## What changed

- Keep network approval trigger working directories as `PathUri` values and render them with their inferred native path syntax for Guardian requests.
- Fall back to the selected turn environment only when a trigger path can be converted to a host absolute path.
- Reject selected environment working directories larger than 8 KiB at the thread-manager validation boundary.

## Testing

- Cover managed-network approval registration for a foreign Windows working directory.
- Verify that oversized working directories are rejected as invalid `thread/start` requests.

GitOrigin-RevId: 646fbf12115a35a7e5cb04b511464797bee6647b
2026-08-17 18:15:56 +00:00
felixxia-oai
9dd3d6a13e Restore Guardian risk scores across thread lifecycles (#39038)
## Why

Resumed and forked threads need their persisted Guardian risk state available when routing later approval requests.

## What changed

- Initialize a session's `SecurityRiskScore` from the latest score in its rollout history when no score was supplied explicitly.
- Preserve the inherited score when resuming or forking a thread so low-risk actions can skip redundant Guardian reviews.

## Testing

- Add app-server coverage for inheriting the latest Guardian score when resuming and forking threads.

GitOrigin-RevId: 95a6c803f8dae75516d1da9d66a722379a0a7ef2
2026-08-17 17:33:30 +00:00
Charlie Marsh
1d928cad2f Allow config reads to join active app-server read batches (#39036)
## Why

Config reads arriving while a long-running shared read was active waited for that
request to finish, even though they could safely run concurrently.

## What changed

- Admit newly queued shared reads into the active batch until an exclusive write
  is queued, preserving the write as a fairness barrier.
- Treat `hooks/list` and `configRequirements/read` as shared config reads.
- Cover concurrent reads, read/write ordering, and config reads completing
  alongside a `skills/list` request.

GitOrigin-RevId: 8194301c2ba60be0fc71b8915923af9accc745dc
2026-08-17 17:28:37 +00:00
felixxia-oai
71e5e1ec50 Add app-server coverage for Guardian V2 approval routing (#39035)
## What changed

- Add end-to-end app-server tests for MCP tool approvals with Guardian V2 and automatic review enabled.
- Verify that sampling receives the thread context, uses a thread-scoped prompt cache key, and persists the resulting action risk score.
- Cover both routing outcomes: low-risk actions skip later Guardian reviews, while high-risk actions continue through full review.

GitOrigin-RevId: 78ba2b0560caf701ad333785c4dda4f7d2be4f2c
2026-08-17 17:24:06 +00:00
Eric Traut
eeb82a156d Dispatch queued messages written by other processes (#39034)
## Why

Durable thread queues can be updated through another SQLite connection, but loaded idle threads need to notice those updates before they can dispatch the new messages.

## What changed

- Track a durable revision for each thread queue, including backfilling existing queues and updating revisions on inserts, updates, and deletes.
- Poll SQLite's data version and query revisions to find changed queues for loaded threads.
- Wake idle threads with pending external messages, discover queued work when threads are loaded or resumed, and retry each thread independently so one blocked queue does not stall others.

## Testing

- Cover cross-runtime queue writes, edits, independent dispatch, wake retries, and resumed threads.
- Cover migration backfills and revision tracking for queue updates and deletes.

GitOrigin-RevId: 906d902bbf6a760be206a1b2c08fd71427b63c46
2026-08-17 17:19:46 +00:00
Charlie Marsh
a8525b139c Bound legacy resume preview scans (#39033)
## Why

Building a resume-picker preview for a legacy session should not require loading its full thread history.

## What changed

- Read up to six preview lines by scanning at most 1 MiB from the end of a local legacy rollout.
- Fall back to the existing history hydration path when the local file is unavailable, the bounded scan is incomplete, or the tail contains a rollback.
- Keep the initial `thread/read` request turn-free while loading the preview.

## Testing

Added coverage for compaction, rollbacks, oversized records, exhausted scan budgets, and app-server request parameters.

GitOrigin-RevId: a8950f03d8b56323f268fd3355c6a38a16cb9833
2026-08-17 17:14:46 +00:00
Charlie Marsh
dc473903ab Encapsulate TUI shimmer under the motion module (#39032)
## Why

Direct access to shimmer primitives can bypass the reduced-motion handling
introduced in https://github.com/openai/codex/pull/20564.

## What changed

- Make `shimmer` a private child of `motion` and restrict `shimmer_spans` to
  its parent module, so Rust visibility enforces the animation boundary.
- Remove the source-scanning regression test that previously checked this
  boundary with regular expressions.

GitOrigin-RevId: 1f4cccacaa907992c636cd1e9cd2829b7653f811
2026-08-17 17:10:16 +00:00
Charlie Marsh
8892aa8fa0 Speed up the in-app resume cwd test (#39030)
## What changed

- Reuse shared directory fixtures and local and remote app-server instances across the resume cwd case matrix.
- Seed the runtime working-directory override directly so each case focuses on resume behavior without starting and replacing an extra thread.
- Run the test on a four-thread Tokio runtime and shut down each shared server after all cases complete.

GitOrigin-RevId: 4bc4978abc546882f26bcb5e3591ff9673758b4a
2026-08-17 17:04:09 +00:00
Charlie Marsh
10fbb61838 Cache the test pet spritesheet encoding (#39028)
## Why

Pet tests reuse the same blank WebP spritesheet fixture, so encoding a new image
for every temporary path does unnecessary repeated work.

## What changed

Encode the test spritesheet once with `LazyLock`, then write the cached WebP bytes
to each requested fixture path.

GitOrigin-RevId: 26d75bb1bac448717ca63aeb82eb4e500c86fad8
2026-08-17 16:58:24 +00:00
Charlie Marsh
171ae66d74 Use simulated time in the long typing test (#39026)
## Why

The 1,000-character human-like typing test waited on the wall clock after
every keypress, making the test unnecessarily slow.

## What changed

Advance an injected timestamp by the recommended paste flush delay and flush
the paste-burst detector explicitly after each character. This preserves the
coverage that slow typing appears directly without creating a paste
placeholder, without sleeping between keypresses.

GitOrigin-RevId: 0c1beb40283f7d73a381cd221725ab4227c8e233
2026-08-17 16:54:49 +00:00
Charlie Marsh
c6ba7b7f8e Speed up the large diff highlighting test (#39025)
## What changed

Construct the oversized unified diff fixture directly instead of generating it
from two large input strings. Keep the fixture just above
`MAX_HIGHLIGHT_LINES` so the test continues to verify that syntax highlighting
is skipped for large updates.

GitOrigin-RevId: 8f8853e03a50ff9f53e77b2ba0956cf85ee17c07
2026-08-17 16:50:47 +00:00
Charlie Marsh
f0904922f6 Reduce retained MCP result data in TUI history (#39023)
## Why

MCP tool results can contain multi-megabyte image, audio, or resource bodies,
even though TUI history renders only summaries for those content types.

## What changed

- Project completed MCP results into width-independent display data, dropping
  media and resource bodies that history does not render.
- Preserve text output, JSON fallbacks, error state, Node REPL rendering, and
  the fully decoded image-output marker.
- Add tests covering width-dependent rendering, image validation, and Node REPL
  text fields on non-text and unknown content blocks.

GitOrigin-RevId: 2cfddf0864093e6837a4431e541f7a9cab544a68
2026-08-17 16:46:26 +00:00
Charlie Marsh
0841d9bba5 Hang soft-break whitespace in the TUI composer (#39022)
## Why

Keeping overflowing separators with the following word can add whitespace-only
rows and make composer wrapping differ from the queued-input preview.

## What changed

- Hang breakable whitespace from the preceding visual row at soft word breaks
  while preserving the underlying editable text.
- Keep indentation, trailing whitespace, mandatory breaks, and nonbreaking spaces
  visible and editable according to their existing semantics.
- Align cursor placement, scrolling, vertical navigation, masked rendering, and
  styled overlays with the visible wrapped content, including after resizes.

## Testing

Add focused wrapping, rendering, cursor, editing, scrolling, navigation, Unicode
separator, long whitespace-run, and resize coverage.

GitOrigin-RevId: 7fbdb0a4bf33cfee20c4c19dca5aee74df4f892c
2026-08-17 16:39:37 +00:00
Eric Traut
09bc28f348 Restrict Windows IDE pipe client impersonation (#39020)
## Why

Windows named pipe servers can impersonate connected clients. IDE context
connections only require the server to identify the client, so they should not
grant broader impersonation rights.

## What changed

Open Windows IDE context pipes with `SECURITY_SQOS_PRESENT` and
`SECURITY_IDENTIFICATION`, limiting the server's impersonation token to the
identification level.

## Testing

Add a Windows regression test that connects to a named pipe, asks the server to
impersonate the client, and verifies that the resulting token has the
`SecurityIdentification` level.

GitOrigin-RevId: 51ef080f3367857987e03b0113a476040ea40e56
2026-08-17 16:34:21 +00:00
Eric Traut
02360b48d1 Isolate MCP resource headers during OAuth requests (#39019)
## Why

Headers configured for an MCP resource can contain credentials and must not be
forwarded to a different origin during OAuth discovery, registration, or token
exchange.

## What changed

- Apply configured resource headers only to OAuth requests on the MCP resource
  origin, while allowing OAuth-generated headers to take precedence.
- Follow credentialed OAuth redirects only when each destination remains on the
  resource origin. Preserve redirect method semantics, the overall timeout, the
  response size limit, and a maximum of 10 redirects.
- Use the Codex MCP user agent for requests to authorization-server origins.

## Testing

Add coverage for cross-origin header isolation, same-origin dynamic client
registration redirects, OAuth header precedence, token refresh, timeout
accounting, and response size limits.

GitOrigin-RevId: 609d06e2b065e4aa9ca5382b4ae60455f9e26db9
2026-08-17 16:29:47 +00:00
sayan-oai
32a383c0ba Move MCP policy types into codex-protocol (#39017)
## What changed

- Define MCP server identities, matchers, requirements, and per-plugin MCP requirements in the new `codex_protocol::mcp_policy` module.
- Keep requirement validation and matching against `McpServerConfig` in `codex-config`.
- Re-export the moved types from `codex-config` to preserve existing consumers.

GitOrigin-RevId: ad8a107e3085191241a5766f061dd004103e21e6
2026-08-17 16:20:52 +00:00
jif
21cfd369ef Add task context to shadow skill selection (#39008)
## Why

Short continuation prompts such as `continue` do not contain enough context for
skill selection on their own.

## What changed

- Add the `task_context_fusion_v1` shadow selector, combining the current request
  with up to two prior substantive requests and recently relevant skills.
- Record explicit skill intent and successful skill invocations for future turns,
  while excluding same-turn observations from predictions.
- Bound retained requests, augmented queries, and skill history, including safe
  truncation at UTF-8 character boundaries.

## Testing

Add unit and extension tests for continuation prompts, explicit intent, turn
isolation, cold thread state, bounded history, and unchanged control selectors.

GitOrigin-RevId: 72eca3f0d64620a0d24e95d5675f126ac982f8c7
2026-08-17 13:29:57 +00:00
jif
def7ed5572 Wait for Guardian score progress in approval tests (#39007)
## Why

Guardian stores a `SecurityRiskScore` before advancing its scored-tool-call
counter. Waiting only for the score can therefore let the test continue while
the asynchronous sampler is still updating its progress state.

## What changed

Wait for `latest_scored_tool_call` to advance before exercising Guardian v2
approval decisions, and reuse the same progress tracker for the subsequent
assertions.

GitOrigin-RevId: 3d92c9a3ccf52f4f43a2454aac60d2479258c1c8
2026-08-17 13:26:19 +00:00
xli-oai
04caa22c82 Emit API-key turn cost telemetry from app-server (#39006)
## What changed

- Track app-server turn lifecycle events for OpenAI API-key sessions when OTLP telemetry export is enabled.
- Query the turn-cost endpoint after completed or aborted turns and emit `codex.turn_cost` with the estimated USD cost, interruption state, model, speed, and reasoning effort.
- Preserve provider organization and project headers, wait for all observed responses to be priced, and retry pending or transiently failed queries with bounded tracking.
- Re-probe availability after authentication changes and shut the worker down with other app-server background tasks.

## Testing

- Cover late API-key login, transient probe failures, telemetry after thread removal, and turns with multiple responses.
- Verify turn-cost requests use API-key authentication and provider scope headers and deserialize priced response data.

GitOrigin-RevId: a303162a54798b554fcb2e9e2b372e1cf9f49f39
2026-08-17 13:20:58 +00:00
felixxia-oai
02e9bfaac7 Disable Guardian V2 for managed automatic reviewers (#39005)
## Why

Guardian V2 should not override a managed approval-reviewer policy that excludes
the user reviewer.

## What changed

- Force `features.guardianv2` off when `allowed_approvals_reviewers` does not
  include `user`, for both local requirements and cloud config bundles.
- Preserve Guardian V2 when the user reviewer remains allowed or when only
  legacy Guardian feature settings are present.
- Return the effective disabled value through `config/read`.

## Testing

Added coverage for cloud requirements and the app-server config RPC.

GitOrigin-RevId: 82b6d0aaf47fbaa58ae349d4e56777cd442f5807
2026-08-17 13:16:05 +00:00
jif
8e89e98cf6 Ignore stale Guardian tool risk scores (#39001)
## What changed

- Track the latest tool call and latest scored tool call for each Guardian v2 thread.
- Skip approval review when the score lags by more than `max_tool_call_lag` tool calls.
- Add `max_tool_call_lag` to the Guardian v2 configuration and schema, with a default of three.

## Testing

- Cover approval review at, above, and after recovering from the configured lag limit.
- Cover deserialization of `max_tool_call_lag`.

GitOrigin-RevId: fd870e143d95ee76491180e2aed742717248ff78
2026-08-17 13:06:15 +00:00
jif
4885eb6c52 Retry transient Guardian sampling failures (#38997)
## Why

Guardian sampling can encounter temporary connection or service failures while
opening a WebSocket, starting a request, or consuming its response stream.

## What changed

- Retry transient transport, streaming, rate-limit, and server failures up to
  two times across the full sampling flow.
- Recover from unauthorized responses through the configured auth manager and
  discard pooled connections that may contain stale credentials.
- Allow sampler initialization to continue when its initial WebSocket prewarm
  fails, so the first sample can establish a fresh connection.

## Testing

Added coverage for recovery after prewarm failures and `503` responses, and for
stopping once the transient retry budget is exhausted.

GitOrigin-RevId: af74c2df95c4241184ca641ef4418db6aa4ab695
2026-08-17 12:45:50 +00:00
Alex Zamoshchin
3666a46ea3 Remove the workspace settings gate for apps and plugins (#38994)
## What changed

- Stop fetching the ChatGPT workspace `enable_plugins` setting.
- Let the effective Codex feature configuration control app and plugin APIs,
  plugin-provided skills and hooks, and experimental feature reporting.

GitOrigin-RevId: 46aebf0f07cd47e093e48663e41207cdf9a38c9f
2026-08-17 12:26:59 +00:00
jif
ea10ae7d0f Evaluate recent and character-routed skill selection (#38993)
## What changed

- Add shadow selectors that fuse recently invoked skills with character routing-card matches using reciprocal rank fusion.
- Add a second variant that also incorporates weighted lexical matches.
- Record both variants in the existing shadow-selection experiment, capped at 50 candidates.

## Testing

- Cover cold starts, duplicate removal, short exact matches, deterministic ranking, result limits, and truncation metadata.
- Extend the skills integration test to verify both selectors recover a skill invoked on an earlier turn.

GitOrigin-RevId: 4ff9e91da8cb49ecbce54ab8e760820616e1a1d3
2026-08-17 12:13:20 +00:00
felixxia-oai
8bf50439f2 Source Guardian v2 defaults from the model catalog (#38990)
## What changed

- Add optional `guardian_v2` model-message defaults for classifier instructions,
  review thresholds, reasoning effort, transcript selection and limits, and
  action and compaction token limits.
- Apply those defaults when Guardian v2 samples a tool call, while preserving
  explicit `[features.guardianv2]` settings over catalog values.
- Preserve the new catalog configuration when applying model overrides.

## Testing

- Cover model-catalog serialization and model override behavior.
- Verify that sampling uses catalog defaults while retaining local overrides.

GitOrigin-RevId: 4ae9ec235c647acbca05a20b7c4b87a4e1331161
2026-08-17 11:44:56 +00:00
jif
37cf6c84c0 Include images in Guardian v2 transcripts (#38987)
## What changed

- Add the `features.guardianv2.transcript.include_images` opt-in setting.
- Include recent images from user and assistant messages and configured tool outputs in Guardian v2 sampling requests.
- Bound image context to the four most recent images and 8 MiB total, and omit image detail hints when constructing the sampling request.

## Testing

- Cover configuration parsing and image forwarding from messages and tool outputs.

GitOrigin-RevId: b0ae6b6182535fd084ea103ed01dc3c803d7d1f7
2026-08-17 10:56:13 +00:00
felixxia-oai
53aa7bb1aa Bound Guardian v2 parent compaction context (#38980)
## What changed

- Add `max_parent_compaction_tokens`, defaulting to 25,000 tokens, to the Guardian v2 feature configuration.
- Reuse the latest encrypted parent compaction only when its complete serialized item fits within the configured limit.
- Fail closed with the maximum action-risk score when the latest encrypted compaction is oversized, instead of sampling with older context.

## Testing

- Cover exact-boundary and oversized compaction items, including oversized passthrough metadata.
- Verify that an oversized latest compaction bypasses sampling and prevents approval.

GitOrigin-RevId: 0b308e7bec0f41d46433dfdf656948cee5cba667
2026-08-17 10:18:24 +00:00
jif
632e35ce8d Add a configurable skill catalog token budget (#38978)
## What changed

- Add `[skills].max_context_tokens` to override the token budget used to render the available-skills catalog.
- Require a positive value and cap configured budgets at 10,000 tokens.
- Preserve the existing default of 2% of the model context window when the option is unset.

## Testing

- Cover configuration parsing, override behavior, the 10,000-token cap, and catalog rendering within the configured budget.

GitOrigin-RevId: f29ddcb57fc2d800c0006d03e1c33cbe3ab6272d
2026-08-17 10:01:59 +00:00
iceweasel-oai
c6058ccaa9 Stop loading legacy managed config on Windows (#38947)
## What changed

- Ignore the default `CODEX_HOME/managed_config.toml` on Windows and exclude it
  from local managed-configuration detection.
- Emit a startup warning when the deprecated file exists, directing users to
  `%ProgramData%\OpenAI\Codex\requirements.toml` for enforced settings or
  `config.toml` for defaults.
- Preserve explicit managed-config path overrides and Unix legacy-file support.

## Testing

- Add Windows tests covering ignored legacy settings, the startup warning, and
  managed-configuration detection through `requirements.toml`.

GitOrigin-RevId: a61d9d9912b13817ba82807a486c9ed92e49c7bc
2026-08-17 05:52:32 +00:00
sayan-oai
e38290846c Enforce environment-specific command policies (#38942)
## What changed

- Add an optional restrictive execution policy to `EnvironmentConfig` and merge it over the active command policy for shell execution and approval decisions.
- Reject environment policies that contain allow rules, so environment configuration can only tighten command access.
- Include the environment policy fingerprint in cached approval keys so policy changes require fresh session approvals.

## Testing

- Cover restrictions overriding saved prefix approvals, policy changes invalidating session approvals, and environment overlays remaining effective when model-specific prefix filtering is active.

GitOrigin-RevId: e94f877549ed5e0f577b8cb52f3c1872c58f029d
2026-08-17 04:37:50 +00:00
Anton Panasenko
89e297729e Prevent Noise auth tokens from reaching child processes (#38941)
## Why

`CODEX_EXEC_SERVER_NOISE_AUTH_TOKEN` is an execution-server credential and
must not be exposed to model-reachable commands or command hooks, including
when shell environment policy explicitly sets a case variant of the name.

## What changed

- Add `CODEX_EXEC_SERVER_NOISE_AUTH_TOKEN` to the shared list of
  non-inheritable environment variables.
- Keep the environment variable constant in `codex-protocol` so the exec
  server and environment scrubber use the same definition.
- Verify case-insensitive removal after policy overrides for shell commands
  and command hooks.

GitOrigin-RevId: 759b224b6a7fb4f56f7b1a6d94ffbb0b188c658f
2026-08-17 04:17:45 +00:00