Commit Graph
14463 Commits
Author SHA1 Message Date
Dmitriy Kovalenko 18e2471c33 Reduce repeated work in filesystem sandbox path checks (#65069)
## Why

Checking multiple paths against the same sandbox policy repeats root
resolution and protected metadata path construction. URI containment
checks also allocate segment lists and check for escaped separators
even when paths contain no escapes.

## What changed

- Lazily cache resolved policy roots, lexical depths, protected metadata
  paths, and the full-disk write decision in the path matcher. Reuse the
  matcher across checks against the same prepared local policy.
- Compare URI path segments directly from iterators and skip decoding
  for plain POSIX segment comparisons. Keep checking the full path for
  encoded separators, including the suffix beyond a matched prefix.

## Testing

Exercise one prepared matcher against protected metadata and an ordinary
writable file. Extend URI prefix tests to cover a candidate shorter than
its base and paths with repeated or trailing separators.

GitOrigin-RevId: 34425d018516e24c36e1c87ea51bfbd344137cd8
2026-12-01 19:57:25 +00:00
Tom 848d7ffbe3 Trace per-step preparation for each tool contributor (#65067)
Add an info-level `tool_contributor.prepare_for_step` span so traces
show how long each contributor spends preparing before tools are built.
Label the span with the contributor's `trace_name()`, which defaults to
its concrete Rust type name, and skip recording the preparation inputs.

GitOrigin-RevId: cc644deb2d7c1a00e8eea68698516ad1c2e102da
2026-12-01 19:34:56 +00:00
vishnu-oai 4c75131c9c Validate config server policy before replacing login credentials (#65066)
## Why

An explicit `codex login` can reuse a saved config server grant, leaving
users without a way to switch accounts through that command. Saving a new
grant before validating its managed configuration can also displace a
working session if the policy fetch or validation fails.

## What changed

- Start a fresh config server sign-in for explicit browser and device-code
  logins, even when a grant is already saved.
- Hold the new grant in memory while fetching and validating its managed
  configuration. Save the grant and then update the policy cache after
  validation succeeds.
- Recheck config server and proxy settings and reload local network rules
  before fetching policy. Reject logout while a config server sign-in owns
  the login lock, including during the first sign-in.

## Testing

Cover successful grant replacement and preservation of the saved grant
when authorization, policy fetch, or policy validation fails. Verify that
network restrictions can block the policy fetch and that logout detects
an in-progress first sign-in.

GitOrigin-RevId: 427a70d556f92fd96c43f6e8737371aa3651e70c
2026-12-01 19:33:48 +00:00
Benjamin Carlsson 854e723882 Add --cloud to launch interactive Codex sessions on Cloud (#65063)
## What changed

- Select the Codex Cloud backend at startup with `codex --cloud`,
  `codex agents --cloud`, or `codex resume --cloud`.
- Use `--env <ENV_ID>` to select a saved Cloud environment for new
  threads. Resume by picker, most recent session, ID, or name using the
  thread's saved environment and model.
- Reject local execution overrides and managed execution requirements
  that Cloud cannot enforce. Recheck managed requirements for the
  ChatGPT workspace selected when connecting.

## Testing

Cover initial prompt delivery, resume by ID and name, and rejection of
unsupported settings, including managed execution requirements from a
workspace selected after startup configuration was loaded.

GitOrigin-RevId: 6144decb9679f903607a586466cff37e402ab4a4
2026-12-01 19:17:41 +00:00
Tom 78f1e86b44 Trace per-server MCP startup waits during binding capture (#65062)
## Why

The aggregate `mcp.binding.startup_wait` span measures how long binding
capture waits for MCP startup. It gives no breakdown of which servers
account for that time or how their waits end.

## What changed

Add an INFO-level `mcp.binding.server_startup_wait` child span for each
server registration. Each span measures that server's wait independently
and records its name and outcome. Outcomes distinguish readiness,
startup that already completed, a cached catalog, expiration of the
optional startup grace period, startup failure or cancellation, and
interruption when binding capture is dropped.

## Testing

Add trace export tests that use the production filter and check parentage,
overlapping waits, and outcome reporting. The tests also check that
environment identifiers and startup error details stay out of span
attributes.

GitOrigin-RevId: e5ebc7d92a511271f2004ab34fa3a0be6a4e926d
2026-12-01 19:17:01 +00:00
jif 9f02599a9a Add stop_agent for multi-agent V3 (#65061)
## Why

When a worker's current turn is no longer needed, the caller needs to
know when that turn has released its execution slot. Previously,
`interrupt_agent` returned without waiting for the slot to be released.

## What changed

Replace `interrupt_agent` with `stop_agent` in V3. When stopping a loaded
worker, the tool waits for the interrupted turn to release its slot.
A message can resume the worker, and queued input can reclaim the slot
immediately.

Workers can target their own path to stop after the current tool batch
if no new input is waiting and no send failed.

## Testing

Extend the V3 mailbox test to cover self-stop freeing the only worker
slot, a message waking another worker, and the parent stopping that
worker and observing its interrupted status.

GitOrigin-RevId: b066d10e4221fabe49b07ed126752e2e88e9517b
2026-12-01 19:16:25 +00:00
Tom 278dd6cafd Trace each MCP tool-list page and its retries (#65060)
## Why

A tool-list page can take multiple attempts. Tracing the whole page
keeps retry warnings tied to the page that triggered them.

## What changed

Wrap each `tools/list` page request in an `mcp.tools.list_page` span
that covers the retry loop. Record whether the request has a cursor
via `mcp.has_cursor`.

## Testing

Extend the trace propagation test in both MCP protocol modes. Return
HTTP 503 on the first request for the second page and verify that the
requests carry the page span context, the cursor flag reflects the
request, and the retry warning appears on the page span.

GitOrigin-RevId: e4b695731d037f71c15660a826c9f2e59d02e55f
2026-12-01 19:13:34 +00:00
Krish Chainani 71f99fca5d Overlap Noise handshakes with remote environment provisioning (#65057)
## Why

Deferred remote environments previously waited for provisioning to succeed
before looking up the executor and starting the Noise handshake. Starting
that work while provisioning is pending can shorten the wait for a usable
exec-server session.

## What changed

When a deferred Noise environment is selected, start executor lookup and
the handshake with a bounded retry window. After provisioning succeeds,
refresh the connection bundle and reuse the early connection if it is
still live and matches the current environment, executor registration,
and public key. Otherwise, establish a fresh connection. Exec-server
session initialization still waits for provisioning success, and a
provisioning failure cancels the early connection.

## Testing

Cover early connection reuse, fallback when the executor changes or the
socket closes, and cancellation on provisioning failure. Verify that
malformed handshake replies surface as protocol errors and that connection
resets remain retryable.

GitOrigin-RevId: 658135338672f0c02c33d9203299b05ba15d1fc2
2026-12-01 18:56:52 +00:00
viyatb-oai 312c85a399 Allow hosts to bind JWT bearer grants to proxy routes (#65054)
## What changed

Add `NetworkProxyState::bind_jwt_bearer_grant` so trusted host code
can attach a grant for a specific environment, host, and exact path.
Binding requires an enabled proxy with credential brokering and TLS
interception, plus an existing rule that strips guest authorization
headers. Replacing the policy requires a fresh binding.

## Testing

Add TLS forwarding tests with separate issuer and resource origins.
Cover token refresh and reuse, alias scoping, and grant replacement.
Verify that revocation or policy reload during the upstream TLS
handshake prevents the request from reaching the resource.

GitOrigin-RevId: 5ccf058d04980ef79aca1cbae91ff558b9d71be1
2026-12-01 18:41:32 +00:00
Felipe Coury 4bc6a0ea93 Render web URLs in TUI file citations as hyperlinks (#65052)
## Why

The TUI treated URLs in file citations as local paths. This could prepend
the working directory and escape parts of the URL needed to reach the
cited resource.

## What changed

Render HTTP and HTTPS `codex-file-citation` paths as web links, preserving
percent escapes, query strings, and fragments in the displayed URL and
hyperlink destination.

## Testing

Regression tests compare file citations with equivalent Markdown links
with and without a working directory. A snapshot covers the rendered
text and hyperlink metadata for a spreadsheet URL.

GitOrigin-RevId: 2f3213192fced0e92ae87062d086a9015113b862
2026-12-01 18:23:08 +00:00
Eric Traut b6a53810db Add failure stages and OS error kinds to daemon startup metrics (#65049)
## Why

The TUI's daemon auto-start metric reports a failure reason, but broad
reasons such as `other` leave it unclear which startup step failed.

## What changed

Add `failure_stage` and `os_error_kind` to failed `codex.daemon.start`
attempts. For example, a missing executable reports `spawn` at
`process_spawn` with `not_found`. The metric uses a fixed set of error
categories and keeps raw OS codes and diagnostic text local.

Report Windows detached-launch restrictions as
`windows_detach_restricted`, matching the reason recorded when the TUI
falls back to an embedded app server.

## Testing

Cover missing executables, Windows launch restrictions, and preservation
of the underlying I/O error. An in-memory metrics test checks that a failed
attempt increments the counter once and maps an unknown OS code to `other`.

GitOrigin-RevId: c5976517e1178fb8d65257362a893ad6254a2ddd
2026-12-01 18:08:05 +00:00
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