Commit Graph
12759 Commits
Author SHA1 Message Date
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
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 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
Dmitriy Kovalenko f16c998db5 Reduce rollout scanning overhead when listing threads (#62636)
## Why

Thread summaries need the first session metadata and preview events. Reading
each line asynchronously and parsing unrelated records adds work to every
rollout scanned.

## What changed

Use the buffered rollout reader to scan each plain or compressed rollout in
one blocking task. After reading the first session metadata, skip JSON
parsing for lines without an `event_msg` marker or a Unicode escape that
could encode the event tag.

## Testing

Extend coverage for delayed user messages with escaped or numeric event
tags, preview reads that stop before invalid UTF-8 in plain and compressed
rollouts, and provider filtering for archived threads sorted by update time.

GitOrigin-RevId: 06c996ad3bcc290102f3ecab992e40364cb4dee9
2026-11-20 01:21:48 +00:00
Ruslan Nigmatullin 30607648d9 Centralize request and prefix ID handling in ThreadContextIds (#62635)
## What changed

Move ID derivation for base instructions and Responses Lite tool definitions
into `ThreadContextIds`. These items keep the same thread-scoped,
content-derived UUIDs when rebuilt for a request.

Invoke prefix ID assignment for newly rendered items during history
replacement and when publishing initial context into empty history.
The UUID allocator leaves these items to ordinary response item ID
allocation.

GitOrigin-RevId: f230a58e3264894bddfd5a250a4b6d1baeabecf0
2026-11-20 01:20:38 +00:00
Ruslan Nigmatullin 583ec348cf Centralize thread context ID allocation (#62633)
## Why

Response item IDs and context window IDs use separate generator callbacks.
A shared allocator gives history and inference a single API for both.

## What changed

Use `ThreadContextIds` to allocate response item IDs, retained-context
revisions, and compaction window IDs. Move initial window selection into
`InitialHistory` so resumed threads reuse a valid window ID from their
rollout. Give rollout reconstruction its own allocator.

Assign hook prompt IDs through the session's normal response item
recording path.

## Testing

Move the prefixed UUIDv7 item ID test to the allocator crate and add
coverage for JSON escaping in Guardian's item ID token budget.

GitOrigin-RevId: 31232f50648382033506d1f86815ce7c1de78378
2026-11-20 00:44:31 +00:00
XMLIU-oai ead489ac4d Retry Guardian model discovery in the background (#62627)
## Why

A failed catalog fetch can leave an explicitly configured Guardian provider
without a classifier. Waiting for another fetch during tool dispatch would
delay the tool call.

## What changed

When a tool call is observed and background scoring is allowed, retry
initializing the Guardian catalog without blocking dispatch. Allow only one
background retry at a time. Check catalog readiness against the current
credentials and schedule initialization if auth needs to be resolved first.

## Testing

Add a regression test that holds the catalog retry open while the first tool
call completes, then verifies that a later call is scored once discovery
succeeds. Cover full-access sessions and mandatory review requirements, where
background recovery is skipped.

GitOrigin-RevId: 2f07bb6bdcfbf22e512f0bd223845f149fa186b5
2026-11-20 00:15:13 +00:00
Ian MacLeod d0264b756e Share slash command argument range mapping in the TUI (#62624)
## What changed

Use `slash_args_elements` in both the chat composer and slash command
dispatch. The shared helper converts text element byte ranges to offsets
relative to the command arguments and clips them to the argument bounds.

GitOrigin-RevId: 72e2fa42bf0d3fc385a58cc13fb6741c896db900
2026-11-19 23:55:41 +00:00
tongzhou wang 26f70f9460 Handle rollout budget decisions in each accounting path (#62621)
Pass `SamplingUsage` into numeric usage accounting and let the host and
controller paths apply their budget decisions directly. Host-wide
exhaustion stops new work, while turn-only exhaustion returns
`SessionBudgetExceeded`. The controller still stops new work on budget
exhaustion when there is no native rollout budget.

GitOrigin-RevId: 544b9a49a23e2becc68d9cecae347e4d00bbdea0
2026-11-19 23:24:47 +00:00
Charlie Marsh 5bdb5e8b3c Split in-memory execution policy rules into a separate crate (#62615)
## Why

Configuration, protocol, and prompt code use in-memory policies and
previously pulled in the Starlark parser through `codex-execpolicy`.

## What changed

Move policy construction, rule validation, and evaluation into
`codex-execpolicy-rules` and use it directly from those crates. Keep
Starlark policy loading and file updates in `codex-execpolicy`, which
re-exports the shared rule types and wraps rule validation errors while
preserving their source locations.

GitOrigin-RevId: 5bc70d3cd387b43a3ad1fcc56af96ad169ac8b13
2026-11-19 22:32:56 +00:00
rreichel3-oai db263d4f54 Refresh Guardian policy on config reload and account changes (#62614)
## Why

Running threads need to pick up changes to approval requirements and
Guardian policy when users reload configuration, sign in, or sign out.

## What changed

Refresh Guardian policy after publishing local config layers so the first
reload uses updated policy fallbacks. Attempt the refresh even if unrelated
user configuration fails to load.

Refresh policy after login while the account owner is still current, and
after logout. If reading account details fails after login, report the
error in the login completion notification and still send the account
update.

## Testing

Extend coverage for changing and removing Guardian policy requirements,
applying requirements despite a config load error, and picking up local
fallbacks on the first reload. Verify that a late low-risk score cannot
release a pending adaptive approval while stricter requirements apply.

GitOrigin-RevId: 95453807a06a0d3c39dcfd9a0f66fd63f41294b9
2026-11-19 22:31:45 +00:00
Alex Zamoshchin 6a8a81166a Refresh plugin recommendations after installed state changes (#62610)
## Why

Recommendation lookups poll the plugin service for a tooling-state marker even when the cached catalog can still be reused. Install flows and installed-plugin snapshots already give Codex signals to refresh recommendations.

## What changed

Remove tooling-state polling and refresh recommendations on the next lookup after a known install event or a change to the installed plugin inventory or enabled state. Invalidate all product SKUs for the affected plugin service and account scope. If the account changes while a remote install prompt is open, invalidate both account scopes when the user accepts.

Concurrent lookups share a catalog fetch. If a refresh fails, keep serving the last successful result when available and retry on the next lookup.

## Testing

Cover invalidation across accounts, backends, and product SKUs, retention of the last catalog after a failed refresh, and isolation from fetches that complete after invalidation. Update the remote install integration test to exercise the next turn without waiting for the poll interval.

GitOrigin-RevId: 5d2ba84d1118e9346308bf6225543e0e174f8125
2026-11-19 22:16:30 +00:00
ztanner-oai 6633c6e09a Apply backpressure to app-server request replay on thread resume (#62609)
## Why

When a client resumes a thread with many pending server requests, replay
can fill the connection's bounded outbound queue if the client reads
slowly. Replaying inline can also stall the thread listener.

## What changed

Replay pending requests in a background task after sending the
`thread/resume` response. Allow one outstanding replay write per
connection and wait for its write receipt to complete or be dropped
before sending the next request. This extends the write-receipt
backpressure used by `command/exec`.
https://github.com/openai/codex/pull/15547

A new resume replaces the previous replay for the same thread and
connection while honoring any outstanding write receipt. Unsubscribing
or disconnecting stops the replay. Before sending each request, check
that it is still pending and apply the human approval eligibility check
where required.

## Testing

Add a regression test with more pending requests than the outbound queue
can hold. It checks that a second resume succeeds while a replay write is
stalled, dropped write receipts let replay advance, and unsubscribe and
disconnect stop replay.

GitOrigin-RevId: 77fc415be0e7b50744f5ccfcaa09857359dd5c55
2026-11-19 22:15:23 +00:00
XMLIU-oai efcc0cf917 Enable Guardian V2 scoring with an explicit Guardian provider (#62607)
## Why

An explicit Guardian provider could handle approval reviews, but configuring it
disabled Guardian V2 scoring. This prevented automatic reviews from using
background scores from that provider.

## What changed

Route classification through the configured Guardian provider and use its
classifier catalog for instructions, reasoning effort, review thresholds, and
input limits. Apply the Guardian provider's API-key access policy to classifier
requests and ignore assessments from the actor's response stream when a
Guardian provider is configured.

Keep mandatory review requirements in force and skip background scoring in
User approval mode and Full Access.

## Testing

Extend coverage for separate actor and Guardian providers at startup and after
cold resume, including when both use the same model name. Cover catalog
settings, scoring restrictions, and provider-specific API-key policy.

GitOrigin-RevId: 5f83d1704bacc63033e144bba0d78752283cb590
2026-11-19 22:00:52 +00:00
keith thornhill 75f2d93e7c Expose current turn admission state on CodexThread (#62604)
## Why

A thread can reserve a turn slot and assign a turn ID while it still
waits for host admission. Callers need to distinguish a pending turn
from one cleared to execute.

## What changed

Add `turn_admission_state()` to report `Idle`, `Pending` with an optional
turn ID, or `Admitted` with a turn ID in a single snapshot. Host-managed
turns become admitted after a grant is installed. Native turns are
admitted synchronously, including when no execution guard is needed.
The current slot retains its admitted state through finishing.

Reject superseded submissions before they can overwrite an owned slot,
and verify that a host grant still belongs to the current turn and task
before recording admission.

## Testing

Cover the admission state while a host decision is pending, after an
interrupt, during execution after a grant, and after the slot returns
to idle. Cover native admission without a host guard.

GitOrigin-RevId: 0633dc036aef99433505559c92b0b1b26a023352
2026-11-19 21:45:13 +00:00
Dylan Hurd b16fddf9d0 Apply additional context when turn input is delivered (#62602)
## Why

Applying client context at submission time lets input stopped by a hook
affect the conversation. A queued prompt that is later blocked can also
supersede the context attached to an earlier accepted prompt.

## What changed

Keep each context update with its submitted input and apply updates in
delivery order after the input passes its hooks. Preserve context-only
submissions when a turn is suspended for host handoff before inference.

For experimental `additionalContext` on `turn/start` and `turn/steer`,
omission or `null` keeps the current set. A supplied map replaces it on
delivery, and `{}` clears it while preserving conversation history.

## Testing

Add regression coverage for context on prompts stopped by hooks, context
on accepted queued prompts, context-only host handoff, and context
delivery when continuing an idle thread.

GitOrigin-RevId: 160f4f90d9aebf5eb3ea4a939c67265a1c6422da
2026-11-19 21:44:38 +00:00
richardopenai 93000976e8 Retry transient exec-server connection failures (#62601)
## Why

A remote exec-server connection could fail during setup if the transport
closed before the client received the initialization response. Callers
waiting for readiness received the failure even if a new connection
could succeed moments later.

## What changed

Share retries among callers during startup, reconnect, and connection
refresh. After a retryable transport or initialization failure, use
backoff and allow new attempts for up to five seconds. Attempts already
underway can finish after that window.

Keep the registry's existing retry policy and reuse the provisioning
deadline across transport retries.

## Testing

Add regression coverage for shared startup recovery after a WebSocket
closes during initialization, registry retry limits and authentication
failures, and child-process cleanup when stdio initialization is
cancelled.

GitOrigin-RevId: 56004badb67f4e5df8d939f2bc6cdfa46246fdb0
2026-11-19 21:44:07 +00:00
Charlie Marsh 665e0a9a65 Stream app-server fs/readFile responses over stdio (#62599)
## Why

Large file reads over stdio previously allocated both a base64 string
and a complete JSON response before writing to stdout.

## What changed

Keep file contents as bytes until the stdio writer encodes them
directly into the newline-delimited JSON response through a bounded
buffer. Clients still receive the same `dataBase64` field.

## Testing

Compare streamed output byte for byte with the eagerly encoded
response for empty files, inputs that require base64 padding, and
files larger than the write buffer. Check that JSON-RPC conversion
preserves the request ID and base64 payload.

GitOrigin-RevId: 730f201f0905fd15e32b6e9c5b2ef02ca21c7532
2026-11-19 21:41:45 +00:00
zm-oai bc75380d6a Explain Windows sandbox logon policy failures (#62593)
## Why

When Windows security policy blocks the sandbox account from signing in,
commands cannot start. The runner error previously gave users only the
failing API call and the numeric error code.

## What changed

For `ERROR_LOGON_TYPE_NOT_GRANTED` (1385), explain the policy denial and
point users to the “Allow log on locally” and “Deny log on locally” settings.
Advise users on managed PCs to contact their administrator.

## Testing

Add a regression test that checks the error explanation and verifies that
the denial does not trigger a sandbox credential refresh.

GitOrigin-RevId: b638bf3d103dc4aec72f2f9c13cb2c8825594e96
2026-11-19 21:22:42 +00:00
Owen Lin 30c69e60a3 Remove cumulative MCP attribution from requests and rollouts (#62589)
## What changed

Stop collecting cumulative MCP tool attribution, sending it in Responses
API request metadata, and writing it to rollout checkpoints.

Use `model_search_state` for search provider history in new rollouts. When
reading older rollouts, decode `mcp_attribution` only to determine whether
Search MCP may have been used. Treat malformed or error attribution as
possible Search MCP use so native search fallback stays disabled.

## Testing

Add a history test that distinguishes legacy Search MCP use, an explicit
record of no use, and missing attribution.

GitOrigin-RevId: a145b5b6b7d2f423d989af10623ef21120f49d4d
2026-11-19 21:06:08 +00:00
XMLIU-oai 5f8c36e836 Support a host-selected inference provider for Guardian (#62588)
## Why

Guardian inherits the actor's inference provider by default. Hosts that run
actors on a different provider need to route Guardian reviews independently
and resolve reviewer policy and model capabilities from the Guardian provider.

## What changed

- Share the selected provider and its model catalog between asynchronous
  scoring and blocking approval reviews. Use the provider's preferred
  reviewer and resolve policy from managed requirements or reviewer model
  metadata.
- Keep Guardian review history independent of actor compaction when the
  host selects a provider. Preserve inherited routing when no provider is
  selected.

## Testing

Add integration coverage for separate actor and Guardian endpoints, catalog
isolation when both share an endpoint, and routing after resuming a compacted
thread.

GitOrigin-RevId: 1eb15421f746a58eefe27257e86d948de31bcf86
2026-11-19 20:43:32 +00:00
Charlie Marsh 8b2070d29f Centralize schema selection for config diagnostics (#62587)
## What changed

Choose the full config or shell environment filter schema inside the
diagnostics module. Config loaders call the helper for the validation
that failed without passing a deserialization type or the
`config.toml` filename. Both helpers use the same layer traversal and
source location reporting.

GitOrigin-RevId: 5dcc7984b907e3769904c303cd08577c6faf4769
2026-11-19 20:42:24 +00:00
ioanbudea-OAI 90dd6cf9df Enforce refreshed Guardian policy on running threads (#62585)
## Why

A Guardian policy refresh could leave a thread using its previous restrictions
if the new policy disallowed its current model. A refresh could also report
success after its managed policy source changed before publication.

## What changed

- Use the app server's configuration manager to load Guardian policy from
  current local and managed configuration. Report an error when the policy
  source changes before publication or a live thread rejects the update.
- Apply updated reviewer and model restrictions even when they block the
  current model. Keep automatic work queued while the model is blocked and
  wake it when a later refresh permits it. Allow a new turn to supply a
  compliant replacement model.

## Testing

Regression tests cover policy changes during thread startup and live refresh,
queued work resuming after a blocking policy is lifted, and updated policy
text reaching Guardian reviews without reconnecting MCP.

GitOrigin-RevId: c7d3e119aa409342cc2fa18946ce2b6a4392e0e3
2026-11-19 20:26:00 +00:00
Felipe Coury 81ef12b617 Refresh open sidebar file previews when files change (#62583)
## Why

Sidebar previews load a snapshot of the file when opened, so edits on disk
leave the open tab showing stale content.

## What changed

Watch each previewed file’s parent directory through the app server so the
preview refreshes even when an editor saves by atomically replacing the file.
Poll every three seconds when a watch cannot be registered, and resubscribe
when reconnecting to the same backend.

Preserve the text preview’s reading position across reloads, including when
the file temporarily becomes unreadable and then returns.

## Testing

The sidebar test covers atomic saves and recovery after moving a directory
away and back. It checks that the tab shows updated content at the existing
reading position.

GitOrigin-RevId: d5f7507d1a81a118fb10a0febf5e274c18f19d81
2026-11-19 20:13:14 +00:00
Eric Traut 2f0374456f Render LaTeX underbraces in TUI display math (#62577)
## Why

An unsupported `\underbrace` leaves the display equation as LaTeX source,
so readers have to interpret which terms each label groups.

## What changed

Render `\underbrace{expression}_{label}` with a Unicode brace that spans
the expression's terminal columns and a label centered below it. Keep
surrounding math aligned with the expression. Inline math, unsupported
arguments, and layouts that exceed the available width still use the
existing fallback.

## Testing

Add a snapshot for labeled Boolean clauses, short expressions, and labels
wider than their expressions. Check fallback for inline, malformed,
nested, multiline, and over-width cases.

GitOrigin-RevId: 8fbe92d512d06c73cf21247343ad869743bebd0c
2026-11-19 19:54:13 +00:00
Benjamin Carlsson 6eea328081 Use the cloud emoji for cloud thread labels (#62573)
## What changed

Request emoji presentation for the cloud marker in thread labels.
Preserve the emoji variation selector immediately after the cloud
symbol in Unicode terminal titles and keep GNU Screen titles ASCII.

## Testing

Update rendering snapshots for the task overview, side panes, mentions,
resume picker, and thread identity displays. Extend the terminal title
test to cover the cloud marker in both title encodings.

GitOrigin-RevId: 15959a0760f63a45d8fff917df2e008cda7536a5
2026-11-19 19:04:56 +00:00
jif 3869f396aa Keep async Guardian scoring active for serving probes (#62571)
## Why

A serving probe that reports no review needed can bypass async scoring.
Keeping the async path active lets Guardian compare the two signals
while using the existing approval policy.

## What changed

Treat streamed review flags as observations. Match each flag to its
response item, carry the enclosing item's flag into Code Mode tool
calls, and discard the flag when a pre-tool hook rewrites the payload.

Emit correlated `codex.guardian_probe_comparison` logs for tool calls,
async classification outcomes, and synchronous review results.

## Testing

Update integration tests to expect async scoring even when a probe
reports no review needed, and verify that Code Mode retains the probe
across yield and resume.

GitOrigin-RevId: 715f56ba4a82d544ce59f0291bcd1a84dd2daa51
2026-11-19 18:54:22 +00:00
Joe Savona 99870c4f49 Add justification to custom statusline rows (#62569)
## Why

A fixed gap cannot keep two statusline groups at opposite edges as the terminal width changes.

## What changed

Set `justify: "between"` on a root `row` to distribute spare footer columns between its items on each line, in addition to the configured `gap`. Nested rows size to their content within the available width, so they can keep related fields together.

Use `justify: "start"` to pack items at the leading edge with the configured gap. Both explicit modes group adjacent bare strings into one item. Separate `text` or `row` elements can be positioned independently. Omitting `justify` preserves the existing gaps between authored children.

## Testing

Add renderer tests for edge alignment during resizing, spacing on wrapped lines, and root versus nested rows. Extend the row decoding tests and the TypeScript contract fixture to cover `justify`.

GitOrigin-RevId: 3319e688f3adfe6d35709ef279345f1db3eb9693
2026-11-19 18:53:03 +00:00
Charlie Marsh 0762dfa710 Box the managed credential loading future (#62568)
Return a pinned, boxed future from `try_load_managed_auth` so callers
store a pointer to the credential loading future in their async state
machines instead of embedding the full future.

GitOrigin-RevId: 898e4877cc197720d88fc36a566533c5594f4f38
2026-11-19 18:52:23 +00:00
Bryan Ashley 65454c7b99 Add OpenTelemetry for subagent lifecycles (#62567)
## Why

Correlating a subagent's creation, turn attempts, and stop requests
helps explain what happened when those actions span workers.

## What changed

- Emit structured events and counters for successful spawns and accepted
  `close_agent` and `interrupt_agent` calls. Count accepted stops even
  when the target is already idle or unloaded.
- Track initial, follow-up, and resumed turn attempts for spawned
  subagents. Record each start and at most one outcome per attempt:
  completed, failed, interrupted, or suspended.
- Use thread, turn, and call IDs to correlate structured events while
  keeping those IDs out of metric labels.

## Testing

Add coverage for lifecycle counts, duplicate outcomes, stop handling,
and event correlation across workers. Improve the Windows elevated
sandbox test for an approved `git pull` by provisioning the sandbox
before the turn and reporting setup or launch failures with diagnostics.

GitOrigin-RevId: bc1190302e1dffbdd79c7ac984b6debe1dac4a65
2026-11-19 18:39:32 +00:00
Dylan Hurd 617ad20df0 Remove the real-time wait from the OTLP headers helper timeout test (#62566)
## Why

The stalled-helper test waits 10 real seconds to check the timeout.

## What changed

Use Tokio's paused clock and a named pipe to keep the helper blocked.
Assert that it reports the expected timeout after exactly 10 seconds
of virtual time. Keep executable paths with spaces covered by a
separate test.

GitOrigin-RevId: ceabf0697576c7944708e467dd0f1a33fd644f42
2026-11-19 18:38:49 +00:00
Dylan Hurd 692292695b Fix timing races in core integration tests (#62564)
## Why

Steering can cancel a paused mock HTTP stream, realtime handoff and turn
events can arrive in either order, and streaming tools can run before the
response reports token usage. Tests that assume a fixed sequence can fail
depending on timing.

## What changed

- Pause the hooks test at assistant message completion so both queued prompts
  enter the same batch before the turn resumes.
- Track the handoff and turn events in one pass, waiting for the matching
  turn to complete on the unblocked path.
- Call `get_context_remaining` during the compaction fallback and assert
  zero remaining tokens using the preceding response's usage.

GitOrigin-RevId: ec8a108517c819d7087681e8e2c7b5b57f4b341e
2026-11-19 18:22:41 +00:00
Felipe Coury 308ab1b895 Document how to render TUI shortcut labels (#62560)
## What changed

Use `esc close` to show how to combine the Escape binding's display
label with the action text and use the shared shortcut styling in
views and mockups.

GitOrigin-RevId: 0bb0dc94e503932443076dbe2495e5494e3df5b2
2026-11-19 18:05:07 +00:00
tongzhou wang 65d69f25b4 Reject overflowing rollout budget charges before posting (#62559)
## Why

An overflowing hook total could send a partial charge to the host, and
an overflow in native accounting could leave the posted balance infinite.

## What changed

Reject overflowing hook totals before reporting usage. Check both the
combined provider and hook charge and the cumulative rollout balance
before posting, preserving the previous balance on overflow. Native
budgets with limit enforcement enabled still stop new work on overflow.

## Testing

Update the hook overflow integration case to verify that the response's
tool is blocked and the host receives no usage report.

GitOrigin-RevId: 2ac80a6aa1d857924a8807df7bb70c6b7c107cd2
2026-11-19 17:46:53 +00:00
jif 4d517cce4a Preserve process state across concurrent unified exec updates (#62557)
## Why

Process lifecycle handlers could overwrite each other's updates by reading
and replacing the entire state. For example, a rejected stdin write could
restore an older snapshot after the output collector recorded an exit code.

## What changed

Apply lifecycle transitions in place under the watch channel's write lock.
Rejected stdin writes and confirmed termination only mark the process as
exited, preserving any exit code already reported by the executor.

## Testing

Regression tests cover both closed stdin and unknown-process responses.
They verify that subsequent lifecycle updates preserve the exit code and
sandbox denial recovered from the final read, and that repeated calls to
`fail_and_terminate` preserve the first failure message.

GitOrigin-RevId: f090c0860c86b6e668c31d122d986ea4f4a119b6
2026-11-19 17:33:26 +00:00
Eric Traut 325123ae4a Render \widetilde in terminal Markdown math (#62554)
## What changed

Apply the same Unicode combining tilde as `\tilde` when the
`\widetilde` argument is a single grapheme.

## Testing

Extend the Unicode math snapshot to cover both `\widetilde{I}` and
`\widetilde I` in fraction numerators.

GitOrigin-RevId: e6976f998bb0955ba9c73117bd19dd814b07399a
2026-11-19 17:12:52 +00:00
Charlie Marsh ac784eb10e Enable MCP connection sharing by default (#62552)
## Why

Local stdio discovery needs to accommodate legacy servers that return an
empty response to `server/discover`, take longer to initialize than the
discovery watchdog allows, or require `initialize` as their first request.

## What changed

Mark `mcp_connection_sharing` stable and enable it by default. Treat an
empty discovery response as an unsupported method and let legacy
initialization use the configured startup timeout. Give legacy restarts
a fresh timeout and keep modern version retries within the original
deadline.

## Testing

Cover empty discovery responses, slow initialization on the original
connection, and restarts after ignored or rejected initialization.
Explicitly select legacy mode in tests that depend on legacy behavior.

GitOrigin-RevId: 04d87ddfe02fac8491f879ce420bf294dc725128
2026-11-19 16:56:55 +00:00
Eric Traut 76aa618787 Render multiline Mermaid flowchart edge labels (#62550)
## Why

The terminal renderer already supports line breaks in flowchart node
labels. The same syntax in an edge label causes the diagram to fall
back to source text.

## What changed

Treat `<br>`, `<br/>`, and `<br />` as line breaks in edge labels.
For example, `A -->|"Review<br/>order"| B` renders the label on two
lines. Reserve space for each line and preserve blank lines without
erasing edge connectors.

## Testing

Add snapshots for all four layout directions and update the terminal
Markdown snapshot to include a multiline edge label. Test blank lines
and terminal width limits.

GitOrigin-RevId: 277525d92c6c1f105bc34516893c67eccc22a22c
2026-11-19 16:44:44 +00:00
jif ab00c6d640 Prevent remote app-server shutdown from hanging on a full queue (#62547)
## Why

A stalled WebSocket write can leave the remote client's command queue
full. Shutdown can then wait indefinitely to enqueue its command,
before it reaches the timeout that allows it to abort the worker.

## What changed

Apply `SHUTDOWN_TIMEOUT` to enqueuing the shutdown command so the client
can reach the existing worker abort fallback even if the queue stays
full.

## Testing

Add a paused-time regression test that keeps the queue full with a
stalled worker and verifies that shutdown returns and the worker has
finished.

GitOrigin-RevId: d7c1a90442cd2619893144b20e43f6d87d5caa94
2026-11-19 16:21:15 +00:00
jif f6a1b61912 Borrow user input in extension turn contexts (#62540)
Pass the host's existing `&[UserInput]` into `TurnInputContext` to avoid
cloning the input when building extension turn items. Use the borrowed
slice directly for skill mention detection and shadow selection.

GitOrigin-RevId: f4983b584830e481d914f0c9aa1e39e78b965a19
2026-11-19 15:46:27 +00:00
jif 0b248182be Respect app-server turn admission for agent mailbox wakes (#62537)
## Why

Automatic mailbox wakes can start new turns while the app-server is
draining or has paused turn admission. Native child results still need
to reach the parent during drain so they can survive a daemon restart.

## What changed

- Require a turn admission permit for ordinary automatic mailbox wakes
  and hold it through turn registration. Retry queued work when a
  temporary pause ends. Explicit follow-ups and native child results can
  still wake the parent during drain.
- Let `thread/inject_items` queue plain-text agent messages for native
  child threads when native tools are enabled. Injected mail follows the
  ordinary wake rules.
- Extract the remote app-server client, shared event and request types,
  and WebSocket compression into `codex-app-server-remote-client` so
  callers can use them without linking the app-server runtime.

## Testing

Cover delivery of queued mail when admission reopens, injection into
native child threads, and recovery of a child result after a daemon
restart.

GitOrigin-RevId: 4c5ceeca8829c2612cc2b6b74c03d0c7677a9244
2026-11-19 15:45:17 +00:00
tongzhou wang 27e16c08c3 Add built-in namespace guidance and budget tool description prefixes (#62534)
## Why

Namespace-wide guidance can repeat on every entry in flat Code Mode listings. The existing prefix limit covers only reachable `functions` tools, leaving indirect namespace guidance outside the budget.

## What changed

- Add `builtin_tool_namespaces` to put guidance on namespace headers in Code Mode prompts and tool search responses, including headers shared with client tools. The selector applies to namespaces with a registered built-in tool and is omitted from flat listings. Overlapping selectors must agree after trimming.
- Validate all four prefix maps together against the selected model's `description_prefix_budget_bytes`, which defaults to 512. Count each trimmed value once in UTF-8 bytes, including unused selectors. Exclude keys, paragraph separators, and rendered copies.

## Testing

Cover shared headers, flat listings, and conflicting selectors. Exercise the default budget boundary with multibyte text and verify that a model can raise the limit.

GitOrigin-RevId: 1570c23ea1dbad6041cc8e48d0dc2b77f92596c7
2026-11-19 15:31:33 +00:00