Commit Graph
12591 Commits
Author SHA1 Message Date
alexsong-oai 970111f6cb Allow configuring GCP project and location in provider settings (#56560)
## Why

Deriving a Vertex AI endpoint previously required environment variables. Allow the project and location to be specified directly in GCP provider configuration.

## What changed

- Add `model_providers.gcp.project_id` and `model_providers.gcp.location`, with each taking precedence over its corresponding environment variable. Keep `global` as the default location and preserve explicit `base_url` overrides.
- Validate configured endpoint fields and preserve them through thread configuration serialization.
- Apply built-in GCP defaults, including default command authentication, when checking managed provider requirements so unchanged requirements are accepted.

## Testing

Add coverage for endpoint precedence, invalid explicit configuration, provider construction, thread configuration round trips, and managed GCP requirement checks, including repeated model listing.

GitOrigin-RevId: c3704bcc0b7d4872374e2cae623fd24d75fb02b4
2026-10-23 18:50:54 +00:00
felixxia-oai 7848e3393c Remove Guardian snapshot-specific context helpers (#56559)
## What changed

Remove snapshot instruction deduplication, separate retained-assistant framing, and the associated omission-metadata special cases. Use `retain_new_instructions` in transcript rendering tests and replace the test-only Decisions snapshot adapter with the conversation adapter.

## Testing

Extend retained-source delivery and incomplete-metadata coverage to both synchronous and asynchronous context profiles. Keep Decisions HTTP, eviction, and cancellation tests exercising the conversation adapter.

GitOrigin-RevId: 3906f7d7349f73931e570ffa649377c3a235317a
2026-10-23 18:50:29 +00:00
felixxia-oai 2d86506823 Exercise retained sampling in Guardian transport tests (#56557)
## Why

The transport tests used a separate, test-only snapshot sampler instead of the production retained sampler, leaving them exercising different response ownership and cancellation paths.

## What changed

Route the transport test helper through `sample_retained` and remove snapshot execution, its active-request supersession bookkeeping, and test-only compaction compatibility fields. Simplify request-token metrics to reflect the remaining admitted-request path.

## Testing

Update tests to verify early score delivery while the retained response remains pending, WebSocket cancellation and connection reuse, and HTTP cancellation before headers or during response draining. Assert that HTTP cancellation releases classification permits.

GitOrigin-RevId: 33250103ff376af6bcd0f81ef27cdcf057f2bc5f
2026-10-23 18:48:35 +00:00
felixxia-oai 4b1cf9a4c9 Use conversations for all Guardian v2 async classification (#56556)
## What changed

- Always use the retained conversation backend for asynchronous classification; keep snapshot sampling test-only.
- Accept legacy `async_classifier_mode` values in configuration and model metadata but ignore them. Emit a startup warning when `[features.guardianv2].async_classifier_mode` is configured.
- Ignore legacy classifier mode differences when checking model-switch compatibility, and fail closed if the conversation backend is missing.

## Testing

Update coverage for legacy configuration warnings, model-switch compatibility, retained approval-review context, and conversation-based scoring.

GitOrigin-RevId: 5e8bb7e4e6e7d1589572f38bfe2498c9fa6825a0
2026-10-23 18:48:10 +00:00
ioanbudea-OAI 5deceaa927 Apply sync Guardian message limits during transcript preparation (#56555)
## What changed

Defer truncation of synchronous Guardian assistant and reasoning entries until `ContextProfile::prepare_transcript`, so the resolved profile's message limit applies before rendering and retention accounting. Keep encrypted agent messages whole when they fit, or replace them with an omission notice at the same transcript position when they exceed the limit.

## Testing

Extend coverage to verify that oversized-action reviews retain assistant commentary and final-answer evidence up to the synchronous message cap, and that encrypted-message omission produces equivalent output through synchronous transcript collection.

GitOrigin-RevId: e17fbfa7b7131559b0599ac1d57987a8d94e137c
2026-10-23 18:41:23 +00:00
viyatb-oai 15fbcac045 Enable masked AWS credentials for local proxy signing (#56554)
## What changed

- Expose `aws_sigv4` actions in version 2 MITM permissions configuration and the config schema, rejecting multiple signing actions per hook.
- Give local managed commands placeholder AWS credentials for the selected signing pair, and mask configured credentials in environment values and protected shell snapshots.
- Set `AWS_CA_BUNDLE` to the managed proxy CA bundle when unset, and require `features.credential_masking` for local AWS signing hooks.
- Validate placeholders against every configured signing pair to prevent overlap with real credentials.

## Testing

Extend configuration, signing, and TLS forwarding tests to cover action resolution, invalid signing configuration, credential masking, CA trust, snapshot protection, and exclusion of local AWS defaults from remote environments.

GitOrigin-RevId: 81dfdea30ebde74829882b38891ea41e9737058a
2026-10-23 18:40:55 +00:00
andrewgu-oai c483edf177 Include environment hooks in thread hook listings (#56553)
## Why

Listing hooks by working directory alone omits hooks supplied by a thread's selected execution environments, including hooks that can block a turn.

## What changed

- Add `threadId` to `hooks/list` to return a loaded thread's current hook inventory, including selected, ready environments. Reject requests that also specify `cwds`.
- Expose `environmentId` in hook metadata and have the TUI hooks browser query the current thread and label environment-owned hooks. Keep working-directory lookup for startup review.
- Represent environment hook source paths with `PathUri` and use `LegacyAppPathString` in hook run summaries to preserve native path conventions.

## Testing

Add coverage for listing a blocking environment hook and removing it after environment failure, delivering prompt input and reporting exit status in PowerShell and Bash, and running `PreToolUse` hooks only on the command's owning executor. Extend remote network tests to verify that environment hooks use the command's network policy while retaining their filesystem access.

GitOrigin-RevId: 97229e22793df51f4bd502c1f9e19f0c52fb2305
2026-10-23 18:39:28 +00:00
Dmitriy Kovalenko 0d7f3ea03b Initialize SQLite databases with DELETE journaling on NFS (#56552)
## What changed

Choose `DELETE` journaling for new SQLite databases on NFS and `WAL` elsewhere, using the database's own directory to detect the filesystem. Probe a separately configured logs directory independently of the state directory.

Preserve journal modes for databases with an existing schema, and apply `synchronous = EXTRA` when initialization results in `DELETE` mode.

## Testing

Extend SQLite tests to cover NFS and non-NFS initialization, interrupted initialization, lazy pool connections, separate logs directories, and preservation of existing settings under a write lock.

GitOrigin-RevId: bde35861e517881b9ce23b28b199475cee70bd76
2026-10-23 18:30:44 +00:00
Benjamin Carlsson f970f4be67 Track resume picker pagination and selection metadata per backend (#56543)
## What changed

- Add a thread catalog that tracks cursors, pending requests, and exhaustion per backend, preserves cursors on errors for retry, and rejects stale completions after a reset.
- Tag listed rows with their backend and use that backend when selecting a session.
- Store history mode on each row, preserving updates from later duplicate pages.

## Testing

Add coverage for independent source pagination, retry cursors, stale completions, and selection routing. Extend the history-mode test to verify that later metadata updates are used when resuming.

GitOrigin-RevId: ed5cf33b2df0e91394682f58ad5b353b949255ff
2026-10-23 17:52:51 +00:00
Sean Huang 7c568b331b Extract the head-tail buffer into a utility crate (#56535)
## What changed

Move `HeadTailBuffer` and `format_output_omission_marker` into the new
`codex-utils-head-tail-buffer` crate, exposing the buffer API with an explicit
const-generic byte budget. Update core callers to use the crate and add Cargo
and Bazel definitions.

Move the existing buffer tests alongside the implementation, preserving the
prefix/suffix retention and omission-marker behavior.

GitOrigin-RevId: ff488d0a0a62c39c0e11c11ebb539166cc4c6e74
2026-10-23 17:35:25 +00:00
ioanbudea-OAI 0efc474605 Defer sync Guardian tool-output truncation to transcript preparation (#56533)
## What changed

Preserve tool outputs during sync transcript collection and apply the profile's `tool_tokens` limit during transcript preparation, matching tool-call handling. Keep async and Node REPL output truncation unchanged.

GitOrigin-RevId: cf1594bcf25553c08d53b86bee1dd151e4c5db64
2026-10-23 17:28:33 +00:00
Anthony Tafoya ea819e1f4d Record skill and plugin catalog sizes on publication (#56530)
## What changed

- Add `codex.skills.catalog.entries` and `codex.plugins.catalog.entries` histograms with `cloud` or `executor` stages and `complete`, `warning`, or `partial` status. Partial results take precedence over warnings.
- Exclude cached reads and repeated observations of unchanged failed skill discovery from metric samples.
- Mark executor skill catalogs partial when discovery fails, and clear unpublished executor plugin catalogs instead of publishing an empty result.

## Testing

Extend skill integration tests to check catalog counts and statuses, fresh discovery snapshots, partial discovery, and repeated reads without duplicate samples. Update plugin state tests to distinguish unpublished catalogs from empty discovery results.

GitOrigin-RevId: e25978ba9fce54e9660853b1d9673ddab6db5061
2026-10-23 17:17:50 +00:00
Andrei Eternal adca78ddae Remove the 1 MiB response limit for explicit model catalogs (#56525)
## What changed

Fetch catalogs configured with `model_catalog_url` without a response-body size limit, allowing responses larger than 1 MiB. Remove the oversized-response rejection test and update the catalog client documentation to drop the limit requirement.

GitOrigin-RevId: acd0dbbac5d548596b50faa309496de2db3588df
2026-10-23 16:56:38 +00:00
bkotsopoulos b82d542aef Add turn, tool, and skill attribution to traces (#56524)
## What changed

- Emit `codex.turn_profile` events with finalized sampling request and retry counts when turns complete or abort, and preserve the caller's tracing span for detached extension interrupts.
- Add conversation and turn identifiers to turn and tool dispatch spans, identify tool sources, and include dispatch-to-result-ready duration on tool completion events.
- Emit `codex.skill_read.source_selected` before cache or provider access, recording the selected cloud or executor source, skill and plugin identity, resource kind, and continuation status.

## Testing

Add regression coverage for trace correlation, tool completion timing, turn profile counters on completion and interruption, detached interrupt span propagation, and skill source attribution including cached cloud reads.

GitOrigin-RevId: db78aa270bbcb8dc9e4558d202c109ad54141811
2026-10-23 16:55:32 +00:00
Eric Traut 3985001067 Respect server approval policy defaults during TUI startup (#56516)
## Why

Fresh TUI sessions sent the locally resolved approval policy in `thread/start`, overriding the app server's configured default. Local constraints could also prevent the TUI from adopting the policy returned by the server.

## What changed

- Send explicit approval policy overrides at startup and otherwise let the server resolve the policy. Preserve the resolved-config behavior for selected profiles.
- Forward granular `approval_policy` overrides with their replacement and dotted-key merge semantics.
- Forward eligible projectless approval defaults only when allowed by the server's approval policy requirements.
- Accept the server's startup policy before submitting initial or queued input, including when local constraints would reject it.

## Testing

Extend startup tests to cover explicit override precedence, granular policy merging, projectless defaults, and use of the server's approval policy on the first turn.

GitOrigin-RevId: 995ce5f21b04b058d60c2ea80a139c0cf48c0e98
2026-10-23 16:18:43 +00:00
bkotsopoulos 810501d60d Add trace instrumentation for turn startup and response streaming (#56515)
## What changed

- Record time spent waiting for each stream event in `codex.response.receive_wait_ms` on the existing `handle_responses` span.
- Add trace spans for startup prewarm consumption, turn-start lifecycle callbacks, assistant text flushing, and response stream error handling.
- Include the turn ID and lifecycle phase on the turn-start span and the request type on the error-handling span.

GitOrigin-RevId: 7792508c830ef05b03aed01eb840ca7e6577ad0b
2026-10-23 16:09:06 +00:00
bkotsopoulos bca6f238cb Preserve tracing context throughout tool dispatch (#56514)
## Why

Tool readiness waits, execution-lock waits, and result-ready events occur outside the dispatch span. Tracing should cover the full spawned dispatch task while retaining caller context when TRACE spans are disabled.

## What changed

- Instrument the entire spawned task with the dispatch span, falling back to the current span when it is disabled.
- Add child spans for readiness waits and parallel or exclusive execution-lock waits.
- Record `turn_id` and `codex.tool.phase = "dispatch"` on the dispatch span.

## Testing

Add regression tests that dispatch an unknown tool through the spawned task and verify that `codex.tool_result_ready` retains caller context at both INFO and TRACE levels, with the dispatch span present only at TRACE.

GitOrigin-RevId: 18026750af58347c38a4c2752cdd6165d73a3eab
2026-10-23 16:07:55 +00:00
ioanbudea-OAI 1c0c45bfc3 Defer synchronous Guardian tool-call truncation to preparation (#56505)
## What changed

Preserve complete tool-call text when collecting synchronous Guardian context, then apply the profile's tool token limit when preparing the transcript. Calculate retained bytes and token usage from the truncated text.

## Testing

Extend the oversized-action regression test to verify that a subsequent review includes the previous call's arguments truncated to the 1,000-token history limit.

GitOrigin-RevId: 2b52505d9ccfa3651b3535e67cc12597be819459
2026-10-23 15:37:39 +00:00
felixxia-oai 2839ed763b Add paginated channel subscription queries to the local message board (#56495)
## What changed

Add `LocalAgentMessageBoard::subscribed_channels` to list the caller's subscribed channel names on the current board in name order, using the existing `PageRequest` limits and cursors.

## Testing

Extend the local board test to verify that a read-only connection can retrieve two subscribed channels across successive one-item pages, with no cursor after the final page.

GitOrigin-RevId: 63f2e3e7caad9638e5e0f4f38aaf722a590c5d7f
2026-10-23 15:00:06 +00:00
felixxia-oai 2f1cc59790 Add channel upserts to message boards (#56494)
## What changed

Add an `upsert_channel` API and selectable tool to create a channel or replace only its description. Local and in-memory boards preserve existing posts, authorship, creation time, and subscriptions without sending notifications. Updating an existing channel does not require the host clock.

Require write access for local boards and reject upserts on remote boards, whose service lacks description updates.

## Testing

Add coverage for both local and in-memory upserts, argument validation, mutation budgets, metadata preservation, and clock failures. Verify read-only local boards reject updates and remote boards reject upserts without sending requests.

GitOrigin-RevId: e667375a62784f2fbeeff72359b5b0fa476e061e
2026-10-23 14:59:40 +00:00
ioanbudea-OAI e52045f989 Move Guardian tool description preparation into context composition (#56493)
## What changed

Move `GuardianToolDescriptions` into `codex-guardian-context` and carry structured tool and connector descriptions in `PlannedAction` instead of pre-rendered text. Prepare them during synchronous context composition, escaping closing tags before applying the existing 400-token limit to each source and rendering the untrusted-description fragment.

Keep descriptions optional under the context budget and preserve the complete action JSON. Reject descriptions that reach rendering without preparation.

## Testing

Strengthen the MCP approval integration test to assert the exact rendered descriptions, including independent truncation and escaped closing markers. Adapt the budget enforcement test to use structured descriptions.

GitOrigin-RevId: 4a9f1855f2958758b4be711914c00e4d954cee39
2026-10-23 14:58:20 +00:00
bkotsopoulos de06fd0be4 Allow installed plugin metadata to skip display enrichment (#56483)
## Why

Runtime metadata and tool suggestions do not require resolved image URLs or creator names. Callers that need display enrichment must still be able to distinguish a complete display snapshot from one fetched without it.

## What changed

- Add `InstalledPluginDisplayAssets` to select whether installed plugin requests include display enrichment, preserving `Include` as the default.
- Send `includeDisplayAssets=false` on every request page when `Skip` is selected.
- Track display enrichment in the installed plugin cache. Allow tool suggestions to use snapshots without enrichment, while treating those snapshots as cache misses for display callers.
- Avoid invalidating effective runtime metadata when only the cache's display enrichment state changes.

## Testing

Add coverage for paginated requests without display enrichment, cache eligibility and enrichment state transitions, and discovery using snapshots fetched with or without display assets.

GitOrigin-RevId: 1fdfd6443a300a03753416f2f6c633b52a97d0fb
2026-10-23 14:15:03 +00:00
ioanbudea-OAI 7d592f6dd9 Move Guardian approval reason caps into context composition (#56477)
## What changed

Apply the 512-token approval reason cap in `guardian-context` when composing synchronous full and delta reviews, before request budget enforcement. Remove truncation from the requesting host and preserve exact action JSON.

## Testing

Extend the planned-action budget test to cover long approval reasons in both synchronous presentations, verifying that optional tool descriptions can be omitted without changing action arguments.

GitOrigin-RevId: 8cdb6aadd5f50194f63ebd2402193e69bed127cc
2026-10-23 13:32:34 +00:00
jif d4bdafd378 Preserve SystemRoot for Windows filesystem sandbox helpers (#56468)
## Why

MXC needs `SystemRoot` to create the sandboxed filesystem helper process.

## What changed

Allow `SystemRoot` through the Windows helper environment filter using case-insensitive matching.

## Testing

Extend the environment-filter test to cover mixed-case `SystemRoot` and the Windows sandbox write-policy test to verify that writes to an allowed directory succeed.

GitOrigin-RevId: 0979b0c83eff245ee380fae9d7cf05dcc739265f
2026-10-23 12:42:39 +00:00
jif b559e6a398 Add experimental thread memory summary reads (#56465)
## What changed

Add `thread/memory/read` to return `{summary}` for a thread that has been started or resumed. Read `memory_summary.md` from the thread's resolved memory version, honoring thread-specific configuration overrides without falling back to another version.

Return `null` when memory use is disabled or the selected summary is missing, unreadable, or blank.

## Testing

Extend app-server integration coverage to check explicit and automatic memory version selection, disabled memory use, and missing summaries without fallback.

GitOrigin-RevId: b218f31e379c69ccbacb444bb9d6ee920cd4882b
2026-10-23 12:35:58 +00:00
jif 90894a780d Prevent memory imports from racing with consolidation (#56462)
## Why

Concurrent imports and consolidation can modify the same memory workspace, leaving a partial import across memory versions or interfering with consolidation snapshots and baselines.

## What changed

- Add a cross-process workspace lock shared by memory imports and consolidation.
- Acquire locks for every import destination before modifying any workspace. Return a retryable busy error if a destination is locked, and skip consolidation when its workspace is busy.
- Hold locks through import completion even if the caller drops the future, and through consolidation agent termination and baseline finalization.

## Testing

Add an app-server integration test that blocks an active consolidation, verifies import rejection without partial writes or snapshot changes, then retries successfully and confirms imported resources remain visible to the next consolidation.

GitOrigin-RevId: c4ce945f916dcb4d75a3190ea869751fac51de83
2026-10-23 12:23:10 +00:00
felixxia-oai b719a7fb7f Add silent append support to message boards (#56461)
## Why

Recording evidence on a message board needs a write operation that does not automatically subscribe the author or notify existing subscribers.

## What changed

- Add `AppendRequest` and `AgentMessageBoard::append` for local and in-memory boards, supporting new channels, existing channels, and thread replies without subscription or notification side effects.
- Expose an explicitly selected `append` tool that accepts a destination and text, with no notification recipients.
- Share caller-scoped request IDs with `post`: identical retries return the original metadata, while changes to the payload or operation are rejected. Local appends retain write permission checks and durable storage.
- Reject remote appends as unsupported without issuing an HTTP request.

## Testing

Add coverage for silent writes on both supported backends, tool argument validation and retry conflicts, local read-only access and retries after reopening storage, and remote rejection without network requests.

GitOrigin-RevId: 01fb9d3e2cfcb3de362b28f2bf2ee83bafada80d
2026-10-23 12:18:18 +00:00
felixxia-oai bca6cff1e1 Add Guardian v3 local board helpers (#56460)
## What changed

Add the `codex-guardian-v3` crate to the Cargo workspace with a Bazel target. Expose helpers to configure the `guardian` storage namespace and construct a `LocalBoard` for the owning main thread's session ID.

GitOrigin-RevId: 3314711475a7024380a3f0beb8f5ddfc4ff19723
2026-10-23 12:17:53 +00:00
felixxia-oai f71c6afc30 Add Guardian V3 feature configuration (#56459)
## What changed

Register `guardianv3` as an under-development feature disabled by default. Accept either a boolean toggle or a table with an optional `enabled` field, and include both forms in the configuration schema.

## Testing

Add coverage for boolean and table configuration, default behavior, and profile overrides, including inheritance when a profile omits `enabled`.

GitOrigin-RevId: 75333be61b2e336e22fef907d6363b70f9f7225b
2026-10-23 12:16:36 +00:00
felixxia-oai d8acdf1515 Make sandbox mount cleanup tests tolerate file descriptor reuse (#56454)
## Why

Concurrent tests can reuse a closed file descriptor number, causing cleanup assertions that require `EBADF` to fail even when the inherited directory descriptor was closed.

## What changed

Capture the inherited directory's device and inode before mount verification. Check `/proc/self/fd` afterward and accept either a missing descriptor or one referring to a different inode, while still rejecting a leaked descriptor to the original directory. Apply this check to successful verification and rejected mount markers.

GitOrigin-RevId: 42ff3aebcee9c37c481772f8a425a8643708c426
2026-10-23 12:08:11 +00:00
felixxia-oai 2130b56710 Make the Realtime V2 background-agent steering test deterministic (#56453)
## Why

The steering test needs to deliver guidance after the first Responses request starts and ensure it is routed before releasing the blocked response. A steering acknowledgement alone does not establish that routing has completed.

## What changed

Wait for the first request before triggering the scripted steering call with an audio frame, then wait for its `handoff_request` notification before unblocking the response. Assert that the steering text is absent from the first Responses request and present in the second.

GitOrigin-RevId: d62f9785624e92774a45857923dab2b903854aea
2026-10-23 12:07:00 +00:00
Charlie Marsh 60adfa8513 Treat model-not-found provider errors as terminal failures (#56445)
## Why

Provider errors with code `model_not_found` should end the turn immediately and preserve the provider's message instead of triggering retries.

## What changed

- Recognize `model_not_found` in HTTP 400, 403, and 404 responses and in streamed `error` and `response.failed` events.
- Preserve the provider message and any available HTTP status, and expose `modelNotFound` through the app-server protocol and generated schemas and SDK types.

## Testing

Add coverage for HTTP classification, statusless stream errors, and terminal failures without retries across HTTP, SSE, and WebSocket responses. Verify that `thread/read` preserves the error reported by the live notification.

GitOrigin-RevId: 88f824ac03c8c9669915b1e40c67b76c08326fbe
2026-10-23 11:43:14 +00:00
felixxia-oai ca9d103f39 Update ctutils from 0.4.2 to 0.4.5 (#56439)
GitOrigin-RevId: 980ecd5dbda4dd03ca40021066adac3664be1312
2026-10-23 11:15:53 +00:00
jif e6ebdfe00b Support memory v2 in external-agent memory imports (#56414)
## Why

External-agent memory imports previously wrote only to the v1 workspace and queued only v1 consolidation, leaving the v2 pipeline without imported resources.

## What changed

- Always import selected resources into `memories_v2`. Also update `memories` when v1 is selected or a legacy workspace exists.
- Read `memories.version` for detection and import, detect pending changes across the applicable namespaces, and enqueue consolidation separately for each updated namespace.
- Combine project results across namespaces so cleanup in either can succeed while failures in either are reported.
- Adapt imported-memory consolidation instructions to the active pipeline's output format.

## Testing

Expand app-server integration coverage for v2 profiles, explicit v1 selection, default profiles, and existing legacy workspaces. Verify resource copies, consolidation queues, repeat detection, and cleanup of deleted or unscoped projects.

GitOrigin-RevId: 7e9206942d63fd55b7f2a7f5f9210b687da6a973
2026-10-23 09:06:13 +00:00
Vivian Fang d6817454d7 Make the Guardian review timeout configurable (#56371)
## What changed

Add `auto_review.timeout_ms` to configure the overall Guardian review budget, including setup and retries. Keep the default at 90,000 milliseconds; setting it to `0` disables the review deadline while preserving cancellation, retry attempt limits, and independent transport timeouts.

Carry the configured deadline through review execution and report the configured budget in review telemetry, using zero for unlimited reviews.

## Testing

Add coverage for shared setup budgets, configured timeouts, cancellation with unlimited reviews, and retry attempt limits without a deadline.

GitOrigin-RevId: 00404e0cb2f2cfaf6de183d6e27f5e4a371942a8
2026-10-23 06:34:00 +00:00
Keyan Zhang a96fa4f220 Allow callers to set the thread source for sampling (#56364)
## What changed

Add optional `threadSource` to `thread/sample` requests and apply it to the ephemeral fork. Keep `thread_sample` as the default when omitted.

## Testing

Extend sampling tests to assert that turn metadata includes the supplied thread source and retains the default when no source is provided.

GitOrigin-RevId: 8ea941c932267e3bcb9e6b086764ac2795d6edef
2026-10-23 06:07:10 +00:00
Brent Traut 30587d7885 Add experimental attached thread forks (#56351)
## What changed

- Add `attachToSource` to `thread/fork` to persist a fork attached to its source without emitting `thread/started`. Attached forks require local storage and cannot use `ephemeral` or `deferGoalContinuation`.
- Hide attached threads from ordinary listings and add `attachedToThreadId` to `thread/list` for explicit discovery, including empty threads. Keep this relationship separate from spawned-agent parent and ancestor filters.
- Persist attachment metadata in rollouts and SQLite so it survives restarts and database recovery. Reject source deletion until its attached threads are deleted.

## Testing

Add coverage for legacy and paginated history, restart and missing or corrupt database recovery, filtered listings and pagination, resume, conflicting options, and deletion safeguards across store instances.

GitOrigin-RevId: 589f3174fc36f6054e75d65818360695645a5913
2026-10-23 04:52:47 +00:00
andrewgu-oai 4610b573e5 Run environment hooks on their owning executors (#56343)
## What changed

- Include ready environments' configured hooks in lifecycle events and execute command hooks using each owner's shell, working directory, shell environment policy, and managed network policy.
- Resolve tool environments before `PreToolUse` and use those targets for tool hooks, execution, and permission review. Route MCP hooks by server ownership and file-copy hooks to both endpoints.
- Preserve environment, MCP server, and terminal session selectors across hook input rewrites, rejecting attempts to switch targets.

## Testing

Add regression coverage for permission-request selector preservation, MCP resource hook ownership, and file-copy hooks that rewrite paths while preserving source and target environments.

GitOrigin-RevId: 31a3a6830523965285dab451cfc866c620ef6c83
2026-10-23 04:01:39 +00:00
cassirer-openai e5ea2ed50b Match rollout trace image content across request snapshots (#56342)
## Why

Repeated image outputs in different request payloads could fail replay with a call ID reuse error even when their content was unchanged.

## What changed

- Hash canonical JSON for non-text content parts and compare their `content_sha256` values independently of payload location.
- Preserve empty content arrays as empty bodies so they also match across snapshots.

## Testing

Add a regression test verifying that repeated image and empty tool outputs reuse conversation items, while changed image content with the same call and item IDs still fails replay.

GitOrigin-RevId: 07699312675764079f679fd2c12ba6679332d709
2026-10-23 03:39:48 +00:00
alishobeiri-oai 8531184b49 Make agent-message wakes respect interrupts and Plan mode (#56330)
## Why

A pending agent-message wake can outlive an interrupt or a switch to Plan mode while model discovery is waiting. It must recheck whether it can start before consuming queued messages.

## What changed

- Revalidate reserved wakes after discovery and build the turn with the configuration selected during admission.
- Mark interrupted wake reservations as stopped so later agent messages cannot restart automatic work, while preserving queued messages for explicit turns.
- Keep finishing turns marked as running until completion is persisted, protecting their rollout writer from capacity eviction.

## Testing

Add regression tests for interrupts and Plan-mode changes during discovery, queued-message preservation, explicit follow-ups with `wake_on_agent_messages` disabled, and completion status and persistence with the feature enabled and disabled.

GitOrigin-RevId: afe1d57063a5ec491e8b16d6c62135caa69c0a3c
2026-10-23 02:21:49 +00:00
smurching-oai f3a90545ae Add managed configuration loaders for custom config servers (#56314)
## What changed

- Add loaders that select `config_server` when configured and otherwise use the existing ChatGPT bundle source. Fetch custom bundles from `<base_url>/codex/config/bundle` without redirects or request logging.
- Support optional OAuth sessions without interactive login during bundle fetches, recover credentials after a `401`, and scope cached bundles to the endpoint and authorization identity.
- Restrict bootstrap network access to configuration and OAuth endpoints using local administrator rules when available.
- Return generic bundle validation errors so invalid TOML, requirements, and provider settings do not expose configuration contents.

## Testing

Add tests for missing configuration-server sign-in, replacement OAuth credentials, endpoint-specific cache reuse, and validation errors that omit sensitive values while preserving cached bundles.

GitOrigin-RevId: 56590a9e66340540666ca21590bef46c495e0e33
2026-10-23 00:54:06 +00:00
rhan-oai e103bbc06f Apply model catalog overrides to history, notes, and context tools (#56313)
## What changed

- Read optional tool descriptions and parameter schemas for `history`, `notes`, `new_context`, and `get_context_remaining` from the acting model's catalog messages.
- Support catalog namespace descriptions for history and notes, preserving explicit empty and whitespace descriptions.
- Share catalog override handling across native tools and MCP resource helpers. Keep bundled schemas when overrides are invalid, preserve encrypted parameters, and leave tool identity and transport fields unchanged.

## Testing

Add coverage for sparse catalog serialization, schema fallback and encryption preservation, per-step tool definitions, and context tool updates when switching models. Extend outgoing-request tests to verify history and notes overrides while retaining history image attachments.

GitOrigin-RevId: 1adac8b5009f95c91adba491f20a4e2e2dc91475
2026-10-23 00:46:28 +00:00
cassirer-openai 5b792948f9 Track accepted conversation history in rollout traces (#56312)
## Why

Model output alone does not establish that an item entered conversation history. Treating every response item as accepted can include discarded attempts, while relying on a later request misses accepted final output when a turn ends or is interrupted.

## What changed

- Record `HistoryItemAccepted` events and retain Responses item IDs, generating missing IDs consistently across item events.
- Build thread conversation history from request inputs, compaction checkpoints, and explicit acceptance. Keep unaccepted output accessible through its inference call.
- Preserve inference provenance across retries and late response records without overwriting newer request or compaction snapshots.
- Mark turns with errors as failed. Bump trace schemas to version 2 and reject incompatible bundles and event schemas during replay.

## Testing

Add reducer coverage for discarded attempts with identical text, late responses, compaction, inherited context, and legacy bundle rejection. Add CLI integration tests that run `debug trace-reduce` after success, stream failure, and interruption followed by shutdown, including responses without provider item IDs.

GitOrigin-RevId: 8e387a91d9b3f704df82847d630e6f0b08f998b3
2026-10-23 00:45:20 +00:00
goodman-oai 878070b5a6 Support model-specific writable-root permission wording (#56309)
## What changed

Add optional `writable_root` and `writable_roots` templates to model-catalog permission messages. Select the template by the number of displayed roots and substitute exactly one `{{ roots }}` placeholder with the existing formatted path list.

Fall back to the bundled sentence for missing, empty, invalid, or oversized templates. Preserve path contents, permission-path limits, and denied-read instructions. Update the permission wording when the selected model changes.

## Testing

Add coverage for template validation and size limits, singular/plural selection after path truncation, path preservation, sparse serialization, and model switches that append changed permissions once while preserving request history.

GitOrigin-RevId: 4dcfb7ff70b91db3dba3dda684b355b920e07974
2026-10-23 00:40:04 +00:00
Benjamin Carlsson 334527705c Separate directory and repository scopes in the TUI (#56308)
## Why

The `Cwd` session filter included sessions from linked worktrees, leaving no way to restrict the picker to the current directory. Project grouping also combined tasks across linked worktrees.

## What changed

- Keep `Cwd` filtering and directory-scoped `resume --last` and `fork --last` lookups limited to the current directory.
- Add an explicit `Repo` picker filter when multiple local worktrees are available, including sessions from corresponding directories across linked worktrees. Cycle between `Cwd`, `Repo`, and `All` in either direction.
- Add `Directory` grouping to the agent command center alongside `Project`, `Status`, and `Model`. Keep this choice in memory without writing a configuration value older clients cannot read.

## Testing

Extend coverage for directory and repository filtering, pagination scope, linked-worktree grouping, directory aliases, grouping persistence, and adjacent selection after task removal. Update picker and command center snapshots.

GitOrigin-RevId: 59603c9c5136db43124102b3277d1d1dab36bb87
2026-10-23 00:29:14 +00:00
andrewgu-oai 75a4146411 Add support for environment-scoped managed hooks (#56304)
## What changed

- Add discovery and listing APIs for environment-owned required hooks, with command and MCP execution routed to the owning environment.
- Use each environment's working directory in hook input, withhold controller transcript paths, and prevent environment hooks from granting permission requests.
- Resolve `command_windows` against the environment's platform and, when hooks are enabled, reject unloadable required hooks before accepting environment configurations at startup or readiness.

## Testing

Add regression coverage for invalid managed hook matchers at startup and readiness, successful readiness after correction, and per-hook working directory and transcript path scoping for `SubagentStop`.

GitOrigin-RevId: 1ac0ab3778ba608c72e5917fcbaebcc1d454887f
2026-10-23 00:09:23 +00:00
andrewgu-oai 7a5860da35 Add hook configuration to environment attachments (#56302)
## What changed

- Add `environment_hooks` to `EnvironmentConfig` for hooks from an environment's effective managed requirements. Initialize it empty for inferred thread configurations and report the handler count in debug output.
- Move `HookEventsToml`, `MatcherGroup`, and `HookHandlerConfig` into `codex_protocol::hooks`, with re-exports from `codex_config::hook_config`.
- Validate MCP hook input recursively to reject nulls and integers outside the signed 64-bit range without converting through `toml::Value`.

GitOrigin-RevId: 410506c8e2b89c9519c81d86b44ccd760d751693
2026-10-23 00:02:29 +00:00
viyatb-oai dc4844c907 Add TLS forwarding tests for MITM SigV4 requests (#56301)
## What changed

Add a test-only MITM CA constructor and local TLS origin fixtures to exercise AWS SigV4 forwarding:

- Check `aoss` payload hashes and credential replacement for GET and POST requests, while preserving unsigned requests and requests using another access key.
- Verify rejection of unsupported HTTP/1.1 framing and signing headers, and check the forwarded body, payload hash, and signed header presence at an HTTP/2 origin.
- Verify that draining signed request bodies releases buffering capacity before response headers arrive, allowing a ninth request to complete while eight responses remain pending.

GitOrigin-RevId: 4da0a77baace31486e77ad97d9581ec9f51bb34e
2026-10-23 00:01:18 +00:00
viyatb-oai e4deed3981 Mark built-in dummy credentials and strengthen collision checks (#56297)
## What changed

- Add `masked` after the provider prefix in built-in dummy credentials, followed by at least 22 random alphanumeric characters. Stop copying punctuation from the real credential.
- Check built-in dummy candidates against observed credential owners and discoverable configured-provider aliases, and reject overlaps with existing dummy credentials. Allow configured patterns to match a built-in dummy's format when no credential identity collides.

## Testing

Extend regression coverage for short and opaque credentials, fresh dummy values, known and late credential collisions, alias discovery, header injection, and text restoration. Verify that explicit authorization values remain unchanged even when they resemble masked credentials.

GitOrigin-RevId: 5080176f3ecbcdbb18943eab30136e15a4a3985e
2026-10-22 23:48:20 +00:00
smurching-oai 5a1c247dd5 Decouple managed configuration loading from ChatGPT authentication (#56295)
## What changed

Introduce a `BundleSource` interface for authentication, cache identity, bundle fetching, and unauthorized-request recovery. Move ChatGPT plan eligibility and credential recovery into `ChatGptSource`, while keeping validation, caching, and retry orchestration in the shared service.

Support source-specific cache namespaces while preserving the existing ChatGPT cache location. Retain one authentication recovery context across all retries of a bundle fetch.

## Testing

Extend the external authentication test to verify that recovery happens only once per bundle fetch, including when an intervening request failure triggers a retry.

GitOrigin-RevId: f5009f72dc4479f96d4ed1da9232f250988444a5
2026-10-22 23:38:09 +00:00