## What changed
Add `ThreadManager::with_child_thread_id_generator` so callers can
allocate a local child's thread ID using its parent's ID before the
spawn edge is saved. Use the regular thread ID generator when there is
no parent or no child-specific generator.
## Testing
Update the spawn publication tests to check that the callback receives
the parent ID and to force a collision by returning that ID, verifying
that the existing thread and graph are preserved.
GitOrigin-RevId: a074d5872b576e0464cd9c29ee67128767098ee2
## Why
Broad error categories make it hard to distinguish a model missing from
the accessible catalog, an unsupported request value, and a route rate
limit from other failures in the same categories.
## What changed
Carry three structured provider subreasons through `CodexErr` and record
them in `codex_error_subreason` only when they match the turn's terminal
failure.
- `model_not_in_accessible_catalog` for a matching HTTP 400 model-not-found error.
- `unsupported_value` for an HTTP 400 invalid-request error with that code.
- `route_rate_limit_exceeded` for a route-specific HTTP 429 that exhausts retries.
## Testing
Cover subreason mapping, including wrapped WebSocket invalid requests,
and verify that turn analytics omit subreasons for successful turns and
mismatched terminal errors. Exercise recovery from a route-specific
HTTP 429 using `Retry-After`.
GitOrigin-RevId: 02d82082334e775020850e1a52ba7baff401cff1
## What changed
Add the boolean `allow_local` requirement. Apply the `true` default
after merging requirements layers, and show explicit values with their
source in the TUI config diagnostics.
Report the effective value as `requirements.allowLocal` in
`configRequirements/read` and update the protocol schemas and generated
client types. Clients should assume `true` when there are no managed
requirements or an older server omits the field. A value of `false`
is informational at this stage.
## Testing
Cover layer precedence, source tracking, rejection of non-boolean values,
RPC responses for explicit and omitted settings, and decoding responses
from older servers.
GitOrigin-RevId: 6cd400cacdf8981e0cabad642019c634549e0074
## Why
An MCP tool approval remembered for a live session is lost when the
conversation resumes in a new session, so the user can be prompted again
for the same tool and linked account.
## What changed
Let hosts attach an `McpToolApprovalStore` to a persistent thread to save
and reuse eligible approvals for host-owned app tools. Each grant is
bound to the authenticated member, thread, and exact tool registration,
including its plugin, connector, and account link.
Reuse a grant only after permission hooks and reviewer policy have run,
and revalidate it before handing off the call. If saving a new grant
fails, stop the call before handoff.
## Testing
Add coverage for approval reuse after resume and compaction, isolation
across forks and member changes, hook and reviewer enforcement, and
failed saves.
GitOrigin-RevId: fd022c19e94e9ceafa97b1dd71478e05c477c36d
## Why
When an MCP refresh waits for host setup to finish before reading the
remote executor's MCP configuration, a capability cache miss can make
the two remote reads run back to back.
## What changed
Run host MCP setup alongside remote MCP server discovery. Start the
remote read during host setup and keep its timeout gated on host
completion. Carry the ready capability roots from host setup into the
published runtime.
## Testing
Extend the V1 and V2 overlap tests to hold replies until both requests
are in flight, then verify that the turn can call a tool from the newly
discovered MCP server and receive its result.
GitOrigin-RevId: 729eb6a85e8a8ce6e2549251de9873a0b064d9a7
## Why
When a turn wakes after a planned sleep, a synthetic `<turn_aborted>`
message makes the previous turn look interrupted to the model.
## What changed
Skip the model-facing marker for `InterruptIfNoPendingInput`. Continue
flushing the rollout before emitting `TurnAborted` so clients can read
the latest history when they receive the event.
## Testing
Extend the abort lifecycle test to check that the wake-up request
contains the prior agent message and omits the `<turn_aborted>` marker.
GitOrigin-RevId: fd5deb7f926551fa15edd4bab7d83c81842e4270
## Why
A transient failure during an approval review could discard the attached
reviewer session and lose context the reviewer had already gathered.
## What changed
Use the Guardian retry policy when finishing an attached review. Honor
the review's session disposition for retryable failures and force
discard for non-retryable errors.
## Testing
Extend the prewarmed root reviewer test to simulate a server overload
after the reviewer subscribes to a channel. Verify that the retry
reconnects with the same reviewer thread ID and carries forward the
subscription result.
GitOrigin-RevId: 5a538e872f71714fee9bbd97ed775969a6893154
## Why
Guardian uses native collaboration calls to identify which root-thread
context is relevant to a subagent. When an MCP server supplies those tools,
Guardian needs the server's registration to distinguish a handoff from an
unrelated call with the same name.
## What changed
Let the host opt in to handoff tracking for one local MCP plugin or extension
registration. Match the server name, source, and transport against the tool
registration used for routing. Persist the recipient of a matching direct
`spawn_agent`, `send_message`, or `followup_task` proposal so Guardian can
apply the handoff boundary when selecting context for that subagent.
Record a classification without a recipient for lookalike calls when needed
to prevent fallback to native name matching.
## Testing
Cover context filtering for the selected extension, calls without host
opt-in, and a configured MCP server using the native collaboration namespace.
GitOrigin-RevId: 40471f3cdfde88832c27c3a466e36723e42515d2
## Why
When a fresh async review already reaches the soft reset limit, adding
evidence can trigger another rebuild that replays the same large transcript
on every check.
## What changed
If a fresh review reports usage at or above
`async_classifier_conversation_token_limit`, allow projected input to grow
up to 20,000 tokens beyond that first report. Use the latest reported usage
to estimate each continuation while keeping the ceiling anchored to the
fresh review. The model's input limit still applies.
For this extra allowance, rebuild when reported usage is missing or the
next request would truncate elastic context or omit whole transcript
entries from the fixed window. A fresh review with elastic truncation
cannot start the allowance.
## Testing
Extend coverage for reuse across multiple reviews, resets at the growth
ceiling and model input limit, missing usage, and transcript evidence
recovered by rebuilding.
GitOrigin-RevId: 4c5c69a898b83e051241b06c324773a0b9e46ede
## Why
Codex skipped hooks in the Agent Plugin format even when the root
`plugin.json` explicitly declared them.
## What changed
- Discover hooks through the root manifest's `extensions.com.openai.hooks`
declaration. File declarations must point to regular files inside the
bundle without traversing symlinks.
- Apply the existing hook approval flow and give Agent Plugin hooks the same
isolated `PLUGIN_DATA` directory as the plugin's stdio MCP servers.
- Include declared hooks in plugin details and capability detection without
requiring a writable data directory. For remote catalog entries,
`plugin/read` gets hook summaries from the matching installed bundle.
## Testing
Cover invalid hook paths and runtime data directory failures, verify that an
approved `PreToolUse` hook writes to isolated plugin data, and check remote
plugin reads with matching, different, and absent local bundles.
GitOrigin-RevId: 86311780865f7c598db22d873e88be2699750b75
## Why
A steer request can arrive in a separate trace from the turn it updates. Recording the turn ID on the input span leaves the relationship implicit in OpenTelemetry.
## What changed
Capture the context of `session_task.turn` when the task starts. When the active turn accepts steering input, add an OpenTelemetry link from the request's `op.dispatch.turn_input` span to the task span. The link is visible even when trace-level input spans are disabled.
## Testing
Extend the turn tracing integration test to check that both steering entry points link to the active task and that initial submissions and stale steer requests emit no link.
GitOrigin-RevId: 1daecd06d8db8a80c8112dff5c65a58142bda4d6
## Why
Failed-review reports can include the reviewed thread's history, but they
don't show how much evidence the reviewer lost to input limits. That
makes it harder to tell whether missing context contributed to a denial.
## What changed
Add a `truncated` field to opt-in failed-review reports. It reports
bytes removed from the initial review input by evidence section,
distinguishing per-item caps from cuts made to fit the overall budget.
Carry those totals with the selected response through reconsideration,
including when the original denial is restored.
## Testing
Check that a denied review's report includes transcript bytes removed
by a per-item cap. Cover rendered JSON byte counts, deduplicated
instructions, and eviction of an already-capped tool result.
GitOrigin-RevId: 817ca54ca27969e52cac50f7ff93816c773fcc15
## Why
The requesting thread's rollout lacks per-response token usage for
Guardian work, including requests that consume tokens without producing
a usable result.
## What changed
Persist reported token usage from Guardian reviews, background review
compaction, and classifier requests in the requesting thread's rollout.
Each record identifies the requesting turn, response, and model, and
marks incomplete responses that report usage. These records stay
separate from the thread's cumulative token totals and are excluded from
forked history.
## Testing
Cover review attribution and unchanged parent token totals, compaction
that reports usage without a usable summary, and thread shutdown waiting
for an interrupted classifier's usage write.
GitOrigin-RevId: da5d3711cdb7c7aeab829d3537ef59b724c57171
## Why
V1 tools could use a thread ID to reach agents in another session. A
thread ID can also resolve to a different runtime after a thread is
unloaded and reloaded.
## What changed
- Check session ownership before sending input, interrupting, waiting on,
closing, or resuming a V1 agent. Keep live operations bound to the
runtime that passed the check.
- Check ownership in saved rollouts before resuming agents and their
descendants. Follow the recorded parent chain for legacy rollouts that
lack a session ID. Release the agent slot when closing a known ephemeral
agent that has already been unloaded.
- Preserve failed `wait` calls in thread history and show the failure in
the TUI without listing rejected targets as completed agents.
## Testing
Add regression coverage for cross-session input, close, and resume
requests, slot reuse after closing an unloaded ephemeral agent, legacy
session recovery, and failed wait history and display.
GitOrigin-RevId: 4712a53315d24d5658d746ed277738e00a4e2dac
## Why
A turn can contain multiple Guardian reviews, and denial reconsideration
can produce multiple responses for one review. Thread and turn IDs alone
cannot identify which review and provider response produced the recorded
decision.
## What changed
Add `review_id`, `reviewer_request_id`, and `reviewer_response_id` to opt-in
Guardian failure reports when available. Keep the provider IDs with the
selected decision, including the original denial when reconsideration
fails and falls back to it.
## Testing
Extend tests to check the recorded IDs for initial and
reconsidered denials and verify that an invalid retry preserves the
original denial's IDs.
GitOrigin-RevId: 4bd906bfb9a80808cb3c2a8ac71c5354d4caad1f
## Why
When a test spans midnight, the environment date can change between turns
and alter the request history.
## What changed
Use a shared fixed clock for the catalog permission-path model-switch
and repository skill grant history tests. The clock keeps the environment
date stable with time reminders disabled.
GitOrigin-RevId: 7c3ad23547cd9126c6115aeeea6806b32c04dd69
## Why
When a Node REPL-backed MCP tool requests approval through an elicitation
callback, the trace loses the parent-child relationship between the callback
and the Guardian review.
## What changed
Parent the Guardian review span to the callback span when its
`traceparent` is well formed and its trace ID matches the active tool
invocation. Preserve the invocation's sampling flags and `tracestate`,
and strip both trace fields from the elicitation metadata before it
reaches approval handling or user prompts.
## Testing
Cover callback span parenting and trace propagation to Guardian inference,
including rejection of unrelated trace IDs and malformed headers. Verify
that form and URL prompts retain other metadata while dropping trace fields.
GitOrigin-RevId: 942b61a0da81b5d549c9f4813b28101bba622a26
## What changed
When `approvals_reviewer` is unset, default to `auto_review` for sessions using the OpenAI model provider with `guardian_approval` enabled, effective workspace-write permissions, and an effective approval policy of `on-request` or `granular`. Otherwise default to `user`. Explicit reviewer settings still take precedence over the default, subject to configuration requirements.
When the TUI starts a replacement session on a remote app server, use the server's configured reviewer if the client has no explicit reviewer setting. Update the configuration and app-server schemas to document the new default.
## Testing
Cover reviewer eligibility and managed requirements in configuration tests, manual overrides and empty workspace roots in app-server thread-start tests, and remote reviewer precedence in the TUI replacement-session test.
GitOrigin-RevId: fd05687accddb8a3ab99df0486b93f3f595fef65
## Why
Mixed Code Mode can call MCP tools excluded from both direct and deferred
exposure, but the `exec` description omitted their signatures and server
instructions.
## What changed
Include exec-only tool declarations, shared MCP types, and namespace
instructions in the mixed-mode `exec` description. Cap this material at
64,000 bytes and point to `ALL_TOOLS` for declarations that do not fit.
Tools exposed directly continue to carry their own declarations.
## Testing
Extend integration coverage to verify that both Code Mode variants can
call MCP tools excluded from direct and deferred exposure. The mixed-mode
case checks that an oversized namespace is omitted from the description,
its tools remain callable through `ALL_TOOLS`, and a smaller namespace
still shows signatures and server instructions.
GitOrigin-RevId: 6ad4e68d85f6b2dfdafb8ccd55755d80651c0b6c
## Why
When an environment detaches after a session resumes, the context update
needs to mark it unavailable under the same ID the model saw earlier.
## What changed
Render environment entries with session-scoped aliases such as `env731`
when a mapping is supplied. Save the aliases and naming mode in snapshots
so removal updates can use the recorded names and the naming mode survives
when the last environment detaches. Keep registered IDs as snapshot keys
for compatibility with existing rollouts. The session still renders
registered names.
## Testing
Add regression tests for removing the last aliased environment after resume
and refreshing the context when a saved snapshot has inconsistent IDs.
GitOrigin-RevId: 730fe3d366a9e0bc3e5eb9c6139051901c4f5f96
## Why
On wide terminals, the transcript and prompt box can span more columns than
users want for comfortable reading and editing.
## What changed
Set `tui.max_conversation_width` in `config.toml` to cap the transcript and
prompt box in fullscreen and inline modes, including the startup composer.
```toml
[tui]
max_conversation_width = 80
```
The setting accepts values from 20 to 65,535 terminal columns. When unset,
the conversation uses the available width. Raw inline scrollback keeps native
terminal wrapping, and wrapped links in formatted history and command previews
retain their full destinations.
## Testing
Add regression coverage for config validation, startup and live layouts,
inline history reflow after a config reload, and links that wrap across rows.
GitOrigin-RevId: 91e1856776986fee3b540247c3fbfe5f083b297f
## Why
Clients need to show the spend and cap for the account behind a thread's
model provider. The existing ChatGPT usage read cannot provide those
figures for a gateway account.
## What changed
- Route `account/rateLimits/read` through the provider's configured
`usage_url` using the provider's credentials. An optional `threadId`
selects a loaded thread's provider for the account-wide read. Omitting it
selects the default provider.
- Return `usageUnavailable` for a thread whose provider has neither a
usage endpoint nor first-party authentication. Surface gateway errors
without falling back to ChatGPT usage.
- Report monthly gateway spend in `individualLimit` as exact USD decimal
strings, with `limit: "unlimited"` for uncapped accounts. Use
`spendControlReached` for the gateway's cap status. Spend snapshots
identify their unit as `usd` or `credit`, with omitted units defaulting
to `credit` for compatibility.
## Testing
Add integration coverage for thread-specific provider selection, gateway
usage taking precedence over ChatGPT without fallback, and reuse of an
existing gateway OAuth session without interactive login.
GitOrigin-RevId: e6ec9d83eecc3084fcc98e72e2c031bd3e53a2cd
## What changed
Set `use_responses_lite` for all `global.` and `us.` model profiles in the Bedrock Runtime catalog.
## Testing
Update the catalog test to require Responses Lite for every Runtime profile. Update the request test to check that the selected model ID is preserved, the Responses Lite header is sent, and `additional_tools` declares `functions.exec` while omitting `web_search`.
GitOrigin-RevId: 7bd3d793f6365d4bffdf51528eeb3dac0d441aba
## Why
The Bedrock catalog cleared the bundled tool mode, so models configured
for Code Mode did not get that default on Bedrock. Runtime inference
profiles also discarded the base model's tool search capability.
## What changed
- Inherit the bundled tool mode on standard Bedrock endpoints. Leave
the mode unset for GPT-5.5 and GovCloud Mantle so Code Mode settings
determine tool exposure there.
- Inherit model-level tool search support in global and US cross-region
Runtime inference profiles.
- Keep full Responses requests so Mantle can expose cached web search
alongside Code Mode.
## Testing
Add coverage for Runtime profile capability inheritance and GovCloud
Mantle defaults. Verify that GPT-5.6 Sol on Mantle sends both
`functions.exec` and the text-only cached web search tool.
GitOrigin-RevId: dca35b5ca08321b5a906b442dbcbdec648ffdcea
## What changed
Add `x-codex-installation-id` to Responses API HTTP requests and WebSocket
handshakes when an authorization header is attached and the destination is
a trusted OpenAI endpoint. Use the persisted installation ID already sent in
`client_metadata` and mark the header value as sensitive.
## Testing
Cover header delivery over WebSocket and HTTP, retention across a trusted
redirect, and omission for unauthenticated requests and third-party endpoints.
GitOrigin-RevId: 3fa83816cc91584944d6023680ba0dd05fbca138
## What changed
Add an optional `usage_url` to model provider configuration and carry it
through remote thread configuration. Expose `read_provider_usage` to
fetch the current user's monthly USD spend, optional cap and percentage
used, and reset time.
Use the provider's own credentials for the request. Reject redirects,
disable interactive gateway login, and enforce same-origin validation
for gateway OAuth configurations that require it.
## Testing
Cover capped and uncapped spend, percentage rounding, and malformed
responses. Verify usage URL validation and remote configuration
round-tripping.
GitOrigin-RevId: ed805a756aab6e55c24751f0285bfe73b9091f07
## Why
A background Git scan can finish during WebSocket connection setup.
The generation frame previously used the earlier metadata snapshot,
so it could omit Git status that was already available when it was sent.
## What changed
Pick up same-turn Git results before building the generation frame,
without waiting for the scan. Handshake headers and prewarm frames use
the initial snapshot. Keep the earlier workspace snapshot if the refresh
would exceed the metadata size limit where the earlier one fit, or
displace a Git remote URL that would otherwise fit.
## Testing
Add regression coverage for Git status arriving during the handshake,
which request kinds can refresh, and remote URL retention at the
metadata size boundary.
GitOrigin-RevId: 942eeb8d5ee16756803ce3a5021d186a47fb9f0c
## Why
A prediction fork that disables MCP inherits the parent's tool declarations,
but recomputing the deferred tool list can append a conflicting declaration
to the request.
## What changed
Skip the deferred tool list update when the fork preserves the parent's tool
declarations. The fork still reports MCP tool unavailability separately.
## Testing
Extend `prediction_fork_keeps_inherited_tools` to cover both inline and
deferred MCP tools and assert that the fork carries exactly the parent's
`<tools>` messages.
GitOrigin-RevId: 04b4a542e0d587a20706935e8b028b7f1fdb9209
## What changed
Pair each registered executor ID with a model-facing alias assigned on
first use by the session's model ID store. Turn environment snapshots
can resolve these pairs in selection order, including for executors
that are still starting or have failed. Environment context snapshots
and rendering continue to use registered IDs.
## Testing
Cover alias assignment in selection order, stability across readiness
updates, and reuse of the same ID pair after reopening the SQLite store.
GitOrigin-RevId: e5fa6e5549ebb12fcf651e5bf7413402fb4db1b3
## Why
Restoring active context after compaction selects retained messages can
move it across user turns. For example, instructions for a context-only
heartbeat can end up before an earlier, already answered user question.
## What changed
Retain active context in source order when building compacted history
and resetting the context window. Use the full items from live history
so active tool outputs and messages survive prompt shortening.
## Testing
Add regression coverage for a heartbeat that compacts mid-turn, and
verify ordering around repeated user message IDs and pending agent
messages in local and remote compaction.
GitOrigin-RevId: b670f3c4e87331a61986b4c163f892e43bd0261d
## Why
A model catalog lookup can use a cached snapshot or bundled fallback without sending a request. A lookup that reaches the endpoint can send multiple requests through retries. Measuring both lets readers of the metrics distinguish cache behavior from endpoint traffic.
## What changed
- Record one `codex.remote_models.lookup.outcome` observation per completed catalog lookup with its purpose, result, and the source of the snapshot actually selected. Record observations without taking the exporter lock on the lookup path.
- Count dispatched requests in `codex.remote_models.http_get_attempt`, including retries. Tag them by purpose and whether they match the configured endpoint when that context is available. Keep endpoint URLs out of metric labels.
- Mark background refreshes as maintenance and apply metrics enablement changes to cached global handles when the process reloads telemetry settings.
## Testing
Add coverage for cache and fallback attribution, retry counts, auth failures before dispatch, and metrics collection across exporter disablement and replacement.
GitOrigin-RevId: b970207a69432030b4511c7e84acb6696b6f824b
## Why
Several invalidations can be handled by a single MCP runtime refresh. Recording the reasons together shows which changes prompted that refresh.
## What changed
When `mcp_refresh_reason_telemetry` is enabled, successful MCP runtime refreshes report a `codex_mcp_runtime_refresh_event` with distinct reason labels, a timestamp, and thread and session attribution. The flag is off by default.
Multiple installed-plugin metadata changes collapse to one `installed_plugin_metadata` label. The event omits configuration contents and plugin change IDs. Analytics buffers refresh events that arrive before their thread context is available.
## Testing
Add an integration test that queues multiple invalidations and verifies that one event with deduplicated reasons and the correct thread and session IDs is sent after thread start is recorded.
GitOrigin-RevId: 639326d0cb993b8b3a0fcbf0618049cb2ff065fd
## Why
When a turn has no execution environments or other environment context
to report, Codex can skip the environment update before reading the host
roster. The model then misses any active subagents in that roster.
## What changed
Keep the initial environment update until Codex has had a chance to
attach the host roster. Emit `<environment_context>` when the roster is
its only content, and drop the update if it is still empty.
## Testing
Add integration coverage for roster-only context and empty context in
both the default and per-environment formats.
GitOrigin-RevId: 6ceffd9aa13fefa31387c4d598a81a4281554c1c
## Why
A thread store that resolves the last inherited turn during fork preparation
can reuse that ID when creating the child instead of resolving it again.
## What changed
Forward the optional `last_inherited_turn_id` from `PreparedFork` to
`CreateThreadParams` alongside the inherited history position. Omit the
field from serialized creation parameters when no ID is available.
## Testing
Add a regression test that checks the in-memory thread store receives the
turn ID supplied by the prepared fork when it creates the child.
GitOrigin-RevId: 709c8cc4a744b2f893af6233e825026a27732873
## Why
Statsig starts before the model catalog. When runtime agent instances are
enabled, separate auth managers can cause Statsig and model discovery to
register the same app-server runtime twice.
## What changed
Pass a shared runtime auth slot to Statsig and model discovery in both
standalone and in-process app-server startup so they use the same runtime
registration.
## Testing
Extend the CLI startup integration test to require exactly one runtime
registration and verify that both Statsig evaluations and model discovery
send `AgentAssertion` authorization headers.
GitOrigin-RevId: 132521b685c5c7c617e7067c648de65b9a4287b2
## Why
Startup prewarm runs in the session startup trace, while the first turn
can run in a separate trace. The first-turn trace needs a way to show
which prewarm task it resolved, including when the wait times out.
## What changed
Record `startup_prewarm.resolve` at info level under the first-turn span.
Capture the startup prewarm span context when scheduling the task and
attach it as an OpenTelemetry span link during resolution. If the prewarm
span is filtered out, omit the link.
## Testing
Check exported spans for first-turn parentage, link behavior with the
prewarm span enabled or filtered out, and no second resolution on a
later turn. Add a regression test for retaining the link on timeout.
GitOrigin-RevId: ef4a19be64ecf145b17527081960e50adca3b92e
## Why
MCP runtime refreshes waited for capability discovery and host MCP
configuration to finish before requesting HTTP MCP servers from the selected
remote environment. That serialized two reads that can be in flight together.
## What changed
Start the remote environment config read alongside host MCP configuration,
including executor capability discovery. Start the read's 10-second timeout
after host configuration is ready so a serial executor can queue the read
behind discovery without consuming its timeout. Merge the results with host
server precedence and requirements still enforced.
## Testing
Add V1 and V2 integration cases that hold both executor replies until both
requests arrive, then verify host precedence and requirements. Add a
paused-clock test that covers a queued read and confirms a stalled read
times out 10 seconds after discovery completes.
GitOrigin-RevId: d974f0f575559bfe6b756de11aa460399fdabf25
## Why
Codex can intercept an `apply_patch` heredoc passed to `exec_command`
and apply the patch directly. That path ran shell hooks but bypassed
`apply_patch` hooks, so patch-specific rules could miss the same edit
when it was submitted through the shell tool.
## What changed
- Run `apply_patch` `PreToolUse` after shell hooks and before file
verification. Hooks can block or rewrite the patch, and the final
patch is checked against the selected environment's permissions.
- Report the executed patch through `apply_patch` `PostToolUse`. Link
the patch hook events to the outer shell call with
`parent_tool_use_id` and provide working-directory and filesystem
metadata for hooks that inspect patch targets.
- Apply the same block and rewrite rules in recorded Guardian reviews.
Mark those hook requests with `review_only` and review the resulting
patch without executing it or publishing hook-provided context.
## Testing
Add coverage for hook blocks and rewrites, effective working directories,
environment permissions, and cancellation before and after a patch write.
Cover recorded reviews of rewritten patches and reviews stopped by a hook.
GitOrigin-RevId: 2115f26261a20d4a512669bc9e277a764b8f42f4
## Why
A V3 worker can resume its conversation after stopping. Reporting results
explicitly lets the worker decide when to send a result to its parent,
independently of when a turn ends.
## What changed
Stop forwarding V3 workers' final answers as automatic success results.
Continue forwarding failures and preserve automatic results for V2. Update
V3 prompts and tool descriptions to tell workers to send their result and
call `stop_agent` to release their slot.
Keep `send_message` available in the V3 native tool set even when
`disable_direct_message` is set. When native tools are enabled, require both
`send_message` and `stop_agent` to survive tool policy filtering for V3
workers, including on resume.
Track accepted worker-to-parent reports until they are written to the
parent's rollout. Preserve unread reports for the next turn if a turn
triggered by a report is interrupted.
## Testing
Extend the idle eviction scenario to verify that a resumed V3 worker's
explicit report reaches the parent's rollout exactly once after turn
admission is deferred and the subsequent wake is interrupted.
GitOrigin-RevId: 9bf95a4358bca9778797c7064f9eaf20c8679a81
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
## 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
## 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
## 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
## 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
## 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
## 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
## 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
## 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
## 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
## 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