Commit Graph
13985 Commits
Author SHA1 Message Date
Ned Howley 566020b724 Allow new threads to opt out of Daybreak propagation (#62879)
## Why

App-server clients that prepare threads for later use need to be able
to skip Daybreak propagation for an individual thread when the server
configuration enables it.

## What changed

With `experimentalApi`, pass `daybreakProgramPropagationEnrolled: false`
to `thread/start` to opt a new root thread out. Managed requirements
take precedence. Omitting the field or passing `null` or `true` uses the
configured enrollment rule.

The same field on `Thread` reports actual enrollment for the live
session, including in the start response and `thread/started`
notification. Reusing a live session preserves its enrollment. A thread
returned from stored metadata alone reports `null`, and resuming it
from storage in a new session reports `false`.

## Testing

App-server tests cover enrollment under enabled, required, and disabled
configuration, as well as reporting across live reads and resumes,
unload, and resume from storage. A core test checks that opting out
prevents native helpers from inheriting the root's saved Daybreak choice.

GitOrigin-RevId: f9aae9ff76702b1e5a38d45120cd889a26f8ece5
2026-11-21 01:14:17 +00:00
Jay Chen 66618f0512 Prewarm MCP servers during cloud catalog refresh (#62876)
## Why

A slow cloud skill lookup can delay MCP startup even after the plugin
catalog is ready. If the refresh is canceled while waiting for skills,
it can miss the chance to prewarm those servers before the first turn.

## What changed

Queue MCP prewarm as soon as plugin discovery changes or clears the
catalog. Skill discovery alone leaves the MCP server set unchanged.

At the end of the refresh, queue a retry for eligible MCP startup
failures. If discovery is canceled, check for those failures the next
time the catalog lock is acquired. Reuse pending handshakes and leave
authentication failures and Apps-managed reconnects to their existing
recovery paths.

## Testing

Add regression tests for first-turn tool availability after cancellation,
startup recovery with cloud plugins disabled, and a single retry for a
persistent startup failure.

GitOrigin-RevId: f92162d1629358953d8810d20244e55f07416a01
2026-11-21 00:54:05 +00:00
Sidharth Lakshmanan 0bfb8467da Preserve per-image metadata in app-server image generation items (#62871)
## Why

App-server clients lose metadata supplied by the image backend when
Codex turns the response into a completed image generation item.

## What changed

Expose the backend's `image_metadata` as optional `imageMetadata` in
app-server items and preserve nested values through thread persistence,
resume, and legacy history replay and migration. Keep this metadata out
of model tool output.

Omit empty metadata and discard non-object, oversized, or deeply nested
metadata without dropping the generated image.

## Testing

Extend coverage for per-image parsing, metadata limits, and round trips
through app-server completion, persisted history, and thread resume.

GitOrigin-RevId: 7211a9db1149cb05e6176b08b0462ca173ac72d5
2026-11-21 00:23:59 +00:00
cooper-oai e346540867 Use runtime authentication for TUI WebRTC calls (#62870)
## Why

The TUI creates WebRTC calls locally, and that request path did not use
runtime agent authentication even when runtime agent instances were enabled.

## What changed

- Reuse local credential and runtime managers across calls while the login
  configuration stays the same. Reload first-party credentials before
  creating a call and keep network policy under the primary account owner's
  control.
- Use the shared provider request resolver for call authentication and HTTP
  transport. Apply the WebRTC base URL override before resolving credentials
  so runtime authentication is selected for the actual destination.

## Testing

Add mock-server coverage for concurrent calls sharing a runtime with fresh
assertions, credential changes, and both dual-header and assertion-only
modes. Cover the feature toggle, custom call destinations, network policy
permits, and provider credentials when the local login file is malformed.

GitOrigin-RevId: 6503b3375c79d3126911d1d7c1aea898face37b9
2026-11-21 00:20:14 +00:00
arnavpatidar-OAI cf8992e940 Enable configuration server OAuth during app-server startup (#62867)
## Why

When an organization's configuration server requires a new OAuth grant,
clients need a way to sign in before the app server starts so they can
load and validate the required settings.

## What changed

- Have `--print-startup-config` return the `configServerLogin` action
  when browser sign-in is required, and verify that the required server
  settings were applied before returning startup requirements.
- Add `codex app-server --startup-oauth`, a dedicated stdio mode that
  resolves the configuration server from local managed requirements,
  sends the client a browser authorization URL, and handles the callback,
  token exchange, and credential storage. Clients can cancel a pending
  sign-in or rerun `--print-startup-config` after it succeeds.

## Testing

Add a test that checks the browser handoff URL and verifies that
cancellation completes the pending login request with `LoginFailed`.

GitOrigin-RevId: 00f10d28befe33539882f4f3c0d2baf868ceb4a1
2026-11-21 00:03:42 +00:00
chess f342aa7b92 Defer Windows sandbox owner restoration until sign-in (#62865)
## Why

At boot, the recorded Windows session may no longer exist or may not
have a user token yet. The sandbox service can retry restoration when a
session change signals sign-in.

## What changed

Treat missing sessions, missing tokens, and sessions belonging to
another user as owner unavailability. Search the other sessions for the
recorded owner's SID. If no session restores the owner, report the first
restoration error if one occurred, or let the service retry on a later
session change.

GitOrigin-RevId: c40971e70c6eee46068aafe534c0f0147d16bb77
2026-11-20 23:45:24 +00:00
rhan-oai 663358f98d Keep agent concurrency guidance when native tools are disabled (#62864)
## Why

Disabling native multi-agent tools also dropped the default guidance about
how many agents can be active in a session. That limit still matters for
agents running on a host that handles turn admission.

## What changed

When `multi_agent_v2.disable_native_tools` is set, root agents and
subagents receive only the configured
`multi_agent_v2.max_concurrent_threads_per_session` in their default role
guidance. Explicit role overrides retain precedence, and empty role text
still suppresses the guidance.

## Testing

Cover both roles with bundled and catalog-provided role text. Update the
request snapshots for explicit and proactive delegation to show the
concurrency hint with native tools hidden.

GitOrigin-RevId: e940e7a7886b69888002307c021607b19bb87cd0
2026-11-20 23:44:47 +00:00
Charlie Marsh 8ecb4c9d0f Ask the Responses API to omit the echoed tool catalog (#62863)
Set `x-codex-exclude: tools` in the shared Responses API request headers.

GitOrigin-RevId: 6d46bf95fd1b88a4e01e7d0d3b3d995b4a3f6545
2026-11-20 23:43:31 +00:00
arnavpatidar-OAI b392250f48 Define the startup OAuth protocol for config servers (#62859)
## What changed

Add the optional `target` field to `account/gatewayOAuth/login`.
The startup protocol defines `{"kind":"configServer"}` as a target
for `--startup-oauth`, mutually exclusive with `modelProvider`.
The regular app-server login handler rejects explicit targets.

Define `StartupGatewayOAuthChangedNotification` with the target,
status, and authorization URL for the browser handoff. Export the
new types in the JSON schemas, TypeScript bindings, and Python SDK.

## Testing

Update the TUI device login regression test to expect `target: null`
when signing in to a resumed thread's saved gateway.

GitOrigin-RevId: fb3ce66a143cad9ad56c93f3ac37f8b6f1abdb0e
2026-11-20 23:24:10 +00:00
Benjamin Carlsson beac2ef8fc Keep Cloud threads current in the Agents overview (#62858)
## Why

The Agents overview can go stale when Cloud threads change from another
client, especially when the TUI has no conversation stream attached.

## What changed

- Use Cloud stream notifications to update thread status and refresh the
  thread list. Poll every 10 seconds while the overview is visible and
  no stream is attached.
- Refresh the history already shown while preserving the `Show more`
  cursor. Use fresh list metadata for thread names, recency, and unread
  state, and restore rows when a refresh catches a missed unarchive.

## Testing

Cover Cloud inventory notifications, polling while detached, pagination
across refreshes, and recovery from a missed unarchive.

GitOrigin-RevId: 63c98438b6ddd2e47dd2d1f419c2a676508c6d91
2026-11-20 23:23:32 +00:00
Dylan Hurd 941e1dcade Defer built-in Default mode instructions until after Plan mode (#62857)
## Why

Threads that stay in Default mode carry a collaboration-mode prompt even
though they have no Plan mode instructions to supersede.

## What changed

Omit bundled and model-catalog Default mode instructions until a thread
uses Plan mode. Emit Plan mode instructions on entry and Default mode
instructions when switching back. Preserve eligible caller-provided
instructions and carry the active mode through compaction and resume.

## Testing

Cover prompt contents before, during, and after Plan mode in core and
app-server tests, including compaction and resume in the core tests.

GitOrigin-RevId: b734767da15be53c4eccae71994e46eba63a9ecc
2026-11-20 23:12:16 +00:00
Charlie Marsh 548dd628df Specialize OpenTelemetry providers for HTTP traces and metrics (#62854)
## Why

The code-mode host exports traces over OTLP/HTTP, and the elevated Windows
Filtering Platform setup helper exports Statsig metrics. Both used the
general-purpose provider, which made exporter builders for unused signals
and transports reachable from those binaries.

## What changed

Add `OtelProvider::try_new_http_traces` for the code-mode host and
`OtelProvider::try_new_http_metrics` for the Windows setup helper. Select
exporter builders at compile time so each constructor reaches only the
builders it needs. Both constructors reject unsupported signals and gRPC
configuration. The metrics constructor also accepts Statsig.

## Testing

Add unit tests for unsupported signals and gRPC configuration. Exercise
the specialized constructors in the HTTP loopback tests for trace delivery
on a current-thread Tokio runtime and cumulative metrics export.

GitOrigin-RevId: 875916791f0176839764c51b5ab289d5dc45a4d2
2026-11-20 22:39:52 +00:00
Charlie Marsh 63598243af Limit guardian response resampling to one retry (#62852)
## Why

When the retried response also meets the guardian's resampling criteria,
it can trigger another model request and keep the turn from finishing.

## What changed

Consume the original prompt when scheduling the retry. The second
verdict stays buffered until completion and is replayed after usage
accounting, even if it also meets the resampling criteria. Usage from
the discarded first response still counts toward spending.

GitOrigin-RevId: f8ded8f31bd7d9e440c0c92a92a80480acec61d2
2026-11-20 22:24:30 +00:00
Dmitriy Kovalenko 4c153c26c0 Reduce allocations when preparing tool schemas and catalogs (#62849)
## Why

Tool schema budget checks cloned the schema and allocated a JSON buffer
just to measure its size. Building a Responses Lite catalog also cloned
tool definitions before serializing them.

## What changed

- Deserialize schemas from borrowed JSON during compaction, count
  serialized bytes without allocating a buffer, and reuse the parsed
  schema when it fits the budget.
- Serialize borrowed tool specs and namespace members directly, and pass
  filtered specs as an iterator. Preserve the serialized namespace field
  order because the bytes contribute to the `additional_tools` item ID.

## Testing

- Compare the exact serialized Responses Lite catalog against the
  expected namespace layout.
- Add a `tool_catalog` benchmark for connector schema preparation and
  Responses Lite catalog encoding with 1 and 64 tool specs.

GitOrigin-RevId: 6bd03a12fcedd4abfa8c3a03f298243483e98c63
2026-11-20 22:10:45 +00:00
swastik-oai 9735367e18 Return an assessment for explicit Guardian reviews (#62846)
## Why

An explicit `thread/guardianReview` request could return a null assessment when live execution would skip approval, leaving callers without a verdict on the recorded action.

## What changed

Require `assessment` on every successful `thread/guardianReview` response. Review eligible recorded calls even when a command is allowlisted, an MCP tool is configured for automatic approval or has a remembered approval, or the policy disables permission requests. The review runs without executing the call or granting permissions.

Include the MCP server's owning environment permissions in the review context, matching live review.

## Testing

Cover allowlisted commands, permission requests with prompting disabled, and automatically approved MCP tools. Compare live and recorded MCP review input for a server whose owning environment has denied paths.

GitOrigin-RevId: 54689dc043d77f940e10d29842308340f6937980
2026-11-20 21:58:11 +00:00
rhan-oai 2b5111917c Tag all multi-agent role instructions consistently (#62842)
## Why

Only catalog role instructions carried the `<multi_agent_role>` tag,
so the same guidance appeared in different formats depending on its source.

## What changed

Render bundled, catalog, and configured root and subagent guidance as
`multi_agent.role_instructions` developer messages. Wrap the guidance in
`<multi_agent_role>` tags and preserve configured text that's already tagged.
Match untagged parent guidance by its body when filtering forked history.

## Testing

Update prompt and session assertions for tagged role instructions, and keep
the cold-resume test exercising a rollout with legacy untagged guidance.

GitOrigin-RevId: 60c55b5d7227811b92bd1bf125f1cd3a965720fd
2026-11-20 21:42:17 +00:00
Charlie Marsh 5bee962f5e Reuse one syntax highlighter when building TUI Markdown styles (#62840)
## Why

Building Markdown styles clones the active syntax theme and constructs a new
highlighter for each foreground lookup.

## What changed

Borrow the active theme and use one highlighter for all foreground lookups
in `MarkdownStyles`. Preserve the readability adjustment for text styles
and the accent-color fallback for inline code.

GitOrigin-RevId: 8ddfad7e61e2dc7968398ff3bdecd3b389c1bb07
2026-11-20 21:29:06 +00:00
mpc-oai df6064096a Load managed cloud config for plugin add and list (#62837)
## Why

`codex plugin add` and `codex plugin list` loaded configuration without
the managed cloud configuration layer, so plugin discovery and
installation could miss settings supplied by that layer.

## What changed

Use the shared cloud-aware configuration builder for add and list,
passing through CLI overrides. Keep `codex plugin remove` on the local
configuration loader and use the loaded configuration's Codex home
for all three commands.

GitOrigin-RevId: 5ebe94de30e553c57ae6296a2ddb91792260a61f
2026-11-20 21:08:57 +00:00
tigrantsat-openai 1c0c806028 Record MCP tool call outcomes in traces (#62833)
## Why

A successful JSON-RPC exchange can still return a failed tool result.
MCP error metrics count that failure, but the trace span can lack an
error status. Dropped calls can also leave spans without an outcome.

## What changed

Record `codex.mcp.call.outcome` on `mcp.tools.call` spans and mark
failures with OpenTelemetry error status using the same classification
as the metrics. Record `interrupted` when the call future is dropped
before completion, including before its first poll.

Capture the numeric JSON-RPC error code in `rpc.jsonrpc.error_code`
when available, leaving server error messages and data out of the span.

## Testing

Extend in-memory telemetry tests to check that spans and metrics agree
on error classification and that span attributes omit sensitive test
values. Cover success and cancellation before the first poll and while
the call is pending.

GitOrigin-RevId: 57fcdc36f19cfc2f227c1ec964a932f3cf7eaa04
2026-11-20 20:38:01 +00:00
Ryan Taylor a1afa12273 Let required hooks block continuation on failure (#62831)
## Why

A required hook check can fail to run or return a usable result. Continuing
after that failure can let an action proceed without a completed check.

## What changed

Add per-handler `onFailure` for command and MCP tool hooks. The default
`continue` preserves existing behavior. On supported synchronous hooks,
`block` applies the event's blocking behavior and reports the reason while
preserving failure diagnostics. For example, a failed `PreToolUse` check
prevents the tool from running, while a failed `PostToolUse` check withholds
the result of a tool that already ran.

Expose the policy in the app-server's `configRequirements/read` response.

## Testing

Add tests for command and MCP failures under both policies, and scenario
coverage for blocked tool execution, withheld results, and completion after
a `Stop` hook recovers.

GitOrigin-RevId: 20d6ebda0094382fe052bbf34338edb994cc7bd3
2026-11-20 20:24:34 +00:00
ioanbudea-OAI 0a0b1021f0 Apply elastic Guardian budgets to retained user and sender evidence (#62829)
## Why

Fixed retention limits could discard long user instructions or leave
older sender messages out of Guardian review even when the configured
elastic budget had room for them.

## What changed

- Apply the configured retained-instruction entry limit when capturing
  and restoring user messages. Fixed-budget reviewers use the fixed
  retention window for both user and assistant messages.
- Build elastic sender snapshots at delivery using the receiver's sender
  evidence budget. Give recent user messages first claim on space, then
  include preceding assistant context where it fits. Mark omitted
  evidence and save the snapshot for review and rollback.

## Testing

Add coverage for cross-host delivery after compaction, large sender
snapshots through checkpoint restore and rollback, and how synchronous
and asynchronous reviewers read saved or empty sender snapshots.

GitOrigin-RevId: f0b01a2d558e3286335efac85a4f8645dd9b954b
2026-11-20 20:11:57 +00:00
ioanbudea-OAI ab7a93771e Honor Guardian retention settings for assistant messages (#62828)
## Why

The fixed retention window can discard assistant messages before elastic
Guardian reviews can use them as context for a user's reply.

## What changed

Apply the thread's Guardian retention policy when recording assistant messages,
including confirmed messages sent through the user messaging tool. Keep full
text within the configured record limit and the overall assistant history byte
budget. Preserve an incomplete marker when a confirmed delivery exceeds the
record limit.

Recover the thread's retention settings from saved history and compaction
checkpoints. Fixed-budget reviews continue to use the fixed retention window.

## Testing

Add coverage for record limits during capture and restore, thread-owned
settings recovery, and replay of oversized confirmed deliveries.

GitOrigin-RevId: e828f06824ce6712910a9cc5ef42a438d1ddf27e
2026-11-20 20:10:51 +00:00
ioanbudea-OAI 7fcb825b46 Persist Guardian retention limits in thread settings (#62827)
## What changed

At session startup, derive `assistant_record_bytes` from the Sync Elastic
per-entry token limit for retained user instructions. Use the default
section limit when the configuration omits that section.

Store the resolved byte limit in the optional `guardian_retention` field
of `ThreadSettingsSnapshot` and update the app-server schema. Fixed-mode
snapshots omit the field, and older snapshots can still be read.

GitOrigin-RevId: a8de88c5bd0e35c4a114577e70fb0c858acb13c9
2026-11-20 20:08:33 +00:00
vishnu-oai 60fc55bb69 Enable OAuth discovery by default for config servers (#62824)
## Why

Config servers that publish OAuth metadata still required administrators
to configure OAuth endpoints explicitly for Codex to use them.

## What changed

- Discover OAuth metadata when `config_server.oauth` is omitted. Use
  explicit settings when provided, and fetch managed configuration
  anonymously when discovery finds no metadata.
- Have the Git credential helper resolve the config server before
  fetching managed configuration. It refuses explicit or discovered
  OAuth so it can apply workspace policy without opening the OS keyring.
- Apply local network policy to discovery during `codex logout`.

## Testing

Cover app-server recovery after a discovery failure, Git credential
helper rejection of explicit OAuth without a network request, and
logout discovery blocked by local network policy.

GitOrigin-RevId: 1ad84effef48fd9b56371ee177bd53c54f3e87b8
2026-11-20 19:16:07 +00:00
ioanbudea-OAI 4e9ce8fa9e Upgrade Bazel to 9.3.3 (#62820)
Refresh `MODULE.bazel.lock` with the registry hashes and module extension
digests recorded for Bazel 9.3.3.

GitOrigin-RevId: c7f50510531b456c0e547e8b7cb15d4bdbcca0bb
2026-11-20 18:46:14 +00:00
jfoo-oai 51f4b8af01 Include native USD in ChatGPT turn cost telemetry (#62810)
## Why

When a turn incurs usage priced directly in USD, reporting only the
credit-converted estimate understates its cost.

## What changed

Sum `estimated_usage_usd_micros` and `native_usage_usd_micros` for
settled turns. Default an omitted native USD field to zero for legacy
responses. Suppress the total when either component is unavailable
(including explicit null), either is negative, or their sum overflows.

## Testing

Cover omitted and null native USD values, zero costs, negative amounts,
and overflow in backend client tests. Verify that the combined amount
reaches the OTLP exporter in the app-server integration test.

GitOrigin-RevId: 8709e48329db813cd66baf270ee3f1bcfd87cb03
2026-11-20 17:59:03 +00:00
yitaoh-oai 4360c5f813 Remove model-selected Search MCP routing (#62808)
## What changed

Use the turn's effective `web_search` mode for standalone and hosted
web search. Remove model-selected Search MCP discovery, fallback, and
provider tracking across thread resumes.

Remove `web_search_provider` from model metadata, the
`tools.client_search_provider` hint from configuration, and the
`hosted_search_policy` feature flag. Update the app-server schemas and
generated SDK types to match.

GitOrigin-RevId: 59e3371f4a43d532a484db52d5998f6770292028
2026-11-20 17:46:32 +00:00
Felipe Coury d402acbeba Reset TUI thread-switch state on reconnect (#62807)
## Why

Reconnect replaces the app event queue, so queued thread-switch events can be
discarded while their resets are still counted as pending.

## What changed

- Clear the pending thread-switch reset count when replacing the event queue
  and use a shared accessor for the displayed thread during reconnect.
- Box the app event dispatch future and extract helpers for choosing the side
  conversation target and rendering the composer pane.

GitOrigin-RevId: 6bb14443952262b6a0df7fdf05db053038c7ce2d
2026-11-20 17:45:15 +00:00
Charlie Marsh bb5b9c6240 Read Responses WebSocket messages during blocked uploads (#62771)
## Why

When a server stops reading a request, the client's WebSocket write can
stall. If the server sends a Ping or rejects the request while the write
is blocked, the client can leave that message unread until the write
fails or times out.

## What changed

Poll for incoming messages before each outgoing frame and while a write
is pending. On subsequent polls, give the pending write first use of
Tokio's cooperative budget and cap read-ahead across the entire upload.

## Testing

Add regression tests for Pong delivery before upload completion, early
size-limit closes, and bounded read-ahead without write starvation.
Cover error precedence for buffered peer replies, local send failures,
and network policy revocation, plus token usage when a close arrives
before an interrupt can be sent.

GitOrigin-RevId: c018c25dcdc70b64835b07935caede5e34dfa8f2
2026-11-20 14:26:42 +00:00
Charlie Marsh 9f2b87495b Recover server replies after Responses WebSocket write failures (#62749)
## Why

A server can reject an oversized request after reading just the first
frame header. If the upload then fails with a broken pipe, the write
error can hide the server's message-too-large close.

## What changed

After a write fails partway through an upload, drain immediately
readable replies within the send deadline and a bounded read budget.
Use those replies to surface server errors, including
`WebsocketMessageTooLarge`. Treat a close seen before the first frame
as belonging to the idle connection, and retire the socket after a
failed send.

## Testing

Add regression tests for size-limit closes on an idle socket, just
before the first frame, and after a partial first-frame write fails
with pings and pongs ahead of the close.

GitOrigin-RevId: 2feeb1961992b425dbec06129015dbe4c44ff3f2
2026-11-20 12:22:56 +00:00
Charlie Marsh 1c297f8997 Flush idle Responses WebSocket pongs under backpressure (#62742)
## Why

An idle Responses WebSocket still needs to answer server pings when the
write buffer is full. The pong must finish flushing once the peer drains
the socket, even if no further messages or requests arrive.

## What changed

Have the WebSocket pump flush automatically queued pongs and retry pending
flushes as the socket becomes writable. Bound incoming polling and the
number of pongs tracked while a flush is pending.

## Testing

Add an in-memory WebSocket test that forces a partial pong write and
checks that the peer receives the full heartbeat reply without further
traffic.

GitOrigin-RevId: 12865842c80a8a25a5e107be690f9c3962ce9775
2026-11-20 12:06:32 +00:00
cassirer-openai 076ac7856b Link agent tool calls to delivered messages in rollout traces (#62709)
## Why

Matching messages by text can link a tool call to an earlier message
with the same content. A recipient can also accept a message without
ever including it in a model request.

## What changed

Record the originating tool call ID when the recipient adds a spawn,
task assignment, or message to its history. On replay, use that ID to
link the accepted message to its sender even if the recipient records
it before the sender tool finishes.

Keep the interaction edge pointed at the recipient thread until the
message appears in a model request. Track distinct conversation items
across history resets and count repeated prompt prefixes only once.

## Testing

Replay tests cover identical message text, receipt before tool
completion, and messages observed again after compaction.

GitOrigin-RevId: ccab7c33993ba5fce7fceb733dc90c9d428ec78f
2026-11-20 08:49:07 +00:00
Eric Traut 0e8c7683c4 Match TUI task mentions by displayed title (#62691)
## What changed

Use state database-backed `thread/list` requests for task mentions without
searching conversation contents. Merge title-filtered results with recent
threads by thread ID so a full filtered page cannot crowd out recent
candidates. Native Cloud uses the recent list because it lacks a title filter.

Fuzzy-match the displayed title in the picker. Keep the working directory
visible as a description and exclude it from matching.

## Testing

Cover remote listing, retention of recent candidates when the filtered page
is full, and fallback when the filtered request times out. Check that a
directory-only match stays out of the picker.

GitOrigin-RevId: ec2a5ae9f046e533104251fd82f6683343854ee0
2026-11-20 07:15:35 +00:00
Eric Traut 0f3a4756f9 Let administrators disable Codex daemon updates (#62690)
## Why

The daemon's automatic update preference still permits manual updates.
Administrators need a policy that covers both paths.

## What changed

Set `features.daemon_updates = false` in managed `requirements.toml` or
local MDM policy to block scheduled updates and manual daemon package
replacements. Updates are allowed by default. User configuration cannot
override the policy, and cloud-delivered requirements reject the setting.

When policy blocks updates, the TUI hides update actions in `/daemon`,
suppresses update offers in version notices, and directs users to their
administrator where a newer daemon is required.

## Testing

Add coverage for the default, disabled, and invalid policy cases,
rejection of the setting in cloud requirements, and the TUI with daemon
updates disabled.

GitOrigin-RevId: de9e50c4acc4dc8e83bbd2b9a5e902deb8c6f477
2026-11-20 07:14:27 +00:00
Eric Traut 45ace810b3 Copy pasted image files into temporary TUI attachments (#62687)
## Why

A pasted image path could become unreadable before submission if the
original file was moved or deleted.

## What changed

Copy the image into a private temporary file at paste time and use that
copy as the attachment. Apply a 1 GiB limit when saving image files and
clipboard PNGs. If copying a pasted image path fails, show an error and
preserve the draft.

## Testing

Cover attachment readability after deleting the original file and verify
that an oversized image paste reports an error and preserves the draft.

GitOrigin-RevId: 5f797979f36173fb3355345e0f124b81fcf86d01
2026-11-20 07:03:05 +00:00
ding-oai b059ce11f9 Allow hosts to route selected analytics events (#62684)
## Why

The analytics client sends eligible events through HTTP. Hosts that
embed Codex need a way to deliver specific event types themselves while
keeping HTTP delivery for the rest of the batch.

## What changed

Add `AnalyticsEventsClient::new_with_event_transport` so hosts can opt
in and select eligible events by wire type. The transport receives the
complete wire payload and the event's product SKU, when available.
Events stay on the HTTP path unless the transport returns `Handled`,
which suppresses a duplicate HTTP send.

Disabled analytics and local file capture bypass the transport.
Rebinding the client to a new auth context restores HTTP delivery.

## Testing

Add tests for mixed batches that verify HTTP payloads and product
attribution, plus coverage for auth eligibility, local capture,
analytics opt-out, and auth rebinding.

GitOrigin-RevId: 27ba3fe54050754b5f844f00e7e761a4d7bcb8c0
2026-11-20 06:37:15 +00:00
Anthony Tafoya 2fb728da7d Retry executor discovery V2 failures with backoff (#62679)
## Why

Discovery could retry transport failures on successive lookups while
caching server errors until invalidation. That could repeat requests
against an unhealthy executor or leave a session without an inventory
after the server recovered.

## What changed

Cache failed discovery loads per context and return the cached error
during cooldown. The first lookup after cooldown retries, with delays
doubling from 1 second up to 30 seconds on consecutive failures.
Successful inventories are reused, canceled loads add no cooldown, and
explicit refresh clears the cooldown for the next lookup without
interrupting in-flight readers.

Compare discovery snapshots to detect inventory changes so recovered
plugins and MCP capabilities can become available without an explicit
refresh.

## Testing

Cover backoff timing, shared results for concurrent callers,
cancellation, and refresh bypassing cooldown. Exercise recovery after
failed prewarming and verify that MCP inventory updates after recovery.

GitOrigin-RevId: 6de34bb8957a0b24ee874e2447157bd3af562430
2026-11-20 06:05:04 +00:00
Vivian Fang ea8ccc1d20 Keep explicitly pinned history outside the carryover token budget (#62677)
## Why

An exhausted carryover budget could drop explicitly pinned items, and an
oversized pin could crowd out ordinary user messages during local compaction.

## What changed

Preserve eligible pins in full and in their original order for the current
thread, child threads, or both, according to their retention policy. Apply
the carryover budget to the remaining history, including items retained by
features without an explicit pin.

## Testing

Add regression tests for destination-specific pins at zero budget and for
keeping an ordinary user message alongside an oversized pin during local
compaction.

GitOrigin-RevId: fc8529bcc254d8e7a4a010337ce760e94daa4bef
2026-11-20 05:28:11 +00:00
Anthony Tafoya 15c5444e87 Force executor capability rescans after V2 cache invalidation (#62675)
## Why

Invalidating Codex's discovery cache could still return stale inventory
if the executor reused its cached snapshot before its file watcher
reported a change.

## What changed

Add an optional `forceReload` flag to `capabilities/discoverV2` that
makes the executor rescan its files. Codex sends it on the next lookup
of each invalidated context. Explicit reloads also replace the matching
cache entry so subsequent ordinary requests can reuse the fresh result.

## Testing

Add coverage for discovering a newly added skill before the watcher
runs, forwarding the reload flag after invalidation, and reusing
refreshed results.

GitOrigin-RevId: c98f2b8d4772e10b74ff09dd382ad8386857158f
2026-11-20 05:18:42 +00:00
Anthony Tafoya ffa05c8bfb Prewarm executor capability discovery during remote startup (#62674)
## Why

Step-time discovery can make the first step that needs a remote executor
inventory wait for a discovery round trip. Starting discovery during
environment setup lets deferred turns begin sampling while the inventory
is being fetched.

## What changed

When executor capability discovery V2 is enabled, prewarm the thread's
discovery cache for supported remote executors before marking their
environments ready. Reserve cache capacity for all selected environments
so the first step can reuse their inventories.

Give each prewarm up to five seconds and let environment startup proceed
after discovery errors or a timeout. Step-time discovery reuses cached
successes and permanent errors and can retry transient failures and
timed-out loads.

## Testing

Add integration coverage for deferred readiness and cache reuse after
success, permanent errors, transient failures, and timeouts. Also cover
cache retention across multiple environments and session startup when
discovery receives no reply.

GitOrigin-RevId: d07fc78bd42953a4caf9e4b39528db8a254eb2b8
2026-11-20 05:17:34 +00:00
Vivian Fang a0a30c40e8 Add thread and child retention policies for injected items (#62654)
## Why

The `always` policy ties retention across context windows to inheritance by
spawned agents. Callers need to control those behaviors independently.

## What changed

- `alwaysInThread` carries items across context windows in the current thread
  and excludes them from spawned agents, including full-history forks.
- `alwaysInChildren` passes items still in the parent's context to spawned
  agents and leaves each thread's context-window retention to the usual rules.
- `always` continues to apply in both scopes, including for items saved by
  older versions. Retained tool calls and outputs must be adjacent, with the
  call first and the same retention policy on both items.

## Testing

Extend integration coverage for retention across remote compaction, inheritance
by spawned agents, and injection through the app server.

GitOrigin-RevId: aafede69cfbe149aa52292e6029d248d4bdf6401
2026-11-20 02:59:58 +00:00
Felipe Coury e787cf7024 Return file sizes from fs/getMetadata (#62653)
## What changed

Add `sizeBytes` to the app server's metadata response so clients can
read a file's size in bytes from its metadata. The field reports the
target file's size for symlinks to regular files and is `null` for
paths that resolve to directories or other non-regular files. The
protocol schemas and generated Python SDK model accept responses from
older servers that omit the field.

## Testing

Cover byte counts for regular files and symlinks to files, explicit
`null` for directories, and decoding responses that omit `sizeBytes`.

GitOrigin-RevId: fcc7bda9e55bd0584c1eff4af059422af282da9f
2026-11-20 02:42:43 +00:00
Felipe Coury 2c1b4c7c35 Fix standalone release pruning on macOS with GNU coreutils (#62648)
GNU `stat` can take precedence on `PATH` and interprets `-f` differently
from macOS `stat`, causing the installer's device checks to fail.

Use the system `stat` for both device checks before pruning old releases.

GitOrigin-RevId: 180b62ba6e2ea4ec4419c2d6e51ba4d6ce819a2d
2026-11-20 02:20:47 +00:00
Owen Lin 10ca17496f Pass inherited history visibility to the thread store (#62644)
## What changed

Add `InheritedHistoryVisibility` to `CreateThreadParams` and pass it through
prepared forks. `Full` is the default and remains the mode used by app-server
forks. `ModelContextOnly` requests that `list_turns` and `list_items` omit
inherited history. The local thread store rejects that mode as unsupported.

## Testing

Add a regression test that requests `ModelContextOnly` through a prepared fork
and checks that the local store's unsupported-operation error reaches the caller.

GitOrigin-RevId: de675d6b83ca610eca5a304b9622b312d64828f6
2026-11-20 02:02:55 +00:00
Ian MacLeod 983feef7a1 Shrink npm release tarballs with libdeflate (#62643)
## Why

Smaller npm tarballs reduce the size of the release packages. The
tarballs are already gzip-compressed, so the artifact upload can skip
its own compression pass.

## What changed

Recompress staged npm tarballs in parallel with `libdeflate-gzip` before
upload. Verify that each candidate decompresses to the exact original
tar stream and replace the original only when the candidate is smaller.
Set the upload's `compression-level` to `0`.

GitOrigin-RevId: 77bc61cdcd4d605e352dcc1380beb1654815f424
2026-11-20 02:02:19 +00:00
Ian MacLeod 64026788f3 Hide the warning navigation hint for a single warning (#62642)
Show the TUI warning navigation hint only when there are multiple
warnings to browse. Update the single-warning snapshots to reflect the
shorter footer.

GitOrigin-RevId: 8bcea7841d9fd84e037f59a6afa3e4ef2de6f01e
2026-11-20 02:01:03 +00:00
Brent Traut 7642e80723 Release persisted MCP tool results from active-turn memory (#62641)
## Why

Active turns in paginated threads retain completed MCP tool results in
memory even when history can supply the same payloads. History can also
store a truncated preview, so dropping a result requires checking that
the full payload is recoverable.

## What changed

For persisted paginated threads, check successful MCP calls in batches
and release an active-turn result only when the stored result matches
it exactly. When resuming with full history, fetch released results by
item ID so a stale history page cannot supply an older result.

## Testing

Add a regression test that restores the latest result despite a stale
page and checks that truncated, metadata-mismatched, missing, and failed
results remain in memory.

GitOrigin-RevId: 49f6f1414201e4327433043050d65a1f4adc9720
2026-11-20 01:49:15 +00:00
Anthony Tafoya e720e6c80b Reuse executor Discovery V2 inventories across turns (#62640)
## Why

Starting a turn discarded the discovery cache and forced MCP to rebuild
from a fresh inventory even when the executor context was unchanged.
An MCP refresh could also discover a different inventory from the one
the step had already captured.

## What changed

Keep a per-thread cache keyed by environment, executor session, working
directory, and sandbox. Explicit invalidation reloads discovery on the
next lookup and lets in-flight readers finish with their captured results.

Use the step's captured inventory for MCP reconciliation and bind it
with the current MCP policy. Apply the binding's plugin policy when
selecting skills and hooks.

## Testing

Cover cache reuse across turns, lazy invalidation during in-flight
discovery, and MCP refresh with a captured inventory after a server
has been revoked.

GitOrigin-RevId: 8d4087dffdb3d6feef2456918a08ae7724cf18e4
2026-11-20 01:48:00 +00:00
pash-openai 9224da4ce1 Defer queue-only mail after a retained final answer (#62639)
## Why

A WebSocket response can still complete with a final answer while Codex drains it after a mailbox interrupt. Treating the interrupt alone as a reason to resample reopens the turn even when the pending mail can wait.

## What changed

Recheck whether pending mail requires preemption after the drain. When the drain retains a final answer, queue-only mail waits for the next turn's sampling boundary. User steering can still reopen the current turn.

## Testing

Add WebSocket regression cases for queue-only mail after both empty and nonempty final answers, and for user steering received during the drain.

GitOrigin-RevId: 914b51f2de1afc91311667cc05718507717aaaa0
2026-11-20 01:35:36 +00:00
Joe Savona 78f6b11303 Add center and end alignment to status line rows (#62637)
## Why

Status line authors can start rows at the leading edge or distribute
extra space between items. They also need to center or right-align a
group while keeping its configured gaps.

## What changed

Add `justify: "center"` and `justify: "end"` to the row renderer and
TypeScript contract. Align each wrapped line independently within its
available width.

Leading padding uses the row background, stays outside hyperlink
targets, and leaves blank lines unpainted. When the last visible line
fills the width and more lines follow, the renderer can reclaim a
padding cell for the overflow ellipsis.

## Testing

Add rendering coverage for wrapped and nested rows, wide characters,
blank lines, hyperlink boundaries, and overflow. Extend the TypeScript
contract check to cover both new values.

GitOrigin-RevId: 85dd907fe60b5d2cfb759b32058d0876430dd9e6
2026-11-20 01:34:16 +00:00