Commit Graph

7469 Commits

Author SHA1 Message Date
Dylan Hurd
cefcffd692 Preserve approvals reviewer when forking threads (#34664)
## Why

Forking a persisted thread could lose its approvals reviewer and fall back to
configuration defaults.

## What changed

- Restore the latest persisted approvals reviewer from the full source history
  when creating a fork, while continuing to honor explicit overrides.
- Keep boundary-based history truncation independent from reviewer restoration,
  so a fork at an earlier turn retains the source thread's latest setting.

## Testing

- Add an app-server test that sets auto-review, forks at an earlier turn, and
  verifies the fork reports auto-review.

GitOrigin-RevId: 41c515755de7de600f71c1259f96908f2d169ca7
2026-07-22 02:47:33 +00:00
Michael Bolin
d4fcb2873b Honor configured proxy routes for auth refreshes (#34655)
## Why

ChatGPT token refresh requests need to follow the same configured routing policy as other authentication traffic, including environments that use the system proxy.

## What changed

- Require an `AuthRouteConfig` throughout login, logout, token refresh, personal access token, and agent identity flows.
- Build auth HTTP clients directly from that configuration instead of falling back to a default HTTP client when routing configuration is absent.

## Testing

- Add an integration test that refreshes a token through a cached system-proxy route and verifies the proxy receives the expected request.

GitOrigin-RevId: 7d54ab3219939a49921c51faf08cd4c2eabca51c
2026-07-22 02:26:16 +00:00
Adam Perry @ OpenAI
1823c13771 Render turn diffs for foreign environment paths (#34654)
## Why

Turn diffs need to render paths from remote environments whose path convention may differ from the Codex host.

## What changed

- Preserve `PathUri` values through applied patch deltas, display-root discovery, and turn-diff tracking.
- Add host-independent relative-path rendering and normalize Windows drive-letter case in `PathUri`.
- Render paths relative to each environment's repository root while keeping Git diff headers slash-separated.

## Testing

- Cover POSIX, Windows, UNC, encoded-separator, and opaque URI relative paths.
- Verify an applied patch in a remote Windows working directory emits a portable unified diff.

GitOrigin-RevId: 526f70ae36a40627de5496d375310d12295b69bb
2026-07-22 02:19:45 +00:00
Celia Chen
9fce9e13fd Migrate core test support to the shared HTTP client (#34651)
## What changed

- Send the streaming SSE request-body drain test through `HttpClientFactory`.
- Replace the test-support crate's direct `reqwest` dependency with
  `codex-http-client`.
- Remove `core_test_support` from the temporary direct-`reqwest` exceptions.

GitOrigin-RevId: 16ea4309d0b575592c2e59991eb6dce18d9467ed
2026-07-22 01:47:48 +00:00
Michael Bolin
a26bc337cf Require auth managers to receive routing configuration (#34650)
## Why

Auth managers should use the application's resolved HTTP client factory instead
of silently falling back to the transport's default proxy behavior.

## What changed

- Make `AuthRouteConfig` required when constructing an `AuthManager` or
  `AuthConfig`.
- Pass each production caller's resolved routing configuration through without
  wrapping it in an optional value.
- Add a test helper that explicitly selects the transport-default proxy policy
  for callers that do not exercise custom routing.

GitOrigin-RevId: d89a3b1f8b5d4007650cdac0aae241c94d598580
2026-07-22 01:35:06 +00:00
Michael Bolin
f899a79c03 Propagate resolved proxy policy through auth routing (#34649)
## Why

Auth routing represented the default proxy policy as an absent configuration,
leaving consumers to reconstruct the fallback HTTP client independently. Carry
the application's resolved policy explicitly so auth and related requests use
the same client configuration.

## What changed

- Build `AuthRouteConfig` from the resolved `HttpClientFactory` for both
  `ReqwestDefault` and `RespectSystemProxy` policies.
- Pass that route configuration through login, auth, cloud task, and cloud
  configuration flows, and reuse its factory when loading cloud configuration.
- Log cloud-task configuration load failures before falling back to the
  transport-default proxy policy.

## Testing

Extended configuration tests to verify that effective and bootstrap auth routes
select the expected proxy policy when system-proxy support is enabled or
disabled by feature requirements.

GitOrigin-RevId: d03802e2660f5cf6d940e8e718ec5c82ede7eab1
2026-07-22 01:30:44 +00:00
pakrym-oai
4a443994bd Always assign response item IDs (#34645)
## What changed

- Assign IDs to client-created response items in every session, including streamed items, forked history, compaction results, and non-OpenAI provider requests.
- Preserve server-provided IDs and stable generated IDs across persisted and resumed conversations while continuing to omit unprefixed server IDs from outbound requests.
- Retire `features.item_ids` as a configurable feature. Existing configuration and CLI toggles remain accepted as compatibility no-ops.

## Testing

- Cover default ID assignment, persistence and resume behavior, remote compaction, provider requests, WebSocket requests, and removed-feature compatibility.

GitOrigin-RevId: 7a09e2d07d2606c2ef1e8e2283d36cb555557eae
2026-07-22 01:23:44 +00:00
caseysilver-oai
690995b7c1 Verify Git plugin SHA checkouts (#34644)
## Why

Git can interpret a requested commit SHA as a branch name when the remote's
default branch has the same name. This can cause a marketplace plugin source
to materialize a different commit than the one it pinned.

## What changed

Resolve `HEAD` after checking out a SHA-pinned Git plugin source and reject the
source when the resolved commit does not exactly match the requested SHA.
Ref-name checkouts retain their existing behavior.

## Testing

Add a regression test with a default branch named after another commit's SHA
and verify that materialization rejects the mismatched checkout.

GitOrigin-RevId: c19cbd98ee6167dad7b2ee72e283b3bd30b59713
2026-07-22 01:20:13 +00:00
Michael Bolin
539c0e1100 Migrate login HTTP construction to HttpClient (#34643)
## Why

`codex-http-client` is the intended owner of direct `reqwest` usage.

## What changed

- Build Codex's default and route-aware clients with `HttpClientBuilder`, and return `HttpClient` directly to API, model discovery, auth, remote control, skills, and extension callers.
- Preserve custom CA, proxy, Cloudflare cookie, sandbox, and request-logging policies while removing `codex-login`'s direct `reqwest` dependency.
- Use shared HTTP types for auth headers, status codes, transport errors, and login-server tests.

## Testing

- Add a Linux integration test verifying that a regular Responses API turn traverses the configured system proxy.

GitOrigin-RevId: 714695fb80762d2083e2f7a6414183e2b3b63854
2026-07-22 00:50:28 +00:00
viyatb-oai
c5eb33aed1 Harden managed proxy setup for sandboxed executions (#34641)
## What changed

- Make the generated Linux proxy socket directory readable inside restricted
  `bubblewrap` sandboxes so the proxy bridge can connect.
- Route `WS_PROXY` and `WSS_PROXY` through the Linux managed proxy bridge.
- Remove inherited proxy attribution tokens from unscoped executions while
  continuing to replace them with the current token for scoped executions.

## Testing

- Exercise `WSS_PROXY` routing with a minimal filesystem policy.
- Cover attribution-token removal and replacement during environment setup.

GitOrigin-RevId: 2f14ddb26baab0147a786bc354d93eb5aad059f3
2026-07-22 00:31:30 +00:00
Michael Bolin
bdd3118c71 Update Windows process-tree tests for inherited FDs (#34640)
## Why

The PTY and pipe spawn helpers now require callers to specify which file
descriptors should be inherited, following
https://github.com/openai/codex/pull/13644.

## What changed

Pass empty inherited-FD slices from the Windows process-tree tests, which do
not need to preserve any file descriptors.

GitOrigin-RevId: 5e578df34e195251490608a163f8aaee0a6e681c
2026-07-21 23:29:03 +00:00
harinsrikanth-openai
81de4f251c Attribute review findings to repository rules (#34637)
## What changed

- Apply root and scoped project instructions using the established precedence for `AGENTS.override.md`, `AGENTS.md`, and configured fallback files.
- Treat findings as rule-supported only when repository guidance adds material, repository-specific context beyond generic correctness advice.
- Deduplicate findings without losing their supporting rules, and cite the applicable instruction file and smallest relevant line range in each rule-supported finding.
- Continue reporting ordinary findings independently of whether repository rules apply.

GitOrigin-RevId: 64b26555d92c0baa7e8e005130a7fb032b91d170
2026-07-21 23:17:20 +00:00
Eric Traut
0a39ff138e Keep the TUI open when starting a turn fails (#34636)
## What changed

- Handle app-server `turn/start` rejections for pending user turns as turn
  errors instead of exiting the TUI.
- Finalize the pending turn, display the failure in the transcript, and resume
  queued input handling.
- Add coverage that submits a turn to a missing thread and verifies that the
  error is shown while the app continues running.

GitOrigin-RevId: 6d291ba62b9e50d49dd4e3d7c429e98c1f754680
2026-07-21 23:13:12 +00:00
Michael Bolin
1b77da35cc Migrate agent identity to the shared HTTP client (#34631)
## Why

`codex-http-client` is the intended owner of direct `reqwest` usage.

## What changed

- Route agent identity registration, task registration, and JWKS requests through `HttpClient`.
- Preserve retry classification using `HttpError` and `http::StatusCode`.
- Remove `codex-agent-identity` from the temporary direct-`reqwest` dependency exceptions.

GitOrigin-RevId: 7445c9f2521e6d8ef0969a1483c81f797bf91316
2026-07-21 22:44:43 +00:00
Michael Bolin
adb143a291 Add a policy-aware HTTP client builder (#34630)
## What changed

- Add `HttpClientBuilder` for configuring default headers, redirects, the
  Cloudflare cookie store, and request diagnostics without exposing the
  underlying transport.
- Provide factory-backed construction for fixed destinations that respects
  outbound proxy policy, alongside explicit direct and legacy
  transport-default construction paths.
- Preserve the request-logging setting in `ReqwestTransport`, so disabling
  diagnostics also suppresses transport-level URL and request-body traces.
- Add `HEAD`, `DELETE`, and query-parameter helpers to the shared client
  wrappers.

## Testing

- Verify builder configuration survives policy-aware construction and custom
  CA fallback.
- Verify disabled request logging omits request URLs and bodies from transport
  traces.

GitOrigin-RevId: 529c33abefeb88f38ff9a0ead374d29fcc872e6a
2026-07-21 22:40:12 +00:00
iceweasel-oai
a26f219f67 Harden Windows elevated sandbox startup (#34629)
## What changed

- Check writable-root permissions for the sandbox group and root capability SID from a single DACL snapshot, and refresh the ACL when either SID is missing the required access or has a stale explicit delete-child grant.
- Start the command runner without loading a user profile and poll more frequently while waiting for it to become ready.
- Make the Windows sandbox binaries available to Bazel tests.

## Testing

- Add coverage that verifies ACL refresh checks every requested SID.
- Add an elevated non-TTY command test that verifies environment forwarding, stdout, and exit-code propagation.

GitOrigin-RevId: 657ed9dc906039299f9ffa4772e0926c47066a73
2026-07-21 22:36:18 +00:00
felixxia-oai
37eef7bacc Scale skill metadata budgets with model context windows (#34626)
## Why

A fixed character limit does not account for the different context-window sizes supported by models.

## What changed

- Budget extension-rendered skill metadata at 2% of the resolved model context window, capped at 4,000 tokens.
- Keep the existing 8,000-character fallback when model context metadata is unavailable.
- Include the omission marker in the budget and still emit it when no skill entry fits.
- Apply the same resolved budget to executor and host skill catalogs assembled for a turn.

## Testing

- Cover proportional and capped budgets, multibyte fallback accounting, and omission-marker behavior.
- Verify through the production turn path that larger model context windows include more catalog entries without exceeding the computed budget.

GitOrigin-RevId: 4667293f1594de4dd605b32b9fa4255d26772c0f
2026-07-21 22:16:27 +00:00
Eric Traut
bbad09a83b Fix Windows TUI navigation key handling (#34625)
## Why

Crossterm's Windows event backend expects Win32 input records. When the console
inherits virtual terminal input mode, or another console client restores it,
navigation keys instead arrive as literal escape bytes.

## What changed

- Keep the Windows console in input-record mode while the event stream is
  polled, and disable focus-change reporting on Windows.
- Preserve and restore the console's original virtual terminal input setting
  when the TUI shuts down.

## Testing

- Add unit coverage for clearing and restoring the virtual terminal input bit.

GitOrigin-RevId: 792b99e354fce357d51810a6c3b437e972ad11ce
2026-07-21 22:11:34 +00:00
iceweasel-oai
9b33613db6 Terminate Windows process trees with job objects (#34624)
## Why

Terminating a Windows execution session must also stop child processes, while a
normal root-process exit must continue to allow background descendants to run.

## What changed

- Assign Windows pipe, ConPTY, and sandbox processes to job objects and terminate
  the job when a session is cancelled, times out, or is explicitly stopped.
- Preserve descendants when the root process exits normally.
- Attach ConPTY and sandbox processes to their jobs atomically at creation; keep
  root-process termination as a fallback where job setup is unavailable.

## Testing

Added Windows coverage for descendant termination and preservation across pipe,
ConPTY, capture, cancellation, and legacy sandbox execution paths.

GitOrigin-RevId: 8f831f2fc4caaa7b79ce842a3ed7192bd02dd3b4
2026-07-21 22:07:09 +00:00
Adam Perry @ OpenAI
ded4eacdbd Increase the auto-review model override test timeout (#34622)
GitOrigin-RevId: 3f866b4788f9a4f7d036e54f2518ff95e79bebd2
2026-07-21 22:02:49 +00:00
Owen Lin
5bfd74d36c Load paginated model context across rollout lineages (#34621)
## What changed

- Resolve the full rollout lineage when loading model context for paginated threads.
- Reverse-scan each lineage segment up to its recorded byte boundary, stopping at segment metadata and preserving the requested thread's canonical session metadata.
- Add a bounded reverse-scanner constructor for scanning a frozen JSONL prefix.

## Testing

- Cover frozen-prefix reverse scans and nested lineages whose root rollout has been archived.

GitOrigin-RevId: 8b97da43a263b7bd09cb7883450bb19eba5f195f
2026-07-21 21:58:41 +00:00
viyatb-oai
d838ea0f64 Add exec-server network policy callback types (#34620)
## What changed

- Define the `network/policyRequest` RPC payloads for associating a network request with a process and returning an `allow`, `deny`, or `ask` decision.
- Cover HTTP, HTTPS CONNECT, and SOCKS5 TCP/UDP requests, with shared size limits for callback fields.
- Add the backward-compatible `requestPolicyDecisions` remote proxy option so executors can opt in to sending policy decisions to clients.
- Re-export the new protocol types from `codex-exec-server`.

## Testing

- Verify the request and decision JSON shapes.
- Verify that the proxy opt-in is omitted and defaults to `false` for legacy configurations, while an enabled value round-trips.

GitOrigin-RevId: 65b0a0723d1abb6e4f504a41d3a0dd41f5f21bf7
2026-07-21 21:54:31 +00:00
Adam Perry @ OpenAI
ad020f29ae Initialize missing-path behavior in exec-server sandbox test (#34615)
## What changed

Set `missing_path_behavior` to `None` for the minimal and project-root
filesystem entries in the custom-`arg0` exec-server test.

GitOrigin-RevId: c1d8df7b5ca8dcf6c89c314b92747bfeae80286e
2026-07-21 21:10:14 +00:00
iceweasel-oai
999a715089 Route Windows sandbox proxy traffic by restricting SID (#34613)
## Why

Elevated Windows sandboxes need stable managed-proxy ports while preserving the network policy and environment attribution of each sandboxed process.

## What changed

- Keep shared HTTP and SOCKS5 loopback ingress listeners alive across managed-proxy instances.
- Add a per-route restricting SID to elevated sandbox tokens and dispatch incoming connections to the matching proxy policy after attributing the client process.
- Reject connections without exactly one registered route, remove routes when their proxy handle is dropped, and keep unsandboxed Windows launches off the managed ingress.
- Provision the elevated sandbox with the configured proxy ports and local-binding setting, honoring the selected profile and CLI overrides.

## Testing

- Add Windows unit tests for TCP ownership attribution, route selection, restricting-token propagation, and setup settings.
- Add an end-to-end Windows test covering stable ports, isolated environment policies, HTTP and SOCKS5 routing, and route teardown.

GitOrigin-RevId: 783fac6e0f904dc9bb1955b75d4a5895e8bb9690
2026-07-21 21:06:04 +00:00
chess
dfd2d8133c Detach non-interactive subprocesses from stdin (#34612)
## What changed

Redirect stdin to null when launching:

- `codex doctor --json` for uploaded diagnostic reports
- Git commands used by `codex doctor`
- ripgrep searches over rollout files
- the Windows sandbox setup refresh helper

This keeps these non-interactive subprocesses from reading Codex's inherited
input stream.

GitOrigin-RevId: 063d191b0b1b849d74b55a7d6ff2f0b3d5212c86
2026-07-21 20:55:56 +00:00
felixxia-oai
c7e3838987 Add compatibility policies for skill catalog rendering (#34611)
## What changed

- Parameterize skill catalog rendering with explicit core- and extension-compatible description policies.
- Use full skill descriptions for core-compatible output, while extension-compatible output prefers `short_description` and falls back to the full description.
- Keep extension prompt and world-state rendering on the extension-compatible policy.

## Testing

- Add a renderer test covering description selection and fallback for both policies.

GitOrigin-RevId: 5382075f88c25a49a715feb0702a9ab888ec0123
2026-07-21 20:51:25 +00:00
Eric Traut
25d2dfcad0 Allow naming sessions with /new and /clear (#34605)
## What changed

- Accept an optional session name after `/new` or `/clear`.
- Set the requested name through the app server when starting the new thread and update the attached session with that name.
- Report naming failures in the chat while still attaching the newly created thread.

## Testing

- Cover named `/new` and `/clear` dispatch, app-server name persistence, and the existing unnamed `/clear` behavior.

GitOrigin-RevId: 570886abb4af522123f0693ce05d2415e1c0d902
2026-07-21 20:13:08 +00:00
viyatb-oai
2497972808 Allow explicitly permitted loopback proxy targets (#34603)
## Why

With `allow_local_binding = false`, proxy-aware clients bypassed the managed
proxy for loopback and private IP targets. This prevented explicit local IP and
`localhost` allowlist entries from taking effect.

## What changed

- Route local targets through the managed proxy when local binding is disabled,
  while preserving direct access when it is enabled.
- Allow a non-public connection only when its requested IP literal or
  `localhost` target is explicitly permitted. Continue blocking private
  addresses reached through unrelated hostnames.
- Bypass inherited upstream proxies for non-public targets so Codex applies the
  local-target policy directly.

## Testing

Added connector, upstream proxy, environment override, and Linux sandbox
coverage for explicitly allowlisted loopback access.

GitOrigin-RevId: 35e0d73633d5051816e096bc5aa8d586aec5eea4
2026-07-21 19:50:11 +00:00
mandal-OAI
6c00dc087e Sanitize skill names in injection metrics (#34601)
## Why

Skill names may contain characters that are not valid in metric tag values.

## What changed

Pass skill names through `sanitize_metric_tag_value` before using them as the
`skill` tag on `codex.skill.injected` counters for both explicit and implicit
skill invocations.

GitOrigin-RevId: 0ed633fbd468739acc30193b566d830e20bc7860
2026-07-21 19:25:39 +00:00
iceweasel-oai
87f71e35b8 Skip missing paths in filesystem sandbox entries (#34598)
## Why

Default read-only protections for project metadata should apply when paths such
as `.git`, `.agents`, and `.codex` exist, without causing sandbox setup to
materialize missing paths as ACL targets.

## What changed

- Add an optional `missing_path_behavior` to filesystem sandbox entries and
  mark default project-metadata protections with `skip`.
- Preserve the behavior through permission transforms and exec/MCP protocol
  serialization while keeping existing path wire variants stable.
- Ignore skip-missing entries when projecting configuration or Windows sandbox
  overrides, while retaining explicit metadata carveouts.

## Testing

- Cover protocol round trips for path and special-path entries.
- Verify default metadata protections and Windows explicit carveout handling.

GitOrigin-RevId: 6df13dadacdd131c44aab9f15a967c81051355c1
2026-07-21 19:17:18 +00:00
Abhinav
ee71c4a90f Enforce exact values from managed config requirements (#34597)
## What changed

- Apply managed values for `sqlite_home`, `log_dir`, `model_catalog_json`,
  `check_for_update_on_startup`, `allow_login_shell`, the report-submission
  opt-in, and `windows.sandbox_private_desktop` to the runtime configuration,
  with source-aware warnings when they override configured values.
- Expose these values through `configRequirements/read`, return them from
  `config/read`, include them in session config locks, and show their sources in
  the TUI config debug view.
- Reject app-server writes that overlap an exact managed requirement with
  `configRequirementReadonly` while leaving unrelated sibling keys writable.

## Testing

- Cover runtime overrides, requirement API mapping, config reads and writes,
  session lock serialization, cross-platform path URIs, and debug output.

GitOrigin-RevId: d4e23b6fd7775c1a6dfe2eab313cdcee50b07081
2026-07-21 19:08:58 +00:00
Abhinav
7442f5f932 Add keyed shell environment policy filters (#34590)
## What changed

- Add `shell_environment_policy.filters`, mapping environment-variable patterns to `include` or `exclude`, while continuing to accept the legacy `exclude` and `include_only` arrays.
- Merge filter keys case-insensitively across config layers so higher-precedence entries can override individual patterns. Switching representations replaces the other representation instead of combining them.
- Reject mixed, duplicate, or malformed filter definitions in enabled layers, config writes, and reloads, while retaining the previous session configuration when a reload is invalid.
- Make config-manager reads and writes representation-aware and preserve existing formatting when updating individual policy values.

## Testing

Add coverage for parsing, schema constraints, layered merging, validation and diagnostics, config writes, override metadata, and invalid session reloads.

GitOrigin-RevId: e15464bca53e6e7ef31fcc97537fda60ed5d670a
2026-07-21 18:23:26 +00:00
jif
65f8bf6853 Bind MCP calls to captured catalog revisions (#34588)
## Why

An MCP connection or tool catalog can change after a model step captures its
available tools. Calls from that step must not be rerouted to a replacement
client or run against a catalog revision the model did not see.

## What changed

- Add `McpBinding` to capture the ready clients, visible tools, resources, and
  server metadata for one sampling request.
- Prepare calls against the captured client and reject them if the tool catalog
  changes before call preparation and execution finish.
- Keep resource access and cache identity tied to the binding's exact connection
  set, and omit servers that do not have a ready client.
- Preserve each client's unfiltered tool catalog so bindings can apply the
  current filter consistently.

## Testing

Add coverage for connection replacement, stale catalog rejection, serialized
call preparation and refresh, ready-client capture, and binding-scoped resource
identity.

GitOrigin-RevId: a25da4d2c7f5ed06c41caa0c6d15c464c1698314
2026-07-21 18:13:41 +00:00
jif
51200321eb Add routing-card lexical skill selection (#34581)
## What changed

- Add a bounded `routing_card_exact_v1` selector that ranks normalized exact
  matches across skill names, tool dependencies, short descriptions, and full
  descriptions, with stronger weights for routing-specific fields.
- Run the selector in the shadow selection experiment and include catalog entry
  dependencies in selection documents.
- Report a selection as `selected` when an exact-name match succeeds even if
  the query contains no searchable terms.

## Testing

- Cover dependency ranking, stop-word skill names, exact-term matching, and
  input bounds.

GitOrigin-RevId: dfb0b668d726f64ae5da3b3ce2d8c9b23a664ac0
2026-07-21 17:18:01 +00:00
pakrym-oai
af71774d26 Gate the TUI suspend restore helper on Unix (#34578)
Compile `tui::restore` only on Unix, matching its use by the Unix job-control
suspension path.

GitOrigin-RevId: d0ce03def8905e94376ec7f5acf8d083d5dde05b
2026-07-21 16:57:43 +00:00
brisebois-oai
6ac68be6fe Accept forceRefetch in plugin list requests (#34573)
## What changed

- Add the optional `forceRefetch` boolean to `PluginListParams` and generated schemas.
- Accept both omitted and enabled values without changing `plugin/list` behavior yet.
- Cover deserialization of the enabled value in the protocol tests.

GitOrigin-RevId: fd4145161e9779638bc0bf18118d5ab5b8478745
2026-07-21 16:30:17 +00:00
Eric Traut
726689564a Highlight CUDA files as C++ in the TUI (#34570)
## What changed

- Map `.cu` and `.cuh` extensions to the C++ syntax definition so CUDA source
  and header files receive syntax highlighting.
- Extend syntax lookup and rendered-diff tests to cover both extensions.

GitOrigin-RevId: 5484ea9e30f9e4df788b0079596ec0239e8ef8d5
2026-07-21 15:53:33 +00:00
Owen Lin
0b175e6439 Protect fork history references during rollout cleanup (#34566)
## Why

Paginated forks can retain a `history_base` pointer to another rollout. Deleting or compressing either side of that relationship can leave the fork without the rollout history it references.

## What changed

- Add a rollout reference index that scans active, archived, and compressed rollout metadata.
- Reject deletion when a rollout is still referenced by a fork outside the requested deletion set.
- Delete spawned thread subtrees as one store operation so internal references do not block deleting the complete subtree, while external references preflight the request before any files are removed.
- Skip referenced rollouts, fork-pointer rollouts, and rollouts with unreadable metadata during background compression.

## Testing

- Cover reference indexing across active, archived, compressed, duplicate, and self-referencing rollouts.
- Verify deletion rejects external references without partially deleting a subtree and permits batch deletion of internally referenced threads.
- Verify compression preserves fork pointer chains and continues past unreadable metadata.

GitOrigin-RevId: a8672727f8706e743d7fb3ca895a1d9ceac98a3c
2026-07-21 15:18:56 +00:00
Owen Lin
7bb13ab846 Page through inherited thread history (#34563)
## What changed

- Resolve a thread's rollout lineage when listing paginated turns and items.
- Page across parent, child, and nested fork segments in either direction while respecting each segment's ordinal bounds.
- Encode the physical segment in history cursors and reject cursors that belong to another requested thread or fall outside its lineage.
- Load turn summaries and filtered items from inherited segments.

## Testing

- Added coverage for forward and backward pagination across parent and child history, inherited summary and filtered items, cursor isolation, and nested forks.

GitOrigin-RevId: b803fff781fcb6e21d0e151189290148fc8d8b18
2026-07-21 15:14:55 +00:00
Owen Lin
175f82147f Record rollout boundaries for materialized turns (#34562)
## What changed

- Store the starting byte offset and terminal ordinal and byte offset for each turn projected into SQLite.
- Advance offsets across blank and rejected physical lines while leaving incomplete trailing lines for the next materialization pass.
- Stop later rollout records from changing a turn after it reaches a terminal state.

## Testing

- Cover active and completed turn positions, trailing partial lines, skipped invalid lines, subagent history prefixes, and records received after terminal state.

GitOrigin-RevId: a7da2f0b00c0bf47b841db874c79a0d495c18acd
2026-07-21 15:10:42 +00:00
jif
f6aad1f363 Extract MCP binding clients from the connection manager (#34561)
## What changed

- Add `McpBindingClients` to hold the ready MCP clients captured for a model step.
- Move concurrent, paginated resource and resource-template listing into the new helper.
- Keep server filtering in `McpConnectionManager` while preserving per-client timeouts, duplicate-cursor detection, and warning behavior.

GitOrigin-RevId: 0e3f8f135126b17d73058ca84e98493a27543ca0
2026-07-21 15:04:43 +00:00
jay
98c3bbdc79 Add backend client support for Codex user settings (#34559)
## What changed

- Add `Client::get_user_settings` for the active Codex API or ChatGPT backend route.
- Send authenticated workspace headers and bypass cached responses when fetching settings.
- Expose the effective `commit_attribution_enabled` policy, defaulting it to `false` when older responses omit the field.

## Testing

- Cover both backend route styles, cache-control behavior, response decoding, the compatibility default, and authenticated workspace headers.

GitOrigin-RevId: 11db485e89293f9fa9c56ac7997922deed8b9427
2026-07-21 15:00:18 +00:00
jif
268288ad6d Remove obsolete ignored tests (#34558)
## What changed

Remove ignored tests for cloud-task composer rendering, delegated approval
forwarding, and unified-exec session pruning, along with their unused imports.

GitOrigin-RevId: 66ae0d3b672f6471a52ba0479bbd8119e12182f1
2026-07-21 14:57:39 +00:00
jif
40a719238c Remove the unused TUI shutdown app command (#34553)
Remove the unconstructed `AppCommand::Shutdown` variant, its helper, and its
pending interactive replay handling.

GitOrigin-RevId: 25e8ac7ebf2498a7d70ad1625d363395a9c6f578
2026-07-21 14:25:18 +00:00
jif
4c2dc5d285 Remove unused RtOptions setters (#34552)
GitOrigin-RevId: 597fc842f1e7fa880982eb16e7641ce7fd901ae4
2026-07-21 14:21:00 +00:00
jif
b5b8a63fea Simplify TUI restoration for the external editor (#34551)
## What changed

Remove the unused `RestoreMode` selection from `Tui::with_restored`. The helper
now always restores the terminal while keeping raw mode enabled, matching its
external-editor call site.

GitOrigin-RevId: b820aaaa933d7354d2a21b95900b059b3e8e2ac6
2026-07-21 14:16:40 +00:00
jif
27a9c4d6bd Test thread-scoped MCP refresh behavior (#34550)
## What changed

Add regression coverage that MCP refreshes:

- combine the latest global MCP server configuration with per-thread overrides;
- leave the thread's stored MCP configuration unchanged when a strict refresh queues updated runtime settings.

GitOrigin-RevId: 7a6b32d931cc578d6875ec276208b90c6c6a076f
2026-07-21 14:12:13 +00:00
jif
6915bac7ba Add reciprocal rank fusion skill selection (#34547)
## What changed

- Add a skill selector that uses reciprocal rank fusion to combine the top 50 results from the weighted lexical and character n-gram selectors.
- Prefer candidates supported by both rankings, with deterministic rank and identifier tie-breakers, and propagate truncation metadata from both selectors.
- Include the fused selector in the shadow-selection experiment under `rrf_lexical_char_v1`.

## Testing

- Add unit coverage for cross-ranking support, deterministic tie-breaking, and combined input-bound reporting.

GitOrigin-RevId: 3165136b8729ea3a9484f25c7f2ce0f91fb8aaa9
2026-07-21 13:49:22 +00:00
jif
2d5c259202 Size Noise handshake buffers to their messages (#34544)
## What changed

Allocate Noise handshake input and output buffers from the actual message size
and the handshake-reported overhead instead of placing maximum-size arrays on
the stack. Truncate variable-length buffers to the bytes produced or read.

GitOrigin-RevId: d4776079ad8116b3cfe1ceaa37c04509d31d1436
2026-07-21 13:39:33 +00:00
chess
0c01a18ede Detach Git metadata commands from stdin (#34540)
## Why

Git metadata commands can otherwise inherit an open input stream and wait for
input instead of completing independently.

## What changed

Set stdin to null for both fsmonitor probes and timed Git metadata commands.

## Testing

Add a regression test that holds the parent input stream open and verifies that
both command paths complete with `git cat-file --batch`.

GitOrigin-RevId: a0575ad7c9c7cfdebc25e3ff641537033957d851
2026-07-21 13:34:39 +00:00