Commit Graph

9451 Commits

Author SHA1 Message Date
Abhinav
6eecd04fc1 Normalize image detail for the receiving model (#44249)
## Why

Switching models can send images from conversation history with `detail: original` to a model that does not support it.

## What changed

Normalize image details on request copies using the receiving model's capabilities. Downgrade `original` to `high` when unsupported, covering user messages and function and custom tool outputs. Preserve stored image details so switching back to a supporting model retains `original`, and continue stripping details for Responses Lite.

## Testing

Expand unit coverage across image detail values and model capabilities. Extend integration coverage for model switches within and between turns, text-only models, and resumed and forked threads, including assertions that persisted tool outputs remain unchanged.

GitOrigin-RevId: 2561651ea74f045e00f708ae53771a41dcd49c94
2026-09-09 17:56:06 +00:00
Abhinav
aa88a0333c Preserve tool output truncation budgets across resume and fork (#44248)
## Why

Replaying tool outputs under a different model can expand or shrink the history shown to the model if truncation uses the new model's budget.

## What changed

Save the originating history truncation budget on function and custom tool outputs and reuse it during replay, preserving existing tool-specific overrides. Include the existing 20% serialization allowance once, before converting byte budgets to tokens.

Rename the metadata field to `history_truncation_token_limit` while retaining `fallback_token_limit_override` as its serialized name for compatibility.

## Testing

Add regression coverage for resume and fork with different model budgets, including custom tool outputs. Extend unit coverage for existing overrides and byte-budget conversion.

GitOrigin-RevId: a62c8fd3e43198e2252b150fba72f022939c1070
2026-09-09 17:55:00 +00:00
Abhinav
b64de2f3ad Use the originating model when recording conversation history (#44243)
## Why

History recording used the model captured at turn start, so switching models within a turn could apply stale image preparation and tool-output truncation rules.

## What changed

Pass explicit model metadata through conversation recording. Record model responses and tool results using their originating step's settings, and capture the current model for pending input recorded during startup interruption or task completion.

## Testing

Add regression coverage for tool results across a model switch, explicit model selection for plain and annotated history, and image input retained during interruption and completion. Extend model-switching tests to verify that prepared media and item identity survive switching back to a multimodal model in live, resumed, and forked threads.

GitOrigin-RevId: 5bc750c30c334acb9b802cb80fdea01daffa84a1
2026-09-09 17:46:00 +00:00
Abhinav
205f3671e1 Use captured step settings for tool planning and execution (#44242)
## Why

After a model change within a turn, tools could still use the turn's original model capabilities, output limits, and telemetry attribution.

## What changed

- Build each step's tool plan from its captured model settings.
- Use those settings for image support and detail, command and MCP output truncation, extension metadata, and tool telemetry.
- Preserve the issuing step's model for delayed command completion events while allowing later `write_stdin` calls to use their own step's output limits.

## Testing

Add regression coverage for model changes within a turn, including tool replanning, Code Mode execution, image handling, MCP tool and resource output limits, extension settings, and delayed command completion.

GitOrigin-RevId: ef991598e89a846889baf770a0c9e12e56886d5d
2026-09-09 17:45:37 +00:00
Winston Howes
ed4ca07ba6 Handle credential provider source remapping across config layers (#44241)
## What changed

- Let higher-priority providers in `features.network_proxy.credentials` displace lower-priority providers with overlapping `env` sources, including in profiles. Preserve inherited settings when providers swap sources, and compare environment names case-insensitively on Windows.
- Preserve provider definitions across ordered batch remaps and persist displaced-provider removals without overwriting unrelated sibling updates.
- Validate remapped providers using the credential broker's compilation rules before persisting writes, while allowing incomplete drafts and explicit deletions.
- Omit displaced providers from config origins and report writes overridden by another provider's source ownership.
- Build trusted credential-broker configuration before merging managed layers for project discovery, preserving remapped providers' environment protections.

## Testing

Add unit and config RPC regression tests for source precedence, source swaps, ordered edits, concurrent sibling updates, atomic rejection of invalid remaps, persistence, and override reporting. Add a macOS managed-config regression test for remapped provider bindings during project discovery.

GitOrigin-RevId: b7d402727acf4e5b0f25946db1cf18811f5e2679
2026-09-09 17:45:17 +00:00
jif
3436cad5ab Fix MCP elicitation cancellation and reset state on reconnect (#44238)
## Why

Form and URL elicitations could keep waiting for a response and leave tool timeouts paused after cancellation. Remembered cancellations could also affect reused request IDs on a new connection.

## What changed

- Honor request cancellation and server cancellation notifications for all elicitations, without requiring user-verification support. Return `cancel` and release pending response routes and timeout pauses.
- Create a fresh elicitation service for each connection attempt, including initialization retries and session recovery, so cancellation state stays scoped to its connection.

## Testing

Add regression tests for form and URL elicitation cancellation, cleanup on service shutdown, and acceptance of previously cancelled request IDs after connection recovery.

GitOrigin-RevId: 388a8d72e55e89ad3d44d4739d8434485588aa1a
2026-09-09 17:42:20 +00:00
jif
e8e7103cb9 Extract Guardian review policy into a dedicated crate (#44227)
## What changed

Move assessment parsing and schema, model selection, review outcomes, retry handling, and rejection circuit breakers into `codex-guardian-reviewer`. Update core to use the extracted APIs while retaining session execution and decision enforcement in the host.

## Testing

Move existing assessment, circuit breaker, and retry tests into the new crate, including coverage for transient errors, cancellation, and deadlines.

GitOrigin-RevId: 96ec9989a0066acb012bf3bec0b9f7d8bf11a4ef
2026-09-09 17:31:37 +00:00
jif
a2e83a783e Continue rollout searches when a compressed rollout cannot be searched (#44226)
## Why

An error searching a single compressed rollout could abort the entire search and prevent results from other rollouts from being returned.

## What changed

Log a warning with the rollout path and error, skip that compressed rollout, and continue searching. Apply this behavior to both the compressed scan used alongside `ripgrep` and the fallback scan used when `ripgrep` is unavailable.

GitOrigin-RevId: 07a0d7109456a374244bb84f32cf18e60a69c206
2026-09-09 17:31:15 +00:00
bkotsopoulos
4f2449b4b2 Measure total exec-server request duration including queueing (#44207)
## Why

The existing request duration metric starts at dispatch, leaving out time spent waiting before dispatch.

## What changed

Add `exec_server_request_total_duration_seconds` to measure time from decoded receipt until response enqueue or disconnection, including queueing. Record it alongside the existing duration metric with the same `method` and `result` labels for success, error, and disconnection paths. Preserve existing dispatch and queue timing semantics.

## Testing

Add coverage for successful requests, route errors, unknown methods, response delivery failures, and disconnection during execution. Extend admission-wait coverage to verify total timing includes queueing and route setup without double-counting, and assert each completion and duration is recorded once.

GitOrigin-RevId: ed0f719751b821b8f9f9556914b0f67dc6c5ad8f
2026-09-09 17:03:57 +00:00
Abhinav
8ff4aa8ee4 Use captured step model settings for extension context (#44202)
## Why

Model switches within a turn can leave extension context using stale model metadata. Skill catalogs, context windows, and metric attribution need to match the model captured for each sampling step.

## What changed

- Pass captured model metadata and step-specific telemetry to world-state contributors.
- Use that metadata for skill catalog budgets and usage instructions, preserving configured budget overrides.
- Supply the captured model's usable context window to turn-context contributors, including when rebuilding context.

## Testing

Add regression coverage for model switches during skill discovery, catalog budgets and metric attribution, and extension context windows after `new_context` and retained-step context rebuilds.

GitOrigin-RevId: c51b40b739a380b9767a54ea8c8ee6de45bf01c8
2026-09-09 16:48:49 +00:00
Abhinav
b4507997e0 Use captured step settings when building model context (#44200)
## Why

Model changes during an active turn could leave context using the turn's initial model and settings, even after requests switched to the new model.

## What changed

- Build model, personality, approval, collaboration, app, plugin, and multi-agent instructions from captured step settings.
- Resolve multi-agent policy from the step's effective reasoning effort.
- Use the captured step's context window for full-context metadata and retain that step when rebuilding initial context for compaction.

## Testing

Add regression coverage for model switches updating context without duplicating updates, delegation policy following selected or model-default reasoning effort, and compaction preserving retained context after a model change.

GitOrigin-RevId: 3615c7a3f13f15fdcce9ad13d23311340e0aea88
2026-09-09 16:48:03 +00:00
Benjamin Carlsson
ccf470c060 Preserve voice indicator styles during composer sparkle effects (#44198)
## Why

Rendering the voice strip over sparkle stars can leave voice indicators with a star's color even when their glyphs are unchanged.

## What changed

Render the voice strip after effort ignition and before sparkle effects so stars skip its text and preserve its styles.

## Testing

Add a regression test comparing all nonblank composer cells, including their styles, across 80 sparkle frames while confirming stars still appear. Add a snapshot of the active voice composer.

GitOrigin-RevId: 48774408646c1281df3a6f7b1e12ab9d03a1babd
2026-09-09 16:43:50 +00:00
jif
ce2c2759eb Release persistent writers when session startup is cancelled (#44183)
## Why

Cancelling a session after persistence opens but while MCP startup is still pending can leave its writer held, blocking a subsequent resume.

## What changed

Create `LiveThreadInitGuard` inside the persistence startup future so it protects the live thread while `tokio::join!` waits for other startup work. Dropping the startup future then schedules writer cleanup.

## Testing

Add a regression test that cancels a resume while MCP startup is blocked, verifies the local writer is released, and resumes the same thread successfully.

GitOrigin-RevId: 57d8624e783a7b993579a6386aea35ba845da0e3
2026-09-09 15:54:07 +00:00
felixxia-oai
2bba3a29a0 Use explicit histogram buckets for Guardian context metrics (#44181)
## Why

Guardian request and section cost distributions need shared bucket boundaries across synchronous and asynchronous reviewers so their measurements align.

## What changed

- Add `histogram_with_boundaries` to session telemetry and extension metrics while preserving session attribution.
- Use shared request-token buckets up to 2,000,000 tokens and section-cost buckets up to 16,777,216 for both review paths.

## Testing

Extend telemetry tests to verify explicit bucket boundaries and sample counts, and Guardian integration coverage to check exported request and section metric bounds for both synchronous and asynchronous reviews.

GitOrigin-RevId: e34f6972b3418bac3b061939b62eeeccaec5a299
2026-09-09 15:48:39 +00:00
Eric Traut
c77c34ed33 Reduce TUI stack usage during session transitions (#44176)
## Why

Session transitions need stack headroom to rebuild configuration and the chat widget. Tokio stores task outputs inline even when it boxes the task future, so returning a large `Config` adds stack pressure during task allocation.

## What changed

Box the configuration build result inside the runtime worker and unbox it after joining. Box the `App::run` future to keep the large event loop out of enclosing startup futures.

## Testing

Extend the production-stack TUI integration test to enter `/side`, verify the process remains running, and return to the saved conversation with Ctrl+C.

GitOrigin-RevId: 44975300bb837bf3645ff762cf7bcdc44a277f41
2026-09-09 15:20:47 +00:00
jif
0df1daf526 Attach compressed rollouts to diagnostic reports as JSONL (#44175)
## Why

Diagnostic attachment reads assume the queued file path still exists and contains plain bytes. Compressed rollouts can therefore be omitted when only the logical `.jsonl` path is available, or attached as compressed data when a `.jsonl.zst` path is supplied.

## What changed

- Read rollout attachments through a bounded decoder that resolves plain or compressed representations without materializing a durable JSONL file.
- Use canonical `.jsonl` filenames for attachments and app-server report metadata, while preserving filename overrides.
- Apply size limits to decoded bytes and preserve JSONL prefix truncation.

## Testing

Add regression tests for compressed attachments, representation changes after queuing, plain-sibling preference, filename overrides, decoded size limits, truncation, nonregular files, and unrelated `.zst` attachments.

GitOrigin-RevId: b30f7dd08a741b0c99283460a1ce8933d2920ddf
2026-09-09 15:12:19 +00:00
felixxia-oai
17e64839eb Add aggregate budget enforcement for Guardian context (#44166)
## What changed

Add `ComposedContext::enforce_budget` to fit evidence within the input token allowance after reserving existing context. Preserve required content and message boundaries, reserve an omission notice, and return an error if required evidence cannot fit.

Carry retention policies through transcript rendering and composition. Protect user messages, protected messages, and the newest five tool entries. Remove oversized optional items first, then evict commentary, older tool evidence, and images in priority order. Add image admission support and record omitted content in truncation observations.

## Testing

Add tests for existing-context reservations, required-message preservation, image omission, framing costs, and protection of the newest five tool entries in both context profiles.

GitOrigin-RevId: 8a0f245bad82f562323b4533442385ddbcb6e541
2026-09-09 14:55:36 +00:00
felixxia-oai
d3ffbbed5a Add Guardian context cost and request token telemetry (#44164)
## What changed

- Record per-section text bytes, estimated text tokens, image bytes, and image counts for synchronous reviews and asynchronous scoring without logging evidence payloads.
- Emit estimated request tokens through `codex.guardian.context.request_tokens`. Synchronous estimates include assembled history, instructions, tool definitions, and output format, and measure the full logical request before WebSocket delta generation. Asynchronous estimates cover the assembled input.
- Add shared context budgeting helpers, including conservative image token reservations independent of encoded payload size and model-aware input limit calculation.

## Testing

Add coverage for separate text and image accounting, image estimates independent of encoded size, and section estimates that bound delivered messages. Extend asynchronous scorer and app-server tests to verify cost metric emission.

GitOrigin-RevId: aed45ecd9c23706f88caa51f2a4f2c77872d3bdb
2026-09-09 14:48:08 +00:00
jif
73a1148c9c Coordinate rollout compression with active thread writers (#44138)
## Why

Cold rollout files can still have active writers. Compression must not replace their files while writes are pending, including background work that outlives the local thread store.

## What changed

- Share cross-process writer locks between the rollout compressor and local thread store. Skip busy threads and recheck file state under coordination before publishing compressed files.
- Retain writer ownership through recorder background I/O and compressed rollout materialization. Wait for writers to exit on shutdown or discard, and stop queued file work before deletion.
- Route rollout metadata patches through owned recorders, reject competing writers before updating SQLite, and serialize metadata appends with shutdown.

## Testing

Add regression coverage for compression with live and detached writers, parallel cold-file compression, publication locking, metadata ownership conflicts, updates to compressed rollouts, concurrent shutdown, and discarding deferred items.

GitOrigin-RevId: c52f4037eb2019e8095b554e29bf531af95aa4bd
2026-09-09 12:30:07 +00:00
jif
20f109eadb Reuse MCP bindings while cached servers remain dormant (#44121)
## Why

Dormant MCP servers with usable cached tool catalogs prevented binding reuse, causing each model step to capture a new binding even when the catalog was unchanged.

## What changed

Track dormant catalog revisions alongside ready client revisions so bindings can be reused until the catalog changes or the server starts. Explicit server and plugin requirements still trigger binding capture and startup. Check cached catalog availability without cloning tool definitions.

## Testing

Extend the lazy-startup integration test to verify that two model steps share one binding while the server stays dormant, and that starting the server invalidates that binding.

GitOrigin-RevId: ef0469a85000f84a928946c24350e3bda1522fb5
2026-09-09 10:51:24 +00:00
Winston Howes
634ebc1865 Support credential brokering in plaintext HTTP tunnels (#44089)
## Why

Configured HTTP credential destinations need dummy credentials translated inside `CONNECT` and SOCKS5 tunnels, where credential interception previously detected only TLS.

## What changed

- Detect plaintext HTTP for configured credential destinations and proxy requests with URL-scoped credential substitution.
- Keep requests bound to the authorized tunnel destination, rejecting mismatched authorities and nested `CONNECT` requests.
- Support HTTP/2 clients and preserve HTTP upgrades, including `h2c`, and opaque traffic in full mode.
- Enforce limited-mode method restrictions on plaintext HTTP and reject upgrades and opaque traffic.

## Testing

Add end-to-end tests for both tunnel transports covering credential URL scope, request bodies, HTTP/2, destination mismatches, upgrades, lossless opaque forwarding, and limited-mode enforcement.

GitOrigin-RevId: 89262c996ea4ee156c628f9ed8e72b52504b2f6b
2026-09-09 07:06:12 +00:00
Winston Howes
56d3e8192f Refactor credential-broker tunnel protocol detection (#44077)
## What changed

Move TLS prefix detection into `brokered_tunnel` and carry explicit `BrokeredProtocols` requirements from the credential broker through HTTP `CONNECT` and SOCKS5 tunnel handling. Dispatch on `TunnelProtocol::Tls` or `TunnelProtocol::Opaque`, preserving the initial-read timeout, fragmented TLS header detection, and replay of all inspected bytes.

## Testing

Move the fragmented TLS regression test alongside the detector, retaining coverage for delayed header fragments and lossless prefix replay. Update broker and proxy assertions for the protocol-aware types.

GitOrigin-RevId: 6e5a92d8bdf6db5b59cff7f210c17b01d93ee23b
2026-09-09 06:26:36 +00:00
Winston Howes
38cbebaf3f Support configured credential providers across shell snapshots (#44072)
## Why

Credential brokerage must retain trusted destination hints even when shell environment policy hides them from child processes. Snapshot replay also needs to preserve credential aliases when tokens are short or captured dummy values change.

## What changed

- Add `features.network_proxy.credentials` and preserve provider settings when toggling the proxy. Prevent project configuration from overriding providers or their credential and destination environment variables.
- Use provider metadata throughout snapshot capture and replay, and pass hidden destination context to the broker without exposing it in the child environment.
- Rewrite aliases containing short credentials or previously captured dummies, respecting environment filters and explicit overrides.
- Preserve case-distinct `shell_environment_policy.set` keys so Windows credential ambiguity checks survive configuration merging and permission profile changes.
- Restore independent MITM settings when credential brokerage is disabled.

## Testing

Add regression coverage for custom providers, hidden destination hints, Bash and Zsh alias replay, configuration edits and merging, Windows ambiguity handling, and credential protection during approved execution.

GitOrigin-RevId: b2bd935d2d8555be56baf8feb1a8e5b3a0c666bc
2026-09-09 06:04:59 +00:00
Jennifer Zhao
129fd21687 Reject empty audio payloads in data URLs (#44070)
Return `AudioPreparationError::InvalidDataUrl` with the reason
`audio payload is empty` when the decoded base64 payload is empty.

GitOrigin-RevId: e886dab5f49ebb1a363dbc1c292813b2b52698d4
2026-09-09 05:56:45 +00:00
Winston Howes
f45115a137 Preserve credential broker destinations across environment filtering (#44068)
## Why

Filtering destination variables out of a child environment can undo credential registrations. Rotating a provider token and destination must also leave older credential aliases bound to their original destinations.

## What changed

- Add `CredentialBrokerContext` to retain local destination hints for built-in and configured providers without adding them to child environments or serialized configuration. Explicit environment values, including empty values, override these fallbacks.
- Preserve registered destinations when hints are absent, reconcile fallback changes, and keep credential aliases scoped to their source identities and environments during rotation and inheritance.
- Expose provider context and source matching for trusted captured text, including configured provider context keys.
- Disable brokerage on Windows when provider environment overrides contain conflicting case-insensitive keys.

## Testing

Add regression coverage for filtered destinations, token rotation, inherited aliases, fallback updates and clearing, context redaction, trusted text matching, and non-Unicode environment values.

GitOrigin-RevId: 411790ea6339e1d8fa568049cf8160a67b134666
2026-09-09 05:45:31 +00:00
Winston Howes
5a9aec40a5 Extend configured credential brokerage to embedded aliases (#44066)
## What changed

- Discover configured provider credentials in child environment values even when canonical credential variables are absent. Match complete tokens while preserving regex word boundaries and avoiding ambiguous or overlapping provider matches.
- Replace and restore credentials by their original spans, preserving adjacent tokens and generated dummy aliases across destination rebinding. Reject dummy values that embed another provider's credentials.
- Extend text virtualization and provider source checks to configured credentials, including short credentials with distinctive prefixes, while preserving operational paths.
- Expose trusted provider metadata and active bindings through `CredentialBrokerEnvironment`, and remove marked configured credential variables when stripping the managed proxy environment.

## Testing

Add regression tests for alias discovery, regex boundaries and alternatives, overlapping and adjacent credentials, destination rebinding, dummy restoration, disallowed credential sources, and operational path preservation.

GitOrigin-RevId: dd85c595ce9550fbfdb07ef296a23e458ca165dd
2026-09-09 05:39:28 +00:00
Won Park
3d3df0a0ca Raise Guardian's action review limit to 200,000 bytes (#44060)
## What changed

Increase `GUARDIAN_MAX_ACTION_BYTES` from 8,000 to 200,000 bytes to allow larger actions to be reviewed. Keep unified exec stdin approvals capped at 8,000 bytes with a separate `MAX_STDIN_APPROVAL_BYTES` constant.

## Testing

Update aggregate payload rejection coverage for the new limit and exercise MCP elicitation reviews with tool descriptions exceeding the previous 8,000-byte limit.

GitOrigin-RevId: fd4b97980803a7a687449043931e6f1e57e260d3
2026-09-09 05:07:22 +00:00
Winston Howes
1bfd383890 Add configurable credential providers to the network proxy (#44056)
## What changed

- Add `credential_providers` configuration for environment variables, credential patterns, static or environment-derived URL prefixes, and bearer, token, Basic, or custom header authentication.
- Generate matching dummy credentials and restrict replacement to authorized schemes, hosts, ports, and path prefixes. Scope credentials and destination history to each environment.
- Preserve real credentials for destinations that bypass the proxy with `allow_local_binding`, while providing snapshot redaction and alias matching.
- Validate provider definitions and preserve unchanged providers across configuration reloads.

## Testing

Add coverage for dummy generation, authentication translation, URL restrictions, environment isolation, configuration reloads, and credential restoration for local proxy bypass.

GitOrigin-RevId: 5d60ecc684cf4e9aa7637af33af12179aa0c672a
2026-09-09 04:59:01 +00:00
Winston Howes
9ba1d9eb5b Extract credential broker environment and registry helpers (#44049)
Move environment and marker helpers into `credential_broker/environment.rs`
and credential prioritization and selection into `credential_broker/registry.rs`.
Preserve existing behavior and public helper exports.

GitOrigin-RevId: 92bb94af3b00fc454bffea363a00a49f4a7cc44c
2026-09-09 04:23:08 +00:00
vkg-oai
283f34387b Use StartThreadOptions across thread fork APIs (#44043)
## What changed

Pass `StartThreadOptions` through rollout, loaded-history, and prepared forks instead of separate configuration and startup arguments. Replace `options.initial_history` with the fork snapshot while preserving the other supplied startup options, and update app-server and test callers.

Box the app-server's `thread_fork_inner` future to keep the large fork future out of the shared request dispatcher's stack frame.

GitOrigin-RevId: d54eb8b212dedabaf2c5d99d155637cefd7deb7a
2026-09-09 04:07:40 +00:00
Winston Howes
ec512d2347 Harden credential handling in shell snapshots and replay (#44040)
## Why

Shell quoting can hide credentials from raw-text checks, and startup files can restore real credentials after the broker replaces them with dummy values.

## What changed

- Decode shell literals without evaluating them and reject snapshots containing credentials in executable source, including aliases, functions, and heredocs.
- Preserve credential policy overrides, explicit unsets, and aliases whose source variables were removed. Support credential aliases in Zsh tied arrays while rejecting credentials that span array elements.
- Guard snapshot replay against credential restoration through shell startup files and preserve unrelated `ENV` settings.
- Apply Windows environment-key casing rules to credential overrides, suppress unredacted sandbox diagnostics during snapshot capture, and clear inherited environment variables before launching escalated commands.

## Testing

Add regression coverage for shell quoting and escaped credentials, Zsh tied arrays, startup-file replay, readonly credentials, policy overrides, and sensitive capture timeout and cancellation handling.

GitOrigin-RevId: 58274c07c715423241d26ce6dd2c2b4230cf0f64
2026-09-09 04:00:10 +00:00
Winston Howes
a548463b78 Handle copied credentials in the broker and shell snapshots (#44038)
## Why

Shell startup can copy a credential into another variable and unset its original source. These aliases need credential brokering without losing source restrictions or mistaking ordinary shell content for credentials.

## What changed

- Discover supported GitHub and OpenAI credentials embedded in environment values, even without their canonical variables. Preserve source ownership so unbound enterprise tokens cannot acquire a default host binding.
- Redact unregistered supported credentials during text virtualization, distinguish adjacent credentials, and avoid matching unrelated provider prefixes and common hashed paths.
- Expose helpers for checking allowed credential sources and restoring known dummy credentials in trusted text for fail-open execution.
- Render allowed credential aliases as snapshot exports and replace known credential values in shell state, preserving exported functions and credential-shaped function names.

## Testing

Add regression coverage for copied aliases, enterprise host binding, source filtering, adjacent tokens, path false positives, and dummy restoration. Add a Bash snapshot test that preserves exported functions while replacing credentials in heredoc content.

GitOrigin-RevId: f1c3d531405a96ac6bfa3882a11b74643fa6f123
2026-09-09 03:44:58 +00:00
Ahmed Ibrahim
45134c0463 Generate Python SDK types from repository app-server schemas (#44032)
## Why

Keep Python protocol models aligned with the checked-in app-server schemas and preserve reviewed generated artifacts when staging SDK releases.

## What changed

- Generate SDK types from the schema directory configured in `pyproject.toml`, with a `--schema-dir` override, instead of invoking the pinned runtime binary.
- Refresh Python artifacts through `just write-app-server-schema` for standard repository exports. Skip SDK updates for scratch and experimental exports.
- Regenerate protocol models and notification dispatch, deriving the known payload union from the registry so `Notification.payload` covers every registered event.
- Explicitly allowlist convenience API parameters so new protocol fields do not silently expand method signatures. Preserve existing approval path wrappers.
- Stage SDK releases using checked-in generated files without regenerating them.

## Testing

Add coverage for schema selection, refresh gating and failure handling, release artifact preservation, notification payload typing, and approval path compatibility. Update the generation drift test to use repository schemas.

GitOrigin-RevId: fab350b07cf170258b91fbafa8da384aeb2e3bd7
2026-09-09 03:27:31 +00:00
alexsong-oai
fe52d795c9 Add AWS credential export commands for Amazon Bedrock (#44028)
## What changed

Support `model_providers.amazon-bedrock.aws.credential_export` with `command`, `args`, and `timeout_ms` to supply SigV4 signing credentials from a command's JSON output. Accept both flat credential-process output and nested STS `Credentials` objects.

Cache credentials in memory, refresh before expiration, and share exports across sessions with matching AWS configuration. On recoverable authentication failures, run the optional `aws.auth_refresh` command before exporting fresh credentials, coalescing concurrent recovery attempts.

Bound command execution time and output size, and keep credential values out of errors. Reject combining `aws.credential_export` with `aws.profile`. Bedrock setup and login reject changes while an exporter is configured, preserving configuration and saved credentials.

## Testing

Add coverage for output formats, expiration, credential precedence, caching, concurrent recovery, command failures, and secret redaction. Integration tests verify request signing with rotated credentials, bounded recovery attempts, and setup/login rejection across configuration layers.

GitOrigin-RevId: 4ef799f88ab5e3b2578f8f41a5e56e4f30e2cd81
2026-09-09 03:17:48 +00:00
Eric Traut
2ce38ae6d8 Support image attachments in agents overview background tasks (#44027)
## Why

The agents overview submitted background task prompts as plain text, without image attachments or their text elements.

## What changed

- Enable image pasting in the overview composer and include attachments and text elements in the first task prompt.
- Resolve local image paths and send image bytes when using a remote workspace.
- Reject image inputs for models declared text-only before starting a thread.
- Restore unsent text and attachments after failures, or show image reattachment paths when a newer draft prevents restoration.

## Testing

Add tests for attachment rendering and submission, remote image payloads, draft recovery without overwriting newer text, and text-only model rejection.

GitOrigin-RevId: 08e3db8bace51ec007f5741f1b2be94658cbaea4
2026-09-09 03:12:46 +00:00
ningyi-oai
0d46c252b3 Encapsulate executed tool call metadata recording (#44002)
## What changed

Introduce `ExecutedToolCalls` to own optional shared recorder state and centralize feature checks, call recording, and accepted result source lookup. Update session, tool runtime, MCP, and Code Mode callers to use this interface.

Move prompt attachment, retry handling, and metadata budgeting into the `request_metadata` module, preserving existing recording and request behavior.

## Testing

Add coverage for all session and turn feature combinations, lazy result source lookup, and unchanged prompts when recording is disabled. Retain the existing metadata budget and cell completeness tests in the new module.

GitOrigin-RevId: bc19f34317232b6599c7ec71c15db4a80123ff6f
2026-09-09 02:33:17 +00:00
Eric Traut
b831057106 Clear stale transcript history when switching threads (#43994)
## Why

History events queued by the previous thread can repopulate the transcript after a thread switch, mixing old content into the new thread's replay.

## What changed

- Reset the transcript immediately and queue another reset before replaying the new thread, covering both snapshot switches and app-server thread replacement.
- Leave the alternate screen when resetting, and pause terminal event handling until queued resets finish.
- Process queued resets even when the transport is offline.

## Testing

Add regression tests for both switch paths, including queued history, an open transcript overlay, and a disconnect before replay events are handled. Snapshot the replacement transcript to verify it contains only the new thread's content.

GitOrigin-RevId: b68b07fb10ff35e908c2c184f80859dda637f977
2026-09-09 02:26:50 +00:00
dermanyang-oai
dafb6781ee Heap-allocate the resume future in the legacy history test (#43966)
Use `Box::pin` in
`cached_legacy_resume_revalidates_history_across_migration_settings` to
keep the large resume future off the Windows test thread's stack.

GitOrigin-RevId: 2539b7733e9f92e65a27bbea8f75170ce01b1884
2026-09-09 01:40:29 +00:00
mingze-openai
8c72f2ff56 Use curly apostrophes in protocol error messages (#43961)
## What changed

Replace straight apostrophes with curly apostrophes in usage-limit and high-demand error messages, and update usage-limit test expectations. Document that the context-window error's ASCII prefix is matched by the iOS input-limit classifier.

GitOrigin-RevId: 93484aaf805b9e6f8785fd1b43fe6ff9f1a13efa
2026-09-09 01:19:07 +00:00
Eric Traut
c3eeaae9a3 Gate new app-server work during graceful shutdown (#43959)
## Why

New client requests and automatic continuations can start more work while the app-server is draining. Shutdown also needs to account for requests still preparing or submitting work before they appear as running turns.

## What changed

- Close a shared admission gate when shutdown begins, rejecting new turn work and thread lifecycle changes with the server-draining error.
- Apply the gate to automatic turn starts, including queued work and goal continuations, and recheck serialized turn requests before execution.
- Wait for admitted requests and running turns to finish, while preserving forced shutdown. Keep reads and `turn/interrupt` available during drain.

## Testing

Add coverage for admission permit tracking, discarded queued requests, forced shutdown, and WebSocket drain behavior, including request rejection, interruption, and suppression of automatic continuations.

GitOrigin-RevId: 1bc108aa00a427cfa41974fa9ec60754c2b968c2
2026-09-09 01:03:42 +00:00
alexsong-oai
4e09b0c1f1 Increase the TUI thread capability test stack to 12 MiB (#43956)
Raise the Tokio worker thread stack size from 8 MiB to 12 MiB in
`selected_and_resumed_threads_use_server_capability_for_v1_and_v2_children`.

GitOrigin-RevId: 5f2462e50f0d67eeb1f5668d196431c7dc08d27f
2026-09-09 00:54:25 +00:00
Winston Howes
808b3411fd Cache protected shell snapshots and harden capture cleanup (#43954)
## Why

Credential-brokered commands rebuild shell snapshots on every invocation. Snapshot capture failures can also include credential-bearing startup output, and descendants holding output pipes need cleanup even after the shell exits.

## What changed

- Cache successful protected snapshots per environment, keyed by working directory, shell, login mode, and sandbox configuration. Rebuild missing or stale snapshots while keeping concurrent captures independently cancellable.
- Invalidate snapshots when shell settings or credential broker configuration change, and retry capture once if broker configuration changes during startup.
- Restore credentials and associated provider context while respecting environment policy filters and explicit overrides.
- Keep full-buffer capture subject to timeout and cancellation through output draining, clean up descendants on capture expiration or drain failure, and omit startup output from snapshot errors.

## Testing

Add regression coverage for snapshot reuse, invalidation, recovery after storage failure, concurrent cancellation, credential-safe errors, and descendant cleanup. Verify that successful background startup and output beyond the shell output cap remain supported.

GitOrigin-RevId: 7c7c8455bf6e3b9ca173dbb4277783469f0b45e6
2026-09-09 00:42:57 +00:00
Chris Dong
929389f596 Preserve per-image generation IDs in image generation analytics (#43953)
## What changed

Parse optional `generation_id` values from image API responses and carry the selected image's ID through the image generation tool into analytics events. Keep the ID out of serialized extension items, JSON schemas, and TypeScript types. Responses without an ID remain supported.

## Testing

Add coverage for distinct IDs in multi-image responses and responses without IDs. Extend analytics and app-server tests to verify that the selected image's ID reaches analytics, and item tests to verify that it is omitted from serialization and TypeScript types.

GitOrigin-RevId: 70a600856990140b76fdbda51a0d73b3414338b1
2026-09-09 00:34:45 +00:00
Eric Traut
102e1763b9 Keep app-server thread RPCs active until delegated work completes (#43950)
## Why

Thread startup, running-thread resume, and rollback could outlive their request handlers, allowing connection draining and request serialization to finish too early.

## What changed

- Await thread startup and listener completion for running-thread resume and rollback.
- Release the thread-list permit before waiting for resume completion so the listener can finish rollback responses.
- Release pending rollback waiters when clearing a listener, and discard queued requests when their connection closes.

## Testing

Add coverage for releasing queued requests and rollback waiters, and pipeline resume during rollback to check that both responses complete. Update diagnostics expectations to allow startup to remain in flight after its response is queued.

GitOrigin-RevId: 138156179afbc40de29965820db7fa9cd3669cc7
2026-09-09 00:25:02 +00:00
joeytrasatti-openai
589874be81 Add transactional thread attachment mutations to the state runtime (#43949)
## What changed

- Replace the `ThreadArtifact` model and related exports with attachment terminology.
- Add `StateRuntime::add_thread_attachment` and `remove_thread_attachment` using SQLite transactions. Repeated additions for the same thread, attachment type, and identity key return the existing record without changing its payload or creation time.
- Enforce limits of 100 attachments per thread, 64 KiB per serialized payload, and 256 bytes each for nonblank attachment types and identity keys. Removal returns the deleted record or `NotFound` and frees capacity immediately. Both mutations reject unknown threads.

## Testing

Add tests for idempotency, thread isolation, removal outcomes, capacity reuse, invalid inputs, unknown threads, and concurrent additions creating exactly one record.

GitOrigin-RevId: a68fe5076832f071524f1b4fc87d08b96ac270b7
2026-09-09 00:18:35 +00:00
Eric Traut
5b682c9875 Show configured app-server updater settings in doctor (#43948)
## What changed

Report the automatic-update setting and update interval from the daemon's `settings.json` in the background-server check, labeling each value as configured. Report unreadable, invalid, or oversized settings files without displaying their values, with a 16 KiB size limit.

## Testing

Add snapshot coverage for disabled automatic updates and a configured interval when the updater PID file is missing, plus invalid boolean and zero-interval settings.

GitOrigin-RevId: e8e77d1a10448f7d62fd84d8325f3e61738a689b
2026-09-09 00:10:54 +00:00
Andrei Eternal
5ac0b8768d Surface MCP reconnect signals when expired OAuth tokens cannot refresh (#43947)
## Why

Refresh failures could leave expired MCP OAuth credentials reporting ordinary errors instead of signaling that authentication is required, preventing tool calls from offering a reconnect signal.

## What changed

- Classify provider failures and timeouts as `AuthorizationRequired` when the access token has expired. Keep proactive refresh failures as ordinary errors while the token remains valid.
- Reread stored credentials after a failed refresh and adopt a valid login completed during the request, enforcing the existing issuer binding for refresh tokens. Preserve stored credentials for later retries.
- Convert authentication-required tool-call errors into a reconnect message with `mcp/www_authenticate` metadata, without exposing provider or transport details.

## Testing

Add coverage for startup and runtime OAuth recovery, proactive refresh failures, concurrent login adoption, issuer mismatches, credential preservation, and successful retries. Verify failed local refreshes do not send tool calls and server-rejected calls are not replayed.

GitOrigin-RevId: 9cf64b0452685d2085df5dc0bcecee16ffe42e47
2026-09-09 00:03:41 +00:00
Eric Traut
7c098d8741 Gate new turn submissions on host shutdown admission (#43943)
## Why

Hosts need to stop new turn-input work during shutdown without consuming pending input or preventing already-running delegated work from finishing.

## What changed

- Add an optional `TurnStartAdmission` extension gate, checked before reserving or starting a new turn. Hosts without a gate retain existing behavior.
- Return `NotSubmittedReason::ServerDraining` for refused starts and surface an app-server error instructing clients to reconnect and retry.
- Keep steering, parent-delegated subagent input, and memory-only mailbox wakeups available during drain, while gating automatic starts.
- Close realtime conversations with an ordered handoff, error, and close event sequence when a handoff is refused during drain.

## Testing

Add regression coverage for rejected input staying out of subsequent requests, persisted queue items remaining available for later starts, delegated agent and review work completing during drain, mailbox wakeups, and realtime handoff error ordering.

GitOrigin-RevId: 03dbdcd71eab200e597c0649e6eb39bd92dbc82f
2026-09-08 23:45:10 +00:00
Benjamin Carlsson
973dcd80fc Show worktree owner details and add confirmed deletion (#43942)
## What changed

- Display owner thread titles, relative update times, and archived or unavailable status in the managed worktree browser. Offer resume only for resumable owners, including those with compressed thread history.
- Add a delete action with a confirmation dialog that defaults to Cancel and preserves thread history.
- Restrict removal to managed worktrees in the current repository. Refuse the current checkout, including path aliases, and checkouts containing local changes, untracked files, or ignored files.

## Testing

Add browser snapshots and tests for owner states, deletion confirmation, and compressed thread history. Add worktree removal coverage for unrelated checkouts, current-directory aliases, untracked and ignored files, and successful removal of a clean checkout.

GitOrigin-RevId: e5867f1540d5d5bc8130acc76875e51e3d8b3b6a
2026-09-08 23:37:26 +00:00
Sean Huang
c53f342fec Add executor-context filesystem permission helpers (#43939)
## Why

Filesystem policies for remote execution need to interpret paths, home directories, and temporary directories using the execution host's context.

## What changed

- Add context-based read-denial matching, read-access checks, glob resolution, and `PathUri` workspace-write constructors without consulting local paths or environment variables.
- Share managed read-denial validation through `DenyReadValidator` and use it in core configuration, preserving required-entry checks, concrete grant validation, and constraint diagnostics.
- Reject invalid or unresolvable denial paths when constructing a context-based matcher, and apply `/tmp` denials according to the execution host's path convention.
- Preserve workspace-root symbols and protected metadata entries when materializing URI-based writable roots.

## Testing

Add regression tests for POSIX, Windows, and UNC path matching; conflicting read and write grants; malformed or unresolvable denials; `/tmp` handling; and workspace metadata protection.

GitOrigin-RevId: aa2b174288d1172ab52ff485f58d306236d27652
2026-09-08 22:52:05 +00:00