Commit Graph

14752 Commits

Author SHA1 Message Date
Michael Bolin
ef9a99561c Merge b6057de94b into sapling-pr-archive-bolinfest 2026-05-01 16:25:41 -07:00
Michael Bolin
b6057de94b ci: cross-compile Windows Bazel clippy 2026-05-01 16:24:58 -07:00
Michael Bolin
f73e128f3f Merge 999cbdb177 into sapling-pr-archive-bolinfest 2026-05-01 16:19:56 -07:00
Michael Bolin
999cbdb177 config: add strict config parsing 2026-05-01 16:19:22 -07:00
Michael Bolin
a55373a277 Merge 5a1d1782b3 into sapling-pr-archive-bolinfest 2026-05-01 16:13:55 -07:00
Michael Bolin
5a1d1782b3 ci: cross-compile Windows Bazel clippy 2026-05-01 16:13:46 -07:00
Michael Bolin
8a3ad9ea1e Merge f80b7b4e6e into sapling-pr-archive-bolinfest 2026-05-01 16:10:32 -07:00
Michael Bolin
f80b7b4e6e ci: cross-compile Windows Bazel clippy 2026-05-01 16:10:12 -07:00
Michael Bolin
407d096d27 merge commit for archive created by Sapling 2026-05-01 16:05:12 -07:00
Michael Bolin
bbec96c976 config: add strict config parsing 2026-05-01 16:04:58 -07:00
Michael Bolin
5ef1f1fdb0 Merge 26c3259130 into sapling-pr-archive-bolinfest 2026-05-01 15:56:29 -07:00
Michael Bolin
26c3259130 config: add strict config parsing 2026-05-01 15:55:35 -07:00
Michael Bolin
466798aa83 ci: cross-compile Windows Bazel tests (#20585)
## Status

This is the Bazel PR-CI cross-compilation follow-up to #20485. It is
intentionally split from the Cargo/cargo-xwin release-build PoC so
#20485 can stay as the historical release-build exploration. The
unrelated async-utils test cleanup has been moved to #20686, so this PR
is focused on the Windows Bazel CI path.

The intended tradeoff is now explicit in `.github/workflows/bazel.yml`:
pull requests get the fast Windows cross-compiled Bazel test leg, while
post-merge pushes to `main` run both that fast cross leg and a fully
native Windows Bazel test leg. The native main-only job keeps full
V8/code-mode coverage and gets a 40-minute timeout because it is less
latency-sensitive than PR CI. All other Bazel jobs remain at 30 minutes.

## Why

Windows Bazel PR CI currently does the expensive part of the build on
Windows. A native Windows Bazel test job on `main` completed in about
28m12s, leaving very little headroom under the 30-minute job timeout and
making Windows the slowest PR signal.

#20485 showed that Windows cross-compilation can be materially faster
for Cargo release builds, but PR CI needs Bazel because Bazel owns our
test sharding, flaky-test retries, and integration-test layout. This PR
applies the same high-level shape we already use for macOS Bazel CI:
compile with remote Linux execution, then run platform-specific tests on
the platform runner.

The compromise is deliberately signal-aware: code-mode/V8 changes are
rare enough that PR CI can accept losing the direct V8/code-mode
smoke-test signal temporarily, while `main` still runs the native
Windows job post-merge to catch that class of regression. A follow-up PR
should investigate making the cross-built Windows gnullvm V8 archive
pass the direct V8/code-mode tests so this tradeoff can eventually go
away.

## What Changed

- Adds a `ci-windows-cross` Bazel config that targets
`x86_64-pc-windows-gnullvm`, uses Linux RBE for build actions, and keeps
`TestRunner` actions local on the Windows runner.
- Adds explicit Windows platform definitions for
`windows_x86_64_gnullvm`, `windows_x86_64_msvc`, and a bridge toolchain
that lets gnullvm test targets execute under the Windows MSVC host
platform.
- Updates the Windows Bazel PR test leg to opt into the cross-compile
path via `--windows-cross-compile` and `--remote-download-toplevel`.
- Adds a `test-windows-native-main` job that runs only for `push` events
on `refs/heads/main`, uses the native Windows Bazel path, includes
V8/code-mode smoke tests, and has `timeout-minutes: 40`.
- Keeps fork/community PRs without `BUILDBUDDY_API_KEY` on the previous
local Windows MSVC-host fallback, including
`--host_platform=//:local_windows_msvc` and `--jobs=8`.
- Preserves the existing integration-test shape on non-gnullvm
platforms, while generating Windows-cross wrapper targets only for
`windows_gnullvm`.
- Resolves `CARGO_BIN_EXE_*` values from runfiles at test runtime,
avoiding hard-coded Cargo paths and duplicate test runfiles.
- Extends the V8 Bazel patches enough for the
`x86_64-pc-windows-gnullvm` target and Linux remote execution path.
- Makes the Windows sandbox test cwd derive from `INSTA_WORKSPACE_ROOT`
at runtime when Bazel provides it, because cross-compiled binaries may
contain Linux compile-time paths.
- Keeps the direct V8/code-mode unit smoke tests out of the Windows
cross PR path for now while native Windows CI continues to cover them
post-merge.

## Command Shape

The fast Windows PR test leg invokes the normal Bazel CI wrapper like
this:

```shell
./.github/scripts/run-bazel-ci.sh \
  --print-failed-action-summary \
  --print-failed-test-logs \
  --windows-cross-compile \
  --remote-download-toplevel \
  -- \
  test \
  --test_tag_filters=-argument-comment-lint \
  --test_verbose_timeout_warnings \
  --build_metadata=COMMIT_SHA=${GITHUB_SHA} \
  -- \
  //... \
  -//third_party/v8:all \
  -//codex-rs/code-mode:code-mode-unit-tests \
  -//codex-rs/v8-poc:v8-poc-unit-tests
```

With the BuildBuddy secret available on Windows, the wrapper selects
`--config=ci-windows-cross` and appends the important Windows-cross
overrides after rc expansion:

```shell
--host_platform=//:rbe
--shell_executable=/bin/bash
--action_env=PATH=/usr/bin:/bin
--host_action_env=PATH=/usr/bin:/bin
--test_env=PATH=${CODEX_BAZEL_WINDOWS_PATH}
```

The native post-merge Windows job intentionally omits
`--windows-cross-compile` and does not exclude the V8/code-mode unit
targets:

```shell
./.github/scripts/run-bazel-ci.sh \
  --print-failed-action-summary \
  --print-failed-test-logs \
  -- \
  test \
  --test_tag_filters=-argument-comment-lint \
  --test_verbose_timeout_warnings \
  --build_metadata=COMMIT_SHA=${GITHUB_SHA} \
  --build_metadata=TAG_windows_native_main=true \
  -- \
  //... \
  -//third_party/v8:all
```

## Research Notes

The existing macOS Bazel CI config already uses the model we want here:
build actions run remotely with `--strategy=remote`, but `TestRunner`
actions execute on the macOS runner. This PR mirrors that pattern for
Windows with `--strategy=TestRunner=local`.

The important Bazel detail is that `rules_rs` is already targeting
`x86_64-pc-windows-gnullvm` for Windows Bazel PR tests. This PR changes
where the build actions execute; it does not switch the Bazel PR test
target to Cargo, `cargo-nextest`, or the MSVC release target.

Cargo release builds differ from this Bazel path for V8: the normal
Windows Cargo release target is MSVC, and `rusty_v8` publishes prebuilt
Windows MSVC `.lib.gz` archives. The Bazel PR path targets
`windows-gnullvm`; `rusty_v8` does not publish a prebuilt Windows
GNU/gnullvm archive, so this PR builds that archive in-tree. That
Linux-RBE-built gnullvm archive currently crashes in direct V8/code-mode
smoke tests, which is why the workflow keeps native Windows coverage on
`main`.

The less obvious Bazel detail is test wrapper selection. Bazel chooses
the Windows test wrapper (`tw.exe`) from the test action execution
platform, not merely from the Rust target triple. The outer
`workspace_root_test` therefore declares the default test toolchain and
uses the bridge toolchain above so the test action executes on Windows
while its inner Rust binary is built for gnullvm.

The V8 investigation exposed a Windows-client gotcha: even when an
action execution platform is Linux RBE, Bazel can still derive the
genrule shell path from the Windows client. That produced remote
commands trying to run `C:\Program Files\Git\usr\bin\bash.exe` on Linux
workers. The wrapper now passes `--shell_executable=/bin/bash` with
`--host_platform=//:rbe` for the Windows cross path.

The same Windows-client/Linux-RBE boundary also affected
`third_party/v8:binding_cc`: a multiline genrule command can carry CRLF
line endings into Linux remote bash, which failed as `$'\r'`. That
genrule now keeps the `sed` command on one physical shell line while
using an explicit Starlark join so the shell arguments stay readable.

## Verification

Local checks included:

```shell
bash -n .github/scripts/run-bazel-ci.sh
bash -n workspace_root_test_launcher.sh.tpl
ruby -e "require %q{yaml}; YAML.load_file(%q{.github/workflows/bazel.yml}); puts %q{ok}"
RUNNER_OS=Linux ./scripts/list-bazel-clippy-targets.sh
RUNNER_OS=Windows ./scripts/list-bazel-clippy-targets.sh
RUNNER_OS=Linux ./tools/argument-comment-lint/list-bazel-targets.sh
RUNNER_OS=Windows ./tools/argument-comment-lint/list-bazel-targets.sh
```

The Linux clippy and argument-comment target lists contain zero
`*-windows-cross-bin` labels, while the Windows lists still include 47
Windows-cross internal test binaries.

CI evidence:

- Baseline native Windows Bazel test on `main`: success in about 28m12s,
https://github.com/openai/codex/actions/runs/25206257208/job/73907325959
- Green Windows-cross Bazel run on the split PR before adding the
main-only native leg: Windows test 9m16s, Windows release verify 5m10s,
Windows clippy 4m43s,
https://github.com/openai/codex/actions/runs/25231890068
- The latest SHA adds the explicit PR-vs-main tradeoff in `bazel.yml`;
CI is rerunning on that focused diff.

## Follow-Up

A subsequent PR should investigate making a cross-built Windows binary
work with V8/code-mode enabled. Likely options are either making the
Linux-RBE-built `windows-gnullvm` V8 archive correct at runtime, or
evaluating whether a Bazel MSVC target/toolchain can reuse the same
prebuilt MSVC `rusty_v8` archive shape that Cargo release builds already
use.
2026-05-01 15:55:28 -07:00
Michael Bolin
c0a62f12a0 Merge dbf9b746e7 into sapling-pr-archive-bolinfest 2026-05-01 15:54:14 -07:00
Michael Bolin
dbf9b746e7 config: add strict config parsing 2026-05-01 15:53:36 -07:00
Michael Bolin
1e3ae27a47 merge commit for archive created by Sapling 2026-05-01 15:13:37 -07:00
Michael Bolin
b3ce7557e2 ci: cross-compile Windows Bazel tests 2026-05-01 15:13:20 -07:00
Channing Conger
a5fbcf1ab4 Prune unused code-mode globals (#20542)
Hide Atomics, SharedArrayBuffer, and WebAssembly from the code-mode
runtime since the harness does not expose worker support or need those
APIs.
2026-05-01 15:11:22 -07:00
starr-openai
2952beb009 Surface multi-environment choices in environment context (#20646)
## Why
The model needs a way to see which environments are available during a
multi-environment turn without changing the legacy single-environment
prompt surface or pulling replay/persistence changes into the same
review.

## Stack
1. https://github.com/openai/codex/pull/20646 - `EnvironmentContext`
rendering for selected environments (this PR)
2. https://github.com/openai/codex/pull/20669 - selected-environment
ownership and tool config prep
3. https://github.com/openai/codex/pull/20647 - process-tool
`environment_id` routing

## What Changed
- extend `environment_context` so multi-environment turns render an
`<environments>` block with the selected environment ids and cwd values
- keep zero- and single-environment turns on the existing cwd-only
render path
- keep replay and persistence paths on the legacy surface for now so
this PR stays scoped to live prompt rendering
- add focused coverage in
`codex-rs/core/src/context/environment_context_tests.rs`

## Testing
- CI

---------

Co-authored-by: Codex <noreply@openai.com>
2026-05-01 22:11:06 +00:00
Michael Bolin
4155fcb896 Merge 70f78dddbe into sapling-pr-archive-bolinfest 2026-05-01 15:03:44 -07:00
Michael Bolin
70f78dddbe ci: cross-compile Windows Bazel tests 2026-05-01 15:03:35 -07:00
Michael Bolin
b3aaed0d8b Merge 424b183876 into sapling-pr-archive-bolinfest 2026-05-01 14:50:28 -07:00
Michael Bolin
424b183876 ci: cross-compile Windows Bazel tests 2026-05-01 14:50:18 -07:00
Abhinav
d55479488e Clear live hook rows when turns finalize (#20674)
# Why

When a user interrupts a turn while a hook is still running, the normal
turn status is cleared but the separate live hook row can remain visible
as `Running` because the TUI may never receive a matching
`HookCompleted` event before cancellation. Once the turn itself is
finalized, that turn-scoped live state should not remain on screen.

# What

- clear any still-live `active_hook_cell` during turn finalization
- add a regression snapshot covering an interrupted turn with a visible
`PreToolUse` hook row

# Testing

- `cargo test -p codex-tui interrupted_turn_clears_visible_running_hook`
- attempted `cargo test -p codex-tui` (currently aborts on unrelated
existing stack overflow in
`app::tests::discard_side_thread_removes_agent_navigation_entry`)
2026-05-01 14:48:22 -07:00
Michael Bolin
000afcfda8 merge commit for archive created by Sapling 2026-05-01 14:32:10 -07:00
Michael Bolin
ba63116378 config: add strict config parsing 2026-05-01 14:31:52 -07:00
Michael Bolin
f57e63a445 Merge b5683ea808 into sapling-pr-archive-bolinfest 2026-05-01 14:18:24 -07:00
Michael Bolin
b5683ea808 ci: cross-compile Windows Bazel tests 2026-05-01 14:18:08 -07:00
Michael Bolin
a49d4241ee Merge 5ba42268e8 into sapling-pr-archive-bolinfest 2026-05-01 14:17:16 -07:00
Michael Bolin
5ba42268e8 test: make async cancellation test deterministic 2026-05-01 14:17:01 -07:00
Abhinav
443f6b831e Use the 2025-06-18 elicitation capability shape (#20562)
# Why

Codex currently negotiates MCP `2025-06-18`, where the client
elicitation capability is represented as an empty object. We were still
serializing `capabilities.elicitation.form`, which belongs to the later
capability shape and can cause strict `2025-06-18` servers to reject
`initialize` with an unrecognized-field error.

This keeps the handshake aligned with the protocol version Codex
actually negotiates and fixes the compatibility regression tracked in
#17492.

# What

- Serialize the client elicitation capability as `elicitation: {}` for
`2025-06-18`.
- Keep elicitation advertised for both Codex Apps and custom MCP
servers.
- Tighten regression coverage so the unit test asserts both the Rust
value and the serialized wire shape.
- Add an app-server integration test that round-trips a form elicitation
from a custom MCP server; the existing connector round-trip continues to
cover the connector path.

# Verification

- `cargo test -p codex-mcp`
- `cargo test -p codex-app-server mcp_server_elicitation_round_trip`
- `cargo test -p codex-app-server
mcp_server_tool_call_round_trips_elicitation`

# Next steps

- Decide whether `tool_call_mcp_elicitation=false` should also suppress
capability advertisement during `initialize`.
- Revisit `form` / `url` capability advertisement when Codex is ready to
negotiate MCP `2025-11-25`, which defines that newer shape.
2026-05-01 14:16:22 -07:00
Michael Bolin
b491802566 Merge 79a259e476 into sapling-pr-archive-bolinfest 2026-05-01 13:31:38 -07:00
Michael Bolin
79a259e476 ci: cross-compile Windows Bazel tests 2026-05-01 13:31:27 -07:00
Michael Bolin
9cb775190c merge commit for archive created by Sapling 2026-05-01 13:17:37 -07:00
Michael Bolin
7be09d1904 config: add strict config parsing 2026-05-01 13:17:22 -07:00
Michael Bolin
2398f07395 Merge a8f5a8ce13 into sapling-pr-archive-bolinfest 2026-05-01 13:08:31 -07:00
Michael Bolin
a8f5a8ce13 config: add strict config parsing 2026-05-01 13:08:23 -07:00
Michael Bolin
f32a0d4c13 Merge 79ad051875 into sapling-pr-archive-bolinfest 2026-05-01 13:02:17 -07:00
Michael Bolin
79ad051875 ci: cross-compile Windows Bazel tests 2026-05-01 13:02:06 -07:00
Michael Bolin
525b1119c0 merge commit for archive created by Sapling 2026-05-01 12:54:55 -07:00
Michael Bolin
849c3aaa41 ci: cross-compile Windows Bazel tests 2026-05-01 12:54:34 -07:00
Michael Bolin
1caaac1ce3 Merge c4c13e2b09 into sapling-pr-archive-bolinfest 2026-05-01 12:36:08 -07:00
Michael Bolin
c4c13e2b09 config: add strict config parsing 2026-05-01 12:36:00 -07:00
Michael Bolin
d4dfc7e548 merge commit for archive created by Sapling 2026-05-01 12:33:24 -07:00
Michael Bolin
cbbc2016ef ci: cross-compile Windows Bazel tests 2026-05-01 12:33:03 -07:00
Michael Bolin
b689006860 Merge 6b51c774b0 into sapling-pr-archive-bolinfest 2026-05-01 12:10:03 -07:00
Michael Bolin
6b51c774b0 ci: cross-compile Windows Bazel tests 2026-05-01 12:09:51 -07:00
Michael Bolin
7f03323e3f merge commit for archive created by Sapling 2026-05-01 12:03:54 -07:00
Michael Bolin
94d8d4832f config: add strict config parsing 2026-05-01 12:03:36 -07:00
Michael Bolin
05f867cc5c Merge 97731fcb7b into sapling-pr-archive-bolinfest 2026-05-01 11:34:56 -07:00