Bazel analysis fails because codex_rust_crate rejects binary_test_target_compatible_with

Open 💬 0 comments Opened Jul 27, 2026 by teamleaderleo

What issue are you seeing?

At openai/codex main commit 4d1f66bf8199713e4a77ad55458bc6e3dcbef5c5, codex-rs/windows-sandbox-rs/BUILD.bazel passes this argument to codex_rust_crate:

binary_test_target_compatible_with = ["@platforms//os:windows"],

The public codex_rust_crate macro in defs.bzl does not declare that parameter.

Bazel therefore fails during package analysis before any native or Wine test target can be constructed or executed:

codex_rust_crate() got unexpected keyword argument: binary_test_target_compatible_with

This blocks the Windows sandbox package and prevents //codex-rs/core:core-all-wine-exec-test from analyzing.

What steps can reproduce the bug?

At commit 4d1f66bf8199713e4a77ad55458bc6e3dcbef5c5, run:

bazel query //codex-rs/windows-sandbox-rs:all

Bazel fails during package analysis with:

codex_rust_crate() got unexpected keyword argument: binary_test_target_compatible_with

The Wine-backed test target fails at the same analysis stage:

bazel test //codex-rs/core:core-all-wine-exec-test \
  --nocache_test_results \
  --test_output=all

Public reproduction run at c21c8a5

The same call-site/signature mismatch is present at 4d1f66b.

What is the expected behavior?

Bazel package analysis should succeed.

The generated windows-sandbox-rs-unit-tests-bin raw unit-test target should be restricted to Windows.

On Linux, the raw unit-test target and its wrapper should be treated as incompatible, while helper binaries such as codex-command-runner and codex-windows-sandbox-setup should remain compatible host dependencies for the Wine test graph.

Additional information

PR #35067 introduced the binary_test_target_compatible_with call-site argument without adding the corresponding codex_rust_crate macro parameter. This appears to be a repository sync regression.

A focused candidate repair adds the optional parameter and forwards it only to the generated raw rust_test target:

 def codex_rust_crate(
+        binary_test_target_compatible_with = [],
         ...

         rust_test(
             name = unit_test_binary,
+            target_compatible_with = binary_test_target_compatible_with,

Implementation and validation:

The failure also appears as a secondary validation blocker in #35613.

View original on GitHub ↗