Commit Graph

4706 Commits

Author SHA1 Message Date
richardopenai
2151d3a5b7 Reset registry retries when refreshing Noise bundles (#39852)
## Why

Refreshing a Noise rendezvous bundle after an unauthorized handshake inherited
the initial registry lookup's retry count. If that lookup had exhausted its
retries, a transient registry error during the refresh failed immediately.

## What changed

Reset the registry retry count along with the operation deadline before
requesting a replacement bundle after a `401` handshake response.

## Testing

Extend the initial Noise connection test to exhaust the first lookup's retry
budget, receive a `401`, then verify that an offline replacement lookup is
retried and connects successfully.

GitOrigin-RevId: bcfad50ea32d69855f1c2c4c461022b3ecbbd941
2026-08-21 03:47:37 +00:00
Brandon Zhang
27c05a52e0 Include context window IDs in response metadata (#39847)
## What changed

- Add `context_window_id` to turn metadata for sampling and compaction requests, using the UUID for the model-visible context window.
- Keep the ID stable for requests in the same context window and advance it after compaction, independently of the existing thread-generation `window_id`.
- Reserve `context_window_id` so client metadata cannot override it.

## Testing

- Cover HTTP and WebSocket metadata, remote compaction, token-budget context alignment, resume behavior, and post-compaction window changes.

GitOrigin-RevId: 55cceea377ad509c8dd96ad668f2b5703ea46a63
2026-08-21 03:31:56 +00:00
Dylan Hurd
bd19459358 Ignore project instructions for untrusted projects (#39837)
## What changed

- Skip project-scoped `AGENTS.md` discovery when the active project is untrusted, while preserving user-level instructions.
- Include the active project trust level in the instruction cache key so runtime trust changes reload the applicable instructions.
- Preserve updated project trust metadata during runtime configuration refreshes.

## Testing

Add coverage for initially untrusted projects and for switching between trusted and untrusted states at runtime.

GitOrigin-RevId: 284bf7693943f585013fb5fe4b6aa3309bc50cf3
2026-08-21 02:33:50 +00:00
pmccrary-oai
d8ec270183 Rename the history notes extension config option (#39830)
## What changed

Rename the token-budget configuration key and its Rust field from
`use_history_notes_history` to `use_history_notes_extension`. Update the config
schema, extension gating, explicit-setting detection, and tests to use the new
name consistently.

GitOrigin-RevId: b6a514e23f02095fcd1d35dc42eeb7394b800c77
2026-08-21 01:51:48 +00:00
pmccrary-oai
daa48072f4 Add history and notes tools for token-budget sessions (#39827)
## Why

Token-budget sessions need a way to recover prior conversation context and preserve working state across context-window transitions.

## What changed

- Add direct-model `history` tools for listing windows and items, reading items, and searching conversation contents.
- Add direct-model `notes` tools for listing, reading, searching, appending, and writing persistent notes.
- Route tool calls through the configured Codex backend with trusted session and agent context, bounded request arguments, and truncation-aware output handling.
- Expose the extension when `features.token_budget.use_history_notes_history` is enabled with an OpenAI provider and Codex backend authentication.

## Testing

- Cover tool registration, configuration changes, provider and authentication requirements, backend request context, encrypted output preservation, and request and response limits.

GitOrigin-RevId: 43b259f01014ba3f30803dd7cd5634942407a9bb
2026-08-21 01:24:52 +00:00
rka-oai
f20b63e85c Use Responses compaction for Amazon Bedrock (#39825)
## What changed

- Switch Amazon Bedrock remote compaction to `compaction_trigger` items sent through `/v1/responses`.
- Remove the legacy dedicated compaction protocol from provider capabilities.
- Default remote compaction to unsupported and explicitly enable it for OpenAI, Azure Responses, and Amazon Bedrock providers.

## Testing

- Cover manual and automatic Amazon Bedrock compaction requests and their compacted history.
- Verify remote-compaction capabilities for configured and Amazon Bedrock providers.

GitOrigin-RevId: cf9ba314595367518b37a85f334f0c105ce47e45
2026-08-21 00:53:52 +00:00
chess
67b2c8c6fb Defer legacy filesystem policy projection (#39813)
## Why

Applying session settings rebuilt and compared a legacy filesystem policy even
when the update could not trigger cwd-based policy rebinding.

## What changed

Compute the legacy projection only for cwd changes whose filesystem policy has
a rebindable project-root write entry. Preserve the existing equivalence check
before rederiving the policy.

GitOrigin-RevId: c428a5c54f1b5b1300be406cac374a6fd29bb9a8
2026-08-20 23:36:13 +00:00
chess
969efa5470 Avoid materializing writable-root carveouts for presence checks (#39812)
## What changed

- Add `FileSystemSandboxPolicy::has_writable_roots_with_cwd` to detect an
  effective writable root without constructing its read-only carveouts.
- Use the helper when classifying permission profiles and selecting patch
  rejection reasons.

## Testing

- Verify the presence check matches the existing materialized-root result
  across read-only, unrestricted, external, writable, denied, and unresolved
  special-path policies.

GitOrigin-RevId: 17ee490aa3180e05732133203f68544d9de5268b
2026-08-20 23:26:59 +00:00
rka-oai
aead844f64 Handle standalone tool outputs as external context (#39791)
## What changed

- Treat standalone `function_call_output` items without a `call_id` as external context, including items injected into new and forked threads, and mark the thread memory mode polluted when `memories.disable_on_external_context` is enabled.
- Include these outputs in guardian transcripts with their namespaced tool name and a placeholder for non-text content.
- Allow image generation to reuse images from standalone and otherwise unpaired function or custom-tool outputs.

## Testing

- Cover injected thread items, external-context detection, guardian transcript rendering, and recent-image selection.

GitOrigin-RevId: ca4e8c16a4b731e1256a5956908d00f785b4feb1
2026-08-20 19:46:29 +00:00
jif
43526b8561 Deduplicate zsh fork test setup (#39790)
## What changed

Reuse the shared `build_zsh_fork_test` helper in the unified exec approval
suite and remove its identical suite-specific wrapper.

GitOrigin-RevId: 0593f0e1a56737eba1d491872a44d14e9171dbfb
2026-08-20 19:43:54 +00:00
rka-oai
763787d061 Support standalone named function call outputs (#39782)
## Why

External tool events may need to enter thread history without a preceding function call and therefore do not have a `call_id`.

## What changed

- Allow `function_call_output` items to omit `call_id` and carry optional `name` and `namespace` fields.
- Preserve named standalone outputs during history normalization and agent forks while retaining existing pairing behavior for outputs with a `call_id`.
- Accept, persist, and forward these outputs through `thread/inject_items`, and update the app-server schemas and documentation.

## Testing

- Cover paired and standalone JSON round trips, history normalization, agent forks, and injected thread history.

GitOrigin-RevId: a3258163a7dc93777c7c3023116fe204819bdbb0
2026-08-20 19:19:41 +00:00
tongzhou wang
854cbb2fd4 Make tool-result telemetry limits configurable (#39779)
## What changed

- Add `otel.tool_result.max_bytes`, defaulting to 2048 bytes, to control the
  text included in `codex.tool_result` logs independently of model-visible
  output limits.
- Apply truncation centrally when emitting telemetry, preserve UTF-8
  boundaries, and report whether the logged output was truncated.
- Record typed tool names and namespaces, agent names, and process-local result
  sequence numbers while keeping tool arguments and output out of trace events.

## Testing

- Cover configuration propagation, UTF-8-safe truncation, raw tool-output
  logging, and log/trace event routing and fields.

GitOrigin-RevId: 89ca76e55f1a09b729e7770ce01f2e4d98f9a22d
2026-08-20 19:09:04 +00:00
jif
bce5f2fcfc Standardize shell execution on unified exec (#39772)
## What changed

- Use `exec_command` and `write_stdin` as the shell tool surface.
- Treat legacy `default`, `local`, and `shell_command` model metadata as `unified_exec`.
- Remove obsolete shell-selection configuration and runtime paths while preserving the feature and policy gates for zsh fork execution.

GitOrigin-RevId: d743cbe598630d73052f1fecad680c4cde17977d
2026-08-20 18:29:35 +00:00
sayan-oai
5bcd7b0fbc Refresh bundled model definitions (#39770)
## What changed

- Add the hidden Daybreak Blue and Daybreak Red model definitions.
- Refresh model capabilities, instructions, plan availability, and service-tier metadata.
- Configure the auto-review model for Responses Lite and code-mode tools, and update Guardian request tests for the resulting `additional_tools` and developer-message layout.

## Testing

- Update Guardian request snapshots and assertions for initial and follow-up reviews.
- Verify MCP approval routing against the developer-message form of the Guardian prompt.

GitOrigin-RevId: 6680e9abebdcbc43224a81348591e26f8422f3ec
2026-08-20 18:17:28 +00:00
william-openai
39073ca3a7 Include suggestion IDs in plugin install metadata (#39765)
## What changed

- Add `suggestion_id` to plugin install elicitation metadata, using the same
  value as the elicitation request ID and plugin-install analytics event.
- Leave connector install metadata unchanged by omitting the field.

## Testing

- Cover plugin and connector metadata serialization.
- Verify that remote plugin install metadata and analytics carry matching
  suggestion IDs.

GitOrigin-RevId: 05dd1d210e2a82857094f09d27ecba79ee460b7e
2026-08-20 17:54:42 +00:00
victor-openai
097825f75a Add app-server MCP event streaming (#39761)
## What changed

- Add experimental `mcpServer/event/stream/start` and `mcpServer/event/stream/stop` requests for hosted apps, plus `mcpServer/event/stream/notification` forwarding.
- Scope subscriptions to the owning app-server connection and subscribed thread, enforce unique IDs and a per-connection limit, and clean them up when the thread is unsubscribed or the connection closes.
- Wait for the MCP active notification before completing startup, retry streams that close immediately, and terminate them when authentication or hosted runtime ownership changes.

## Testing

- Add an app-server integration test covering activation, event forwarding, duplicate subscription rejection, and explicit cancellation.

GitOrigin-RevId: 8a6fc1615adfc5af7e67def3b824fa5909ab3e7b
2026-08-20 17:49:35 +00:00
jif
8a40095ea3 Standardize shell execution on unified exec (#39757)
## What changed

- Remove the legacy `shell_command` handler and runtime, leaving `exec_command`
  and `write_stdin` as the shell execution tools.
- Treat legacy `shell_command` model metadata as `unified_exec`, and normalize
  legacy user opt-outs so they do not disable command execution. Managed feature
  requirements and `shell_tool` can still disable it.
- Preserve shell approvals, sandboxing, zsh-fork support, and output truncation
  through the unified execution path.

## Testing

- Cover legacy configuration and model-metadata compatibility.
- Exercise unified shell execution, approvals, truncation, and `apply_patch`
  serialization across the app-server and core test suites.

GitOrigin-RevId: 5c2fd6164fc3519cdae4944cb9db276b8467311c
2026-08-20 17:46:05 +00:00
jif
d0cc662b8c Cache shell snapshots in the exec server (#39756)
## What changed

- Add the `shellSnapshotV2` executor capability and an optional shell snapshot request to `ExecParams`.
- Capture and restore Unix shell state and profile exports from an in-memory, attachment-scoped cache for `bash`, `zsh`, and `sh`.
- Apply environment policies, runtime `PATH` entries, sandbox context, and live managed-proxy settings when preparing restored commands.
- Bound snapshot size, capture time, scope length, and cache capacity, and fall back to the original command when capture fails.

## Testing

- Cover local, remote, TTY, sandboxed, and supported-shell execution, plus environment filtering, proxy handling, in-memory reuse, and capture failure fallback.

GitOrigin-RevId: 624f747972c249c88c6f10f42cf0af97b75b5541
2026-08-20 17:39:06 +00:00
joeflorencio-openai
ce950dcf26 Add managed developer instructions to requirements (#39755)
## What changed

- Add `additional_developer_instructions` to managed requirements and expose it through `configRequirements/read` as `additionalDeveloperInstructions`, independently of ordinary developer instructions.
- Include the managed instructions in model context, emit explicit replacement or removal messages when requirements change, and preserve the current value across compaction, resume, and agent forks without duplication.
- Reject managed instructions whose rendered context exceeds 10,000 estimated tokens.

## Testing

- Cover requirements layering and API serialization, context updates and removal, size validation, repeated model requests, compaction and resume, rollout migration, and agent forks.

GitOrigin-RevId: bc0b70fb7988944c2f68176dff55f5ed61eb46c8
2026-08-20 17:36:22 +00:00
Sean Huang
85a1b0e33d Expose uncompiled permission profile selection (#39752)
## What changed

- Add `resolve_permission_profile_selection` to select the effective profile using configured defaults, managed requirements, and allowlists.
- Return the merged configured and managed profile catalog without compiling platform-specific paths, leaving path interpretation to the executor.

## Testing

- Verify that a managed default overrides a configured default while preserving Windows-style paths.
- Verify that an allowlisted but undefined profile is rejected.

GitOrigin-RevId: 0172193d48f0346522f931d3b806054895d199c0
2026-08-20 17:25:14 +00:00
cgst-oai
a26d50852a Require filesystem backends to implement directory walks (#39749)
## What changed

- Make `ExecutorFileSystem::walk` a required backend operation instead of
  providing a fallback built from directory reads and metadata requests.
- Implement bounded local walks on a blocking task with cancellation, symlink
  cycle detection, deterministic ordering, error collection, and response-size
  limits.
- Have remote filesystems use the server's walk operation directly.

## Testing

- Cover local and remote handling of invalid roots and limits, directory
  symlinks, non-UTF-8 names, cancellation, sandbox contexts, and response
  budgets.

GitOrigin-RevId: 7499bf05080c3f9965a5eb7ffd593de604d62c2a
2026-08-20 17:16:52 +00:00
sayan-oai
2e1f18e0db Refresh resumed thread capability roots from executors (#39746)
## Why

Resumed threads can carry a persisted capability-root location that no longer
matches the location reported by the attached executor.

## What changed

- Refresh matching thread-owned capability roots from the live environment while
  preserving persisted roots when the executor reports none.
- Use the same merge behavior for capability-root inspection and per-step MCP
  resolution, without changing owner-configured root precedence.

## Testing

Extend the remote-environment resume test to cover both an executor-provided
replacement root and the persisted-root fallback.

GitOrigin-RevId: 0c66195b2406f431a2e156e00d5225a8d22d18b2
2026-08-20 17:12:15 +00:00
rhan-oai
4f38432d87 Use model-specific auto-review outcome instructions (#39741)
## What changed

- Add `rejection_instructions` and `timeout_instructions` to catalog-provided auto-review messages.
- Use the acting model's instructions for denied and timed-out reviews across tool approvals, shell escalation, and MCP elicitation responses.
- Fall back to the existing instructions only when a catalog value is absent, while preserving explicit empty-string overrides.

## Testing

- Cover catalog overrides, legacy fallbacks, empty values, and separation between acting-model and reviewer-model messages.

GitOrigin-RevId: c5b2c2dbdaefd45d1d658651dd1abaeb6d8c93da
2026-08-20 16:52:16 +00:00
jif
9894a14c81 Track multi-agent v2 spawn calls in analytics (#39722)
## What changed

- Emit started and completed collaboration tool events for multi-agent v2
  `spawn_agent` calls, including failed invocations.
- Record execution duration and successful child-agent configuration metadata
  without including the spawn prompt.
- Deduplicate collaboration and subagent activity items by call ID when
  calculating per-turn subagent tool counts.

## Testing

- Extend the app-server multi-agent v2 integration test to cover successful
  and failed spawn telemetry, duration, prompt omission, and turn counts.

GitOrigin-RevId: c1c2fb9cc2a1a9b0f63ef68509ad36d11a92d1e5
2026-08-20 14:33:55 +00:00
rafael-oai
1674b0a130 Expose managed policy for browser settings imports (#39720)
## What changed

- Add `in_app_browser.allow_external_browser_settings_import` to managed requirements, preserving explicit Boolean values through layered composition while leaving an omitted value unset.
- Return the policy as `inAppBrowser.allowExternalBrowserSettingsImport` from `configRequirements/read` and include it in the generated protocol schemas.
- Keep the import policy independent from the in-app browser feature flag and agent Browser Use requirements.

## Testing

- Cover parsing, managed-layer precedence, invalid values, user and session override resistance, and app-server response serialization.

GitOrigin-RevId: efa2621d2b1cf503f1bee2505d9914cb4fb7221d
2026-08-20 14:13:56 +00:00
Tamir Duberstein
4a942885c8 Reduce unified exec output buffer allocations (#39712)
## What changed

- Accept borrowed byte slices when appending output chunks, avoiding clones before
  forwarding those chunks to streaming consumers.
- Merge drained head-tail buffers by reusing their owned storage while preserving
  the retained prefix, latest suffix, and omitted-byte count.
- Make unified exec output handles capacity-generic so bounded-output tests can
  exercise repeated drains with small buffers.

## Testing

- Update head-tail buffer and process manager tests to cover chunk retention,
  omission accounting, and repeated output drains with the new APIs.

GitOrigin-RevId: caa9813d3c9d9921cff28888263a212def381640
2026-08-20 13:17:20 +00:00
felixxia-oai
3675fe014b Remove redundant code mode image helper test (#39707)
GitOrigin-RevId: 38bf61c1d71827d65a7824318911ac0e9f2756bb
2026-08-20 12:12:53 +00:00
felixxia-oai
37a9da9901 Move the global scope check into the code-mode runtime (#39703)
## What changed

Replace the core integration test for allowed `globalThis` properties with an
in-process code-mode runtime test. The test continues to fail when the runtime
exposes a global outside the allowlist without requiring the core network test
harness.

GitOrigin-RevId: f33846ae2bb35e6779b5bec0a3f0ba5729eb707d
2026-08-20 12:02:42 +00:00
felixxia-oai
585b97d394 Wait for turn completion events in multi-agent resume tests (#39702)
## What changed

Use the shared `wait_for_event` helper to wait for `TurnComplete` from initial
and reloaded worker threads before checking their requests. This replaces
manual polling of `AgentStatus` with two-second deadlines.

GitOrigin-RevId: 862884afae9969aacf0f53c5c24cf8b72f8d078a
2026-08-20 11:57:32 +00:00
felixxia-oai
478dbe9df0 Make Guardian v2 parent compaction reuse configurable (#39691)
## What changed

- Add `features.guardianv2.reuse_parent_compaction`, defaulting to `true` to preserve existing behavior.
- When disabled, omit parent compaction items from Guardian v2 contributor requests.
- Cover configuration parsing and disabled-reuse request construction.

GitOrigin-RevId: 0cf7c0ac7a2567c9f73a3f9724df6f6a6170e995
2026-08-20 10:57:03 +00:00
Ben Romano
312b62ac95 Trace MCP runtime refresh coordination (#39667)
## What changed

Add named tracing spans for MCP dirty-state refreshes and time spent waiting
to acquire the refresh semaphore.

GitOrigin-RevId: 1dbb3572d2061581beb83b3de098d6ec91791104
2026-08-20 08:36:00 +00:00
Benjamin Carlsson
631d5a8b02 Expand Vim change commands and add character replacement (#39661)
## What changed

- Add the configurable `vim_normal.replace_char` action, bound to `r` by default, to replace the grapheme under the cursor while remaining in normal mode.
- Support change-operator motions such as `cw`, `c$`, `cj`, and `ck`, plus the repeated `cc` command for changing the current line.
- Let `Esc` cancel a pending replacement before it reaches composer-level handling.
- Preserve existing custom Vim bindings and chord prefixes when introducing the new default.

## Testing

- Cover replacement, grapheme boundaries, remapping and unbinding, change motions, cancellation, keymap conflicts, and keymap picker snapshots.

GitOrigin-RevId: 98feb4eeb57142c37adb73abfe58d1f703b9270d
2026-08-20 08:13:56 +00:00
pakrym-oai
e3e5ad2847 Harden unsandboxed patch filesystem access (#39659)
## Why

An `apply_patch` path can be replaced with a symlink after verification, allowing an unsandboxed patch operation to reach a different file than the one that was approved.

## What changed

- Add `follow_symlinks` options to executor filesystem reads, writes, metadata lookups, directory creation, and removal, including the corresponding `followSymlinks` protocol fields.
- Implement no-follow filesystem operations on Unix and Windows that reject links in any path component and restrict file access to regular files.
- Run `apply_patch` with symlink traversal disabled when an otherwise-required sandbox is bypassed, while retaining the existing follow-symlink default for standalone callers.

## Testing

- Cover leaf and ancestor symlinks across patch add, update, delete, and move operations, including a path swap after verification.
- Exercise local and remote no-follow filesystem behavior, concurrent directory creation, special-file rejection, and Windows reparse points.

GitOrigin-RevId: 43fd479084891493ce13564fbd894b98f329c6dd
2026-08-20 08:10:08 +00:00
Ankush Gupta
4e1a772a7d Let Guardian V2 satisfy required model reviews (#39658)
## What changed

- Allow the Guardian V2 approval monitor to handle reviews for models that require automatic review.
- Preserve full Guardian review when Guardian V2 is disabled by configuration or managed requirements.
- Cover required-model routing for low- and high-risk actions, plus both Guardian V2 disable paths.

GitOrigin-RevId: d1201cc3dbd7c4a07de633388b14f17ada9feb39
2026-08-20 08:07:06 +00:00
pakrym-oai
1802a65571 Make core integration test permissions explicit (#39655)
## What changed

- Run local and remote compaction test turns with approvals disabled and an unrestricted permission profile.
- Keep the full test harness available where compaction turns need the configured model and working directory.
- Enable the Windows sandbox for managed-network unified exec process-event coverage.
- Update request snapshots to reflect the resulting `danger-full-access` sandbox metadata.

GitOrigin-RevId: 38eb46ca6ab28246d738e31eab900b2825072c7d
2026-08-20 07:52:35 +00:00
Adam Perry @ OpenAI
7ece061767 Enforce filesystem permissions when loading AGENTS.md (#39653)
## Why

Project instructions must respect the selected environment's filesystem read
permissions. Tightening those permissions for a later turn must not allow
previously cached instructions to reach the model.

## What changed

- Apply each environment's filesystem sandbox while discovering and reading
  `AGENTS.md` files.
- Fail thread or turn setup when sandboxing blocks a discovered instruction
  file, while allowing a restricted project with no instructions to start.
- Clear cached instructions before refresh and include the Windows sandbox
  level in the cache key.
- Ignore inaccessible ancestor marker probes so readable instructions in the
  selected working directory can still load.

## Testing

Added coverage for restricted projects, denied instruction files, cache
invalidation after permissions tighten, and unreadable ancestor markers.

GitOrigin-RevId: 6ea1a27b9c873a6260e4f87d42ae1317a6a4ae4b
2026-08-20 07:48:46 +00:00
Dylan Hurd
8aaf839774 Exercise restricted-token sandboxing in cyber policy tests (#39646)
## What changed

Run both branches of the heuristically safe command policy test with the
Windows sandbox level set to `RestrictedToken`.

GitOrigin-RevId: ae5d754ec4a51d73a8e5f9d844f94a91f795fb72
2026-08-20 07:37:52 +00:00
Anton Panasenko
af0e82c562 Enforce managed residency for model providers (#39645)
## Why

Model provider configuration could override the residency header required by
`enforce_residency`, so provider-backed requests did not reliably honor the
managed setting.

## What changed

- Apply the managed residency header after building a provider, making it
  authoritative for model requests and model discovery.
- Warn when a provider configures the residency header through
  `http_headers` or `env_http_headers`, while preserving the original provider
  configuration and unrelated headers.
- Cover HTTP and WebSocket requests, model discovery, and case-insensitive
  header detection with targeted tests.

GitOrigin-RevId: 461ef8989d5bd06ffdea694aee4265e392e07590
2026-08-20 07:33:27 +00:00
evanz-oai
663da53823 Sanitize developer context in full-history agent forks (#39641)
## Why

Developer messages can contain both inherited agent policy and unrelated context. Full-history forks need to replace the parent policy without dropping the unrelated content that shares its message.

## What changed

- Filter fork-specific developer instructions by content item instead of excluding an entire developer message.
- Remove inherited multi-agent mode instructions before applying the child agent's current mode.
- Preserve unrelated content items and discard developer messages only when filtering leaves them empty.

## Testing

Extend agent-control and subagent notification tests to cover compound compacted messages, multi-agent mode instructions, and proactive-to-explicit mode transitions.

GitOrigin-RevId: 028834e237d8636c13b17a724574bc8eb09a55ba
2026-08-20 07:29:43 +00:00
Sean Huang
7ea7b29369 Expose permission profile resolution in the core API (#39632)
## What changed

- Add `Config::resolve_permission_profile` to resolve named profiles from the
  effective configuration and managed requirements.
- Make active-profile network proxy lookup public and re-export
  `CodexThreadSettingsOverrides` from `codex-core-api`.
- Cover configured and managed profile inheritance, duplicate-name rejection,
  and preservation of managed network settings.

GitOrigin-RevId: ffb5f54a932ef1a4b624677b5f051ecdcd1134b8
2026-08-20 07:11:46 +00:00
Dylan Hurd
910ecccf30 Skip sandboxed shell commands in Guardian v2 by default (#39631)
## What changed

- Exclude sandboxed `exec_command` and `shell_command` calls from Guardian v2 classification by default while continuing to classify calls that request `require_escalated` permissions.
- Add `guardianv2.review_scope.sandboxed_exec_commands` to opt sandboxed shell commands back into classification.
- Keep other tools and namespaced shell tools in scope, and advance tool-call progress when a call is skipped.

## Testing

- Cover the default and configured review scopes, tool namespaces, permission modes, and skipped-call progress tracking.

GitOrigin-RevId: 32fb540c69959b9a82569f0f2fc76b5517496e6b
2026-08-20 07:08:31 +00:00
jif
942af8447b Retire the untrusted approval policy (#39630)
## What changed

- Remove `untrusted` from the CLI, configuration schema, and MCP tool interface. Explicit `approval_policy = "untrusted"` settings now fail with an actionable error.
- Remove the known-safe command allowlist. Projects marked untrusted now request approval for every command unless an explicit exec policy rule allows it.
- Keep command parsing conservative by treating in-place `sed` forms as mutating and ignoring unrecognized commands when recording memory usage.

## Testing

- Cover rejection of the retired configuration value and approval requests for commands in untrusted projects.

GitOrigin-RevId: d6bf425edddfffbb325eee6acf383434af5fd33b
2026-08-20 07:03:02 +00:00
Eric Traut
9ca99b5171 Preserve parent repository discovery through sandbox metadata mounts (#39629)
## Why

The Linux sandbox represents missing protected metadata paths such as `.git`
with empty read-only directories. Repository and project discovery treated any
`.git` directory as a checkout root, so this synthetic directory could hide a
real parent repository and its trust configuration.

## What changed

- Treat a `.git` directory as repository metadata only when it contains
  `HEAD`, while continuing to recognize file-based `.git` entries.
- Protect missing `.git` paths with the same read-only synthetic mounts as
  other workspace metadata without disrupting parent-repository discovery.
- Canonicalize and read-only bind the synthetic-mount registry into the
  sandbox, and make protected-path cleanup handle read-only directory trees.

## Testing

Added coverage for repository, project-root, trust, synthetic-mount, and
Landlock behavior, including nested incomplete `.git` directories and a
redirected `TMPDIR`.

GitOrigin-RevId: 0724c54d56531143bb28011e4ca414cd3b0212be
2026-08-20 06:57:00 +00:00
philn-oai
e396ef3fc1 Add cwd-relative turn diff paths (#39625)
## What changed

- Add the opt-in `cwd_relative_turn_diffs` feature.
- When enabled, render turn diff paths relative to each selected environment's
  working directory instead of the detected Git root.
- Preserve repository-root-relative paths when the feature is disabled.

## Testing

- Cover enabled and disabled behavior for nested working directories across
  supported originators.

GitOrigin-RevId: 8b4908706a82b01f33ccd035b0945f9a29fce26f
2026-08-20 06:52:01 +00:00
Jeremy Rose
bc3545b805 Validate linked worktrees before inheriting project trust (#39616)
## Why

A checkout could point its `.git` file at a trusted repository's worktree
directory without proving that the repository had registered that checkout.
This could cause project configuration from an unrelated checkout to be treated
as trusted.

## What changed

- Verify the linked worktree's `gitdir` backlink, `commondir`, registered
  checkout, and main checkout ownership before resolving the main repository's
  trust key.
- Reject missing, oversized, symlinked, mismatched, or swapped Git metadata.
- Preserve valid linked worktrees that use path aliases, separate Git
  directories, or non-UTF-8 POSIX paths.

## Testing

Add resolver and config-loading coverage for forged worktrees, metadata races,
case-sensitive paths, moved worktrees, and host MCP startup from project config.

GitOrigin-RevId: 6052a7d10ad2d613436f20175c356abdef8c758e
2026-08-20 06:29:32 +00:00
Jeremy Rose
250b5ea2bf Bind MCP OAuth refresh tokens to their issuer (#39615)
## Why

An authorization server discovered for an MCP server can change. A stored refresh token must not be sent to a different issuer than the one that originally granted it.

## What changed

- Persist the discovered authorization server issuer with new OAuth credentials and preserve it across refreshes.
- Validate that issuer against a single pinned metadata snapshot before refreshing or adopting stored refresh credentials.
- Require reauthentication when refresh credentials have no issuer or the issuer changed. An unexpired access token can still be used without exposing its refresh token.

## Testing

Add coverage for issuer persistence, missing and changed issuers, metadata changes during startup, and refresh-token preservation.

GitOrigin-RevId: 07e48ba892f627428a28bbed5cca4ad703e2a5fd
2026-08-20 06:25:17 +00:00
sayan-oai
530c1aed58 Prevent apply_patch from widening write permissions (#39614)
## Why

Deriving permissions from the parent of an already-writable patch target can
unnecessarily grant write access outside the intended workspace.

## What changed

Skip targets already covered by the active filesystem sandbox policy before
deriving additional parent-directory permissions. Targets outside the writable
area continue to request the required parent access.

## Testing

Added unit and CLI regression coverage for workspace-directory targets,
already-writable parents, and symlink escapes outside the workspace.

GitOrigin-RevId: 187109ff0b56a1a399cb8a9981b7e822977025d5
2026-08-20 06:21:54 +00:00
jif
c19482a768 Limit Bazel integration test threads on macOS (#39609)
## What changed

- Add a `test_threads` option to `codex_rust_crate` that sets
  `RUST_TEST_THREADS` for sharded integration tests when configured.
- Run the `core` and `app-server` Bazel integration tests with one Rust test
  thread on macOS, leaving the thread count unchanged on other platforms.

GitOrigin-RevId: 118147413eb141f557d9ee82858860617d61acce
2026-08-20 06:13:28 +00:00
pakrym-oai
186b449bc2 Resolve model-provided shells by type (#39607)
## Why

A model-provided shell path should select the requested shell type without
allowing that path to determine which executable Codex runs.

## What changed

- Resolve model-provided shells through Codex's normal shell discovery and
  fallback logic after detecting their type.
- Keep the configured packaged zsh executable when the zsh-fork feature is
  enabled and the file exists.
- Update shell, unified exec, and network approval expectations to use the
  resolved local executable and arguments.

GitOrigin-RevId: ebe6f7eec2cfd1c0548d5bf1a26b7a30dba02cc2
2026-08-20 06:03:25 +00:00
rka-oai
198f42067a Keep async user messages on the direct tool surface (#39601)
## What changed

- Register `send_user_message_async` as `DirectModelOnly` so supported models can call it directly without exposing it through code mode.
- Exercise the async message flow with a code-mode-only model configuration and verify that the tool remains directly visible.

GitOrigin-RevId: ce22d5f63471ce90ac55ae2f3d0048f6cda57e01
2026-08-20 05:42:20 +00:00