Commit Graph
13258 Commits
Author SHA1 Message Date
Eric Traut b6087365cd Repair app-server daemon packages with update --from-cli (#65046)
## Why

A daemon with a dangling package selection or a missing executable can
fail to start, and leftover logs can make an absent installation look
like an existing one.

## What changed

- Let `codex app-server daemon update --from-cli` install or repair and
  pin the daemon from a complete CLI package. Point missing-executable
  errors to that command. Repair checks that the daemon and updater are
  stopped and that the package selection has stayed unchanged.
- Let `codex app-server daemon start` bootstrap a missing installation
  even when old daemon logs remain. Use legacy logs to infer a stopped
  standalone installation only when its package selection still exists
  and dedicated daemon logs are absent.
- Allow repair to replace a dangling Windows junction whose target is
  directly under the daemon's releases directory.

## Testing

Extend coverage for startup with leftover logs, package repair after
losing the selection or executable, repair blocked by a starting
daemon or updater, and replacement of a dangling Windows junction.

GitOrigin-RevId: 679266cc22b7ff7a34bbd41c2bf0659d3068eb75
2026-12-01 17:56:54 +00:00
Eric Traut 09984ca85d Fix app-server daemon startup with BusyBox ps (#65043)
## Why

BusyBox `ps` can reject the arguments Codex uses to read a process start
time. That failure prevents the managed app-server daemon and updater
from starting even when Linux can identify both processes through `/proc`.

## What changed

On Linux, allow startup to proceed when the `ps` lookup fails and
`/proc` identifies a live process. Store that identity in the PID record
with an empty legacy start timestamp.

## Testing

Add a Linux CLI regression test that substitutes a failing `ps`, checks
both PID records for a process identity and an empty legacy timestamp,
and verifies that `daemon version` reports the daemon running and
`daemon stop` stops it.

GitOrigin-RevId: fc82e0e32a62ffbb1dc1683403757f3ab109000a
2026-12-01 17:52:27 +00:00
Eric Traut 51f546979e Keep Sixel pets visible during composer sparkle redraws (#65040)
## Why

When composer stars fade, the terminal can clear to the end of the row and erase part of the Sixel pet image.

## What changed

Leave a strip of default background at the right edge of the composer where the Sixel pet is drawn, so star redraws can update the composer without clearing through the image.

## Testing

Add a terminal regression test that uses text markers to stand in for Sixel pixels. It checks that the markers survive while the stars are visible and after they disappear, and that disabling the pet restores the composer background in that area.

GitOrigin-RevId: 0f55d1e5594fa503edeb13d2d262e3c73bb0366b
2026-12-01 17:37:47 +00:00
Eric Traut e14750e0b9 Preserve the exit summary when Ctrl+C is pressed again on Windows (#65038)
## Why

Once the TUI restores the terminal, another Ctrl+C becomes a Windows
console event and can terminate Codex before it prints the exit summary,
including the resume hint when available. The npm launcher can also
force-terminate the child by forwarding a Ctrl+C that Windows already
delivered to it.

## What changed

Register a Windows Ctrl+C listener before restoring the terminal and keep
it alive until the CLI or standalone TUI finishes printing the exit
summary. Skip forwarding `SIGINT` from the npm launcher on Windows.

## Testing

Add a Windows regression test that simulates `SIGINT` in the npm launcher
and checks that the child can finish and report its own exit code.

GitOrigin-RevId: cd73a4a2ecc22812bc301787e67c349f7720a93b
2026-12-01 17:07:18 +00:00
jif 3da5a55b5b Abort pending terminal writes when their turn is cancelled (#65036)
## Why

A `write_stdin` call can resume after its turn is cancelled if approval was still pending. It can then send stale input to a running terminal or consume the final output of a remote process that has already exited.

## What changed

After approval, check both tool-call and turn cancellation before a non-empty `write_stdin` request can send input or drain output. Report cancelled writes as aborted and surface the abort as an error to Code Mode cells that are still running. Empty polls can still collect buffered output.

## Testing

Regression tests cover cancellation during stdin approval for direct and Code Mode calls, reuse of the same terminal on the next turn, and retrieval of final remote output after a cancelled write.

GitOrigin-RevId: 735bdd7ed0e892467647039ba72eb9a4d177a560
2026-12-01 16:54:12 +00:00
Eric Traut 214b9007dd Restore token usage after compaction on paginated thread resume (#65035)
## Why

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

## What changed

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

## Testing

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

GitOrigin-RevId: 4ea4f5e7a561fbba00fbe6b063f632a23193bc5a
2026-12-01 16:53:34 +00:00
Benjamin Carlsson 949cdb56ef Rank TUI slash commands by recent usage (#65034)
## Why

The slash menu uses a fixed order within each match tier, so frequently used commands can stay buried among equally good matches.

## What changed

Rank commands within each match tier by frequency over the last 50 dispatches, keeping the existing order for ties. Count `/quit` toward `/exit` and `/btw` toward `/side`. Store slash command usage locally in `slash_command_usage.json`, separate from `$` picker history, when history persistence is enabled.

If `/exit`, `/quit`, or `/logout` ranks first, require its full name or explicit menu navigation before Enter can run it.

## Testing

Cover ranking after queued and disconnected dispatches, exact-match priority, persistence after widget handoff, and explicit selection of shutdown commands.

GitOrigin-RevId: 152f2b642dcac1ece9c3347eb4541d03fc3a425c
2026-12-01 16:52:56 +00:00
Benjamin Carlsson 5c865592f4 Remember the TUI's Cloud environment choice per project (#65033)
## Why

Selecting a saved Cloud environment for a draft did not set a default
for future conversations in the same project.

## What changed

- Save the environment selected for a Cloud draft in the local user
  configuration under `tui.default_cloud_environments`, keyed by project
  and local user identity. Selecting Default clears the preference.
- Reuse the preference at startup, when creating a new Cloud conversation,
  and when switching to Cloud. Use the normal Cloud environment selection
  when the saved environment is absent from the catalog or the catalog
  cannot be loaded.
- Use the v2 environment catalog, filter for eligible saved environments,
  and deduplicate entries across personal and workspace results.

## Testing

Cover preference persistence and clearing, project scoping, reuse after a
config reload, fallback when the catalog is unavailable, and catalog
pagination, filtering, and deduplication.

GitOrigin-RevId: bc4f66842c5c83dc75c5b10840fd596feedd44df
2026-12-01 16:51:26 +00:00
Felipe Coury dcafb4c96f Honor the session directory when resuming after /cd (#65030)
## Why

Changing directories with `/cd` could force in-app resume to use the current
directory even when the saved preference was to use the session's directory.

## What changed

Use the `/cd` directory for the remembered Current choice. Explicit CLI and
remote directory overrides still select Current. If reloading configuration
fails, reuse the existing configuration only when it already belongs to the
resume directory.

## Testing

Update the in-app resume and agents overview cold-resume tests to cover using
the session directory after `/cd`.

GitOrigin-RevId: d87bc2ba96f7ca10d6fd0d5ec0414712d44238e6
2026-12-01 16:41:22 +00:00
malsamiri-oai 791cf84282 Accept LF and CRLF checksums for SQLite migrations (#65029)
## Why

SQLx hashes migration SQL byte for byte. A database migrated by a build
with CRLF SQL can fail to open in a build with LF SQL, even when the
migration statements are identical.

## What changed

On a checksum mismatch, retry validation using the stored checksum for
each migration whose SQL matches with either line ending. Preserve
stored checksums and continue to reject unrelated mismatches and failed
migrations.

Repair state databases that recorded the recency migration as version
`38` by moving its record to `39` for either line ending. Apply the
actual version `38` migration in the same transaction.

## Testing

Cover upgrades and reopening with an active writer, legacy recency
repair with either line ending, and rejection of wrong-version checksums
and dirty migration records.

GitOrigin-RevId: e8d481811a5150379777340eb355168ee60c41d7
2026-12-01 16:40:37 +00:00
felixxia-oai 8ea32990bc Add message-count batching to the Guardian v3 housekeeper (#65028)
## What changed

Set `batch_limit = { mode = "messages", limit = 9 }` in the housekeeper
configuration to route up to nine new evidence records per batch. Each tool
call and each tool result counts separately. In this mode, batches can exceed
the default 100,000 estimated tokens while still fitting within the routing
model's input limit.

## Testing

Add a housekeeping test that routes nine large records in the first batch
and defers the tenth to the next batch.

GitOrigin-RevId: 99fdfc71f432007958c793a46b251f2e32a3e8ba
2026-12-01 16:39:54 +00:00
felixxia-oai 1b3eee5af3 Make Guardian V3 housekeeper batch size configurable (#65027)
## Why

The housekeeper used the model's tool-output truncation limit to size
routing batches, tying how much evidence it could route at once to a
setting intended for tool output.

## What changed

Add `guardianv3.housekeeper.batch_limit` to cap the estimated tokens in
the serialized channel catalog and new evidence. It defaults to 100,000
estimated tokens. The housekeeper packs whole evidence records into each
batch and splits batches further as needed to fit the model's context
window.

```toml
[guardianv3.housekeeper]
batch_limit = { mode = "tokens", limit = 50000 }
```

## Testing

Cover parsing a positive limit and rejecting zero. The routing tests
check that the default groups eight 44 KiB evidence records into one
batch and routes the ninth in a separate batch.

GitOrigin-RevId: 2480afb8b64ed042fa41d75513aea8186e2a578e
2026-12-01 16:38:27 +00:00
jif 18cf9ef6e7 Let V3 workers stop after their tool calls finish (#65025)
## Why

A worker can send a message and ask to stop in the same response. It
needs to see any send failure before going idle so it can respond to
the error.

## What changed

When a V3 worker targets itself with `interrupt_agent`, finish the
current tool batch and skip the automatic model follow-up if no
`send_message` call in that batch failed. Pending input can still
trigger another model request. Scope the stop to the sampling attempt
so it cannot carry over to a retry.

## Testing

Extend the mailbox integration test to cover a truncated response, a
send failure alongside a self-stop, and a subsequent self-stop that
runs the `SubagentStop` hook and frees the worker slot.

GitOrigin-RevId: 62e377026d32ffc59d1ea5b88030ce9148d414b4
2026-12-01 16:23:27 +00:00
Felipe Coury eb1c5108a3 Reject oversized remote sidebar file previews before reading (#65022)
## Why

A remote preview can exceed the WebSocket client's 128 MiB message limit
once the file is base64-encoded and wrapped in a JSON-RPC response.

## What changed

Check the file size with `fs/getMetadata` before calling `fs/readFile` for
remote previews. Allow for base64 expansion and reserve room for the
JSON-RPC envelope. If the reported size exceeds that budget, show a
preview error with the file's size.

Continue with the read if the server lacks `fs/getMetadata` or omits
`sizeBytes`. Apply the sidebar's existing path error handling to metadata
failures as well as read failures.

## Testing

Extend the remote preview test to cover an image at the size limit,
oversized image and text files, and both metadata compatibility fallbacks.

GitOrigin-RevId: a284b3b76d9c56fe7e80445d880ccc17d575681c
2026-12-01 16:07:34 +00:00
Dylan Hurd 697f9e5a5e Wait for complete PTY input in the TUI startup test (#65021)
## Why

A completed write to the PTY master can reach the slave in fragments.
The startup test could run its zero-time poll or input discard before
the full sequence arrived.

## What changed

Use `FIONREAD` to wait until the full paste boundary and the subsequent
action input are each queued on the PTY slave. The wait leaves the bytes
unread and reports how many arrived if it times out.

GitOrigin-RevId: 077715814c4e11e6dfd42e63238222b0204aff4d
2026-12-01 15:55:25 +00:00
jif 30c23ded92 Avoid delaying sandboxed process exits after output closes (#65017)
## Why

The exec server can wait up to 20 ms for sandbox denial output even
when all output streams have already closed. If the last stream closes
during that wait, the close alone does not wake the exit watcher.

## What changed

Skip the wait when all streams are closed and wake the exit watcher
when the last stream closes. Register for notifications under the
process lock so the exit watcher can observe stream closure and
`process/read` can observe the exit as soon as it is published.

## Testing

Add paused-clock regression tests for streams closing before exit,
the final stream closing during the wait, and denial output arriving
after the first stream closes.

GitOrigin-RevId: 22715a0fbe4e582d82abcba8eab4802c42353f69
2026-12-01 15:43:47 +00:00
Dylan Hurd 55c37f6b80 Wait for an attached thread in TUI job-control tests (#65012)
## Why

The `/status` palette can appear during startup, before the TUI attaches
to a thread. Waiting for the palette alone can let the test suspend the
TUI too early.

## What changed

Use the bundled model catalog to avoid model fetch delays during test
startup. Configure the status line to show `thread-id` and `run-state`,
then wait for ` · Ready` before opening the `/status` palette and
suspending the TUI.

GitOrigin-RevId: adfe1163082dca64c76791f38cee29791ea774b5
2026-12-01 15:28:04 +00:00
jif aadf113445 Wait for V3 workers to release their slots when stopped (#65008)
## Why

With only one worker slot, starting a replacement can fail while the
interrupted worker is still cleaning up its turn.

## What changed

Add `CodexThread::stop_worker` for V3 workers. Enable interruption at
sampled item boundaries for V3 and make the stop call wait until the
interrupted turn releases its execution slot. The stopped thread can
still accept later messages.

## Testing

Add an integration test that holds a worker during sampling and abort
cleanup, checks that the stop call remains pending at both points, and
starts a replacement worker in the only worker slot after stop returns.

GitOrigin-RevId: da78de02d8c32a0f6e62b0487b49cf4908c01de5
2026-12-01 15:16:03 +00:00
Felipe Coury 8a8708c657 Preview large JPEGs in the TUI sidebar (#65007)
## Why

A JPEG can exceed the sidebar's 32 MiB decode budget even when its
thumbnail would fit comfortably.

## What changed

When a full JPEG decode hits the allocation limit, try building a
preview from JPEG block averages within the same budget. The fallback
supports sequential and progressive JPEGs, applies EXIF orientation,
and preserves the oriented source dimensions in the sidebar label.

## Testing

Add tests for a 6544 × 1721 sequential JPEG that produces a 768 × 202
preview and for a progressive fixture that exercises scan refinement,
restart markers, EXIF rotation, and allocation limits.

GitOrigin-RevId: 232b37d8c239fbaa602930d9032c9a784bd030e2
2026-12-01 15:14:52 +00:00
Dylan Hurd 187affbce3 Wait for the Command Center grouping header in the startup test (#65004)
## Why

Startup can send a `thread/list` request while the loading screen is still
visible. Reading the terminal buffer at that point can make the saved
grouping test fail before the Command Center header has rendered.

## What changed

Capture completed terminal frames through a test-only channel. Have
`agents_overview_startup_restores_saved_grouping` wait for the grouping
header and verify that it shows `Group: Status`, the saved preference.

GitOrigin-RevId: e4479039e0663483016637be0fe5bfff62f27044
2026-12-01 14:58:43 +00:00
jif 33aab1f2c6 Always track retained command sessions in world state (#64993)
## What changed

Track retained command sessions on every turn and mark
`command_sessions_world_state` as a removed compatibility flag. When
`write_stdin` is unavailable, keep reporting retained sessions and indicate
that they cannot be polled.

Omit the command session section when there are no sessions and no prior
section. Still emit an empty update when needed to clear stale handles.

## Testing

Update the Code Mode scenario to exercise retained command session tracking
without enabling the flag. Its snapshot omits the empty section before any
commands are retained.

GitOrigin-RevId: fd953750b06f0098ae6382ce3d3115a1263fd305
2026-12-01 13:42:02 +00:00
jif 9a8b299471 Fix relative TMPDIR resolution in the Linux filesystem sandbox (#64976)
## Why

When `TMPDIR` is relative, `environment/info` resolves it against the
executor's working directory. The filesystem helper starts at the
filesystem root, so its `:tmpdir` rules could apply to a different directory.

## What changed

Use the executor's resolved temporary directory when binding `:tmpdir`
rules. Reject requests whose supplied temporary directories no longer
match the executor, and preserve the helper's original `TMPDIR` for
scratch files.

## Testing

Add a Linux integration test covering `:tmpdir` read grants and denials,
rejection of stale temporary directory information after the executor's
working directory moves, and a write without a `:tmpdir` rule.

GitOrigin-RevId: 6772c17251500dae3f6b0a2b17ee95955289e89b
2026-12-01 11:34:33 +00:00
jif 51957a2da5 Handle Stop after multiple command approval declines (#64960)
## Why

The desktop client declines all open command approval prompts before
sending Stop. If the first decline is still being recorded in history,
a second queued decline can keep Stop from reaching the active turn.

## What changed

Queue consecutive declines for the same active turn and record them in
submission order. If Stop follows, interrupt the turn while the declines
are still being recorded, then finish recording them before publishing
the turn-aborted event.

## Testing

Extend the interruption regression test to cover two declined prompts
followed by Stop. It checks that the running sibling command stops while
history is blocked, both commands are recorded as declined before the
turn-aborted event, and completed sibling output is preserved.

GitOrigin-RevId: 00ac946378cc5fcf6c77e4a657aaa64508d60421
2026-12-01 09:44:12 +00:00
viyatb-oai 494c43b0c5 Bind JWT bearer grants to HTTPS proxy hooks (#64942)
## Why

A sandboxed client needs to authenticate to an allowed HTTPS endpoint
without receiving the upstream JWT.

## What changed

Let an HTTPS proxy hook exchange a guest bearer alias for a JWT scoped to
the requesting environment and exact resource path. Recheck the hook
policy and grant after establishing upstream TLS, then attach the JWT to
the outgoing request.

## Testing

Add tests for rejecting ambiguous rules and unsafe paths, preserving
ordinary header stripping outside the bound path, and rejecting an alias
after its grant is dropped.

GitOrigin-RevId: 41837b45abcbe97b4dd73c65964d59c661879b46
2026-12-01 07:07:36 +00:00
Alex Daley a54018ff36 Expose TypeScript signatures in Code Mode's ALL_TOOLS (#64939)
## Why

Code Mode embeds TypeScript declarations in tool descriptions, so scripts
that want to inspect a tool's argument and return types have to extract
the declaration from the description.

## What changed

Enable `features.code_mode_all_tools_schema` to expose callable names,
descriptions, and TypeScript signatures as separate fields in `ALL_TOOLS`.
Update the `exec` guidance to match the selected format, including when
resuming a session. The flag is off by default.

Carry signatures over gRPC and stdio. Reject execution requests with
signatures when the host does not advertise support for them.

## Testing

Add coverage for both catalog formats, `exec` guidance on resume, and
signature preservation over gRPC and stdio.

GitOrigin-RevId: dedaeec4a2563c23d432c324187ef20f6a0e5ea3
2026-12-01 06:54:13 +00:00
akak-oai 936ac6dbe6 Add critical-path snapshots for turn milestones (#64935)
## Why

The completed turn profile describes the whole turn. A host measuring latency
to an intermediate event needs the elapsed time and critical path at that event.

## What changed

Expose `turn_milestones` through `codex-core-api` and bind host-provided watches
when a regular turn starts. Add helpers to match published assistant text to
the sampled response and capture a one-shot observation with its source,
elapsed time, and critical path at the cutoff.

## Testing

Add tests that verify a cutoff during a second sampling round includes earlier
sampling and joined tool work, stale or cancelled candidates leave the watch
available, and elapsed time is recorded even when critical-path capture is
disabled.

GitOrigin-RevId: 507b7aaf8819b5cedf608ea66807c632bcb59c82
2026-12-01 06:25:16 +00:00
Benjamin Carlsson 1ba4c7b4fb Recover Cloud sessions with paginated TUI history (#64932)
## Why

A Cloud session can have more history than the TUI scans on reconnect.
Requiring the full transcript prevents recovery even when the recent
history is enough to verify where the session left off.

## What changed

Allow recovery from a bounded history window in owned transcript mode
when it confirms the required turns and updates. Preserve completed
local history outside that window and keep older history pageable
without rendering prompts or replies twice.

Bound turn metadata lookups, including across turns without items.
Sample partial history again before restoring queued question answers
so a response from another client has another chance to appear.

## Testing

Extend reconnect tests to cover partial and overlapping history,
missing live updates, duplicate-free pagination, bounded metadata
lookups, and queued question answers.

GitOrigin-RevId: 2f12d64dc83a6e7e42ee3923baaea40ca7f663ab
2026-12-01 05:32:15 +00:00
Benjamin Carlsson 0ee8daa550 Discover local and cloud tasks together in the agents overview (#64930)
## Why

The agents overview could miss cloud tasks when opened from a local
session, even when the cloud backend was already connected.

## What changed

- Refresh tasks from connected backends when opening the overview, and
  have **Show more** fetch additional pages from each backend that has
  more results.
- Preserve pagination progress across refreshes when it still applies,
  and keep refresh errors visible until the affected backend recovers.

## Testing

Add coverage for discovering and paging through cloud tasks from a local
session, reopening the overview with pagination progress intact, and
refreshing after lifecycle events from a background backend. Add a
snapshot of the mixed local and cloud overview.

GitOrigin-RevId: 11d3108dbbd8c7033cd8fe43cfd045fb3eacccd4
2026-12-01 05:20:42 +00:00
pakrym-oai 2c2a945de2 Record why Responses WebSockets fall back to HTTP (#64923)
## Why

The fallback counter identifies the original transport but gives no indication
of what triggered the switch to HTTP.

## What changed

Include the triggering Codex error kind and HTTP status, when available, in
the fallback warning and the `codex.transport.fallback_to_http` counter.
The counter uses `none` when the error has no HTTP status.

## Testing

Integration tests assert a single counter increment with the expected tags for
HTTP 426 during connection setup, HTTP 403 after retries, server overload, and
oversized WebSocket messages.

GitOrigin-RevId: 6f8b9d5049da1563e035fff62473c85693f0ad1b
2026-12-01 04:47:08 +00:00
akak-oai 410b21c003 Add a crate for one-shot turn milestone watches (#64920)
## What changed

Add `codex-turn-milestones` to the Cargo and Bazel builds. A single turn
can take each registration, which can watch published assistant text
and direct Apps tool starts independently. Callers match text candidates
or resolved resource URIs and can claim each watch once.

The API lets callers match outside the timing lock, claim the watch while
capturing the timing snapshot, and deliver the owned observation after
releasing the lock. Observations include the thread, turn, and source
identities, elapsed time, and a caller-supplied critical-path snapshot.

## Testing

Unit tests cover single-turn ownership and verify that two concurrent
matching tool starts yield one successful claim while leaving the
assistant-text watch available.

GitOrigin-RevId: c42c032f320752a5963eb6b0ea2aa4a2c85a2342
2026-12-01 04:20:28 +00:00
Tom c1eee51321 Trace capability discovery and cloud catalog refresh (#64917)
## What changed

Add tracing spans for per-step plugin selection, host skill discovery,
and V2 capability-root snapshots. The snapshot span records whether
skill discovery was requested.

Trace cloud catalog refresh and discovery, and time the step's wait
for the catalog lock separately from preparation under the lock.

GitOrigin-RevId: 12eeb6333a8d2b335e92112dc7dccae6e7ed266d
2026-12-01 04:09:45 +00:00
Anthony Tafoya 976c0fbbfc Stabilize span assertions in spawn publication tests (#64915)
## Why

SQLite workers can retain spans after acknowledging a write, so reading
the exporter immediately can miss spans. A paginated history reader can
also keep the fork span open after history preparation returns.

## What changed

Collect exported spans until the tracer is released, with a bounded
timeout. Cover failed spawn publication cleanup with both paginated and
in-memory history against the SQLite graph store. Check that fork
preparation starts before or at the graph upsert in the paginated case,
and that its span ends before or at the upsert's start in the in-memory
case.

GitOrigin-RevId: 2438ed49bc6c6d6c74c2695c9397a39dacc1dee2
2026-12-01 04:08:34 +00:00
Won Park 092fc09d9a Use the current MCP runtime context for skill dependency OAuth (#64899)
## Why

OAuth discovery for newly installed skill dependencies needs an HTTP
client for each added server. Building the full runtime MCP configuration
does extra work because the installer already has those server configs.

## What changed

Use `current_mcp_runtime_context` to resolve the HTTP clients for the
added servers.

GitOrigin-RevId: 4970954dd5f1ed21a02dfe7f6c3a9f1df4fe7026
2026-12-01 03:06:11 +00:00
Won Park bbfa676153 Enable unified exec process tests on non-Unix platforms (#64894)
GitOrigin-RevId: 86243d7100f9bf269924c81cdaf9593db03166dc
2026-12-01 02:57:20 +00:00
caseysilver-oai 3fe546357c Reject colon-containing plugin archive paths on Windows (#64893)
## Why

A nested drive prefix in a tar entry can redirect extraction outside
the plugin bundle staging directory on Windows.

## What changed

Reject tar entries with a colon in any path component on Windows.

## Testing

Add a Windows-only regression test for nested drive prefixes with
both forward slashes and backslashes.

GitOrigin-RevId: b19b3d0de16ffe73726981f823a8f4db6629ad22
2026-12-01 02:56:43 +00:00
Joe Savona 333bcaa7ff Preserve line breaks in plugin detail descriptions (#64891)
## Why

The plugin detail popup passes the entire description as a single line,
so it loses the author's line breaks.

## What changed

Render each nonblank description line separately and keep dim styling and
terminal-width wrapping. Skip blank and whitespace-only lines so extra
spacing in the description cannot inflate the popup header.

## Testing

Add snapshots at 40 and 100 columns and regression tests for LF and CRLF
line endings, whitespace-only lines, literal Markdown, Unicode, and
description fallbacks. Cover navigation to the install action with a long
description in a short viewport and verify that the plugin picker stays
closed when plugins are disabled.

GitOrigin-RevId: e2f988d6e9b743a4fe318bed8e56563f495da605
2026-12-01 02:54:25 +00:00
Felipe Coury 01cb497492 Size the transcript layout cache to the viewport (#64882)
## Why

On tall terminals, painting the transcript and measuring the preceding
screenful for pagination can exceed the fixed 64-entry cache. Hidden
reasoning entries in compact mode also take up cache slots, which can
force visible text to be laid out again on the next frame.

## What changed

Set the entry limit to twice the viewport height plus two, clamped to
64–512 entries, and trim the cache when the viewport shrinks. Keep the
existing byte budget and skip caching hidden reasoning in compact mode.

## Testing

Cover eviction after shrinking the viewport and verify that repeated
frames reuse visible layouts in an 88-row viewport with partial history
and 100 hidden reasoning entries.

GitOrigin-RevId: 194f39e3ad1eb72a223481c600e95463a5674fc4
2026-12-01 02:41:35 +00:00
Owen Lin 8c04e2529c Support prepared creation of persisted threads (#64839)
## Why

Thread stores can do work before Core starts, but the ordinary creation
API has no way to pass that state back to the store when it creates the
thread.

## What changed

Pass optional, single-use `ThreadStoreCreatePreparation` from
`StartThreadOptions` to `ThreadStore::create_thread_with_preparation`
when creating a persisted thread, including a fork. Reject creation
preparation for ephemeral or resumed threads. Stores that do not implement
the prepared creation method return an unsupported-operation error.

## Testing

Add a regression test that supplies creation preparation to a prepared
fork and checks that it reaches the prepared creation method by asserting
the default unsupported-operation error.

GitOrigin-RevId: bc4d3e9e5d89dd7503aed75423bc9c9d42c7f7fc
2026-12-01 00:40:48 +00:00
goodman-oai 83545f3514 Allow model catalogs to omit writable-root sentences (#64837)
## Why

The environment context already lists writable paths. An empty catalog
template previously fell back to the bundled writable-root sentence,
so a model catalog had no way to omit that repeated list.

## What changed

Treat an empty `writable_root` or `writable_roots` template as a request
to omit the corresponding sentence. Missing, null, invalid nonempty,
and oversized templates still use the bundled wording.

Suppressed roots leave the full path budget available for denied-read
paths and globs and never trigger an omitted-path warning on their own.

## Testing

Cover empty singular and plural templates and verify that suppressed
roots leave room for denied-read entries. A model-switch scenario checks
that Codex appends the updated permissions message once and preserves
the earlier conversation, filesystem permissions, and approval settings.

GitOrigin-RevId: 105819fb07ff829be8f111b3676656373aeb7892
2026-12-01 00:29:20 +00:00
felixxia-oai 404eb8b39a Track whether Guardian v3 shadow verdicts are ready by v2 (#64836)
## What changed

Add the `v3_ready` tag to the `codex.guardian_v3.shadow.pair` counter so
paired verdicts can be grouped by whether the v3 shadow verdict was
validated at or before the live v2 verdict.

## Testing

Extend the shadow comparison test to check the tag when v3 validates
before, at the same time as, and after v2.

GitOrigin-RevId: dffc58458d8eb6e7f6062ebc5eb8ccea36edb9f7
2026-12-01 00:28:39 +00:00
viyatb-oai 6aa4504d66 Add refreshable JWT bearer grants for network proxy tests (#64834)
## Why

A guest needs a stable JWT alias even when the upstream bearer expires
or is invalidated. A disconnect during refresh can leave a rotating
credential already spent, so concurrent and subsequent requests need
to share the in-flight exchange.

## What changed

Add `JwtBearerGrant` behind `#[cfg(test)]`. It exposes a decodable alias
with explicitly selected scalar claims, reuses current bearers, and
refreshes on demand. A refreshed token must preserve the grant's
identity and disclosed claims.

Invalidation makes previously resolved bearers unusable. Revocation
also blocks future refreshes, and a failed or ambiguous refresh
permanently revokes the grant.

## Testing

Cover shared refreshes, request cancellation, invalidation and
revocation during refresh, timeouts, and claim consistency across
token rotation.

GitOrigin-RevId: 67cdf18e5aafa9dbc7290a2ef8ba62da84f826c5
2026-12-01 00:28:01 +00:00
jif 51bcfc3768 Fix cleanup when unified exec startup is canceled (#64833)
## Why

Canceling a remote command during the early-exit grace period could
drop the process before handoff and run ordinary termination. That
bypasses the exec server's startup cleanup, which also disables
recovery for the abandoned session.

## What changed

Track whether each process has been handed off or abandoned. Dropping
a live process before handoff abandons startup once. Processes handed
off to the process store or to a one-shot caller retain normal
termination on drop.

## Testing

Add regression tests for cancellation during the early-exit grace
period, dropping an explicitly abandoned process, and normal cleanup
after registration or one-shot handoff.

GitOrigin-RevId: 2276ba15e50a2345da21e7841ab9015b572786ac
2026-12-01 00:26:27 +00:00
jif 6dab58d9f7 Preserve read-only permissions across repeated thread resumes (#64829)
## Why

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

## What changed

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

## Testing

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

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

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

## What changed

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

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

## Testing

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

GitOrigin-RevId: 3d669dd59a0812b04727e4a1e458774007f054ba
2026-11-30 23:34:32 +00:00
Brent Traut 515cfeceba Skip host skill discovery in the remote command approval test (#64827)
## Why

An empty extension registry falls back to legacy host skill discovery
even when `SkipHostSkillDiscovery` is enabled. The remote command
approval test only needs to check plugin attribution when script reads
are denied.

## What changed

Enable `SkipHostSkillDiscovery` and register the skills extension with
no providers in both variants of
`remote_command_approval_skips_attribution_for_a_read_denied_script`.

GitOrigin-RevId: 1abcf6a762ac359825fe1c4db97160b9bfde0f87
2026-11-30 23:33:54 +00:00
viyatb-oai 2c13cb27f5 Add test-only JWT claim disclosure for network proxy aliases (#64826)
## Why

A guest alias needs to expose only the claims selected by policy. Refresh
also needs a way to detect changes to claims the guest never sees.

## What changed

Add a test-only helper that reads expiry from a trusted source JWT and
builds fresh JWT-shaped aliases containing only selected scalar claims.
Each alias uses a random placeholder in the signature segment.

Hash all stable claims, including undisclosed ones, in deterministic JSON
order. Exclude `exp`, `nbf`, `iat`, and `jti` so changes to those fields
during refresh preserve the digest.

## Testing

Cover selective disclosure, alias freshness, and refresh comparisons.
Exercise rejection of malformed tokens, duplicate keys, invalid validity
fields, ambiguous numbers, and disallowed disclosures.

GitOrigin-RevId: 48bc19ac57601e28d5c2cb8881f0ac0f5563aca9
2026-11-30 23:21:06 +00:00
ioanbudea-OAI 6b599f7a8e Use then_some for Notes metadata in the multi-environment MCP test (#64823)
GitOrigin-RevId: 8fab548c5c06ec5b0f005872f0b98d6c2d93fcbd
2026-11-30 22:53:09 +00:00
Eric Traut 3496c2f99c Prompt before replacing an existing transcript export (#64822)
## Why

When a filename is already taken, saving a conversation with `/export` ends
with an error. Users have to restart the export to choose a different name.

## What changed

Show a conflict picker with options to choose another name, replace the
existing file, or cancel. Choosing another name pre-fills an editable
numbered filename, such as `notes-3.md` when `notes.md` and `notes-2.md`
already exist.

Offer replacement only for regular files. After confirmation, check the
directory and file identities and use an atomic rename to install the new
transcript.

## Testing

Cover the picker actions and numbered filename suggestion, verify that
replacement requires confirmation, and check that replacement rejects a
changed file or redirected directory.

GitOrigin-RevId: edcb2fad858bab15a7228c69bd27a8ffd18e8d05
2026-11-30 22:40:58 +00:00
Eric Traut debcc79621 Use destination app-server defaults for new TUI sessions (#64821)
## Why

A fresh session could send client-side execution settings as thread
overrides, even when the destination app server had its own defaults.
The TUI also needs the destination settings when preparing the first turn.

## What changed

Use the destination defaults to prepare the first turn for session
replacement, starts from the agents overview, and backend switches.
Keep explicit launch choices and managed new-thread defaults in the
start request, and let the server resolve its own model and reasoning
effort. When `config/read` is unavailable, omit implicit execution
overrides and avoid replacing server instructions with terminal
visualization text alone.

## Testing

Extend session replacement tests to check the start request and first
turn, including shadowed launch settings, server instructions with
terminal visualization enabled, and compatibility with older servers.

GitOrigin-RevId: d66d6d51495ee067282514a138f7e39abfd91f2f
2026-11-30 22:39:43 +00:00
Eric Traut 5eb0253e6f Preserve service tier intent when starting, resuming, and forking (#64820)
## Why

A TUI resume request could override a thread's saved service tier with a
configured tier, a model default, or the local Fast default opt-out.
CLI forks could also send a tier before the destination's settings were
resolved.

## What changed

- Send a tier on resume or CLI fork only when the invocation supplies a
  tier override. In-app forks carry the current session's tier.
- On fresh startup, use the invocation's tier choice first, then the
  managed default, then the startup configuration. Keep an explicit
  reset (`serviceTier: null`) distinct from omitting the field.
- Use the current local Fast default opt-out when resolving tiers for
  new sessions and honor feature gating for launch overrides.

## Testing

Extend request assertions to cover tier omission on resume and CLI fork,
`flex` on in-app fork, and both explicit reset and disabled Fast mode on
fresh startup.

GitOrigin-RevId: d74f0f5e98506a0d5a6ead7106e1042691d41d41
2026-11-30 22:25:03 +00:00