codex: address PR review feedback (#28598)

This commit is contained in:
Adam Perry
2026-06-22 21:09:16 +00:00
parent 595f09d6e2
commit fa66272262
53 changed files with 31 additions and 231 deletions
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "agent-graph-store",
crate_name = "codex_agent_graph_store",
test_sizes = {
"agent-graph-store-unit-tests-windows-cross": "medium",
},
)
-6
View File
@@ -3,10 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "agent-identity",
crate_name = "codex_agent_identity",
# This test is short once running, but it hit the 60s Windows timeout when
# several freshly invalidated tests launched together. Serialize local runs
# to avoid runner startup contention while keeping the small test size.
test_tags_by_target = {
"agent-identity-unit-tests-windows-cross": ["exclusive-if-local"],
},
)
-3
View File
@@ -7,7 +7,4 @@ codex_rust_crate(
["schema/**"],
allow_empty = True,
),
test_sizes = {
"app-server-protocol-schema_fixtures-test-windows-cross": "medium",
},
)
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "app-server-transport",
crate_name = "codex_app_server_transport",
test_sizes = {
"app-server-transport-unit-tests-windows-cross": "medium",
},
)
+3 -3
View File
@@ -18,11 +18,11 @@ codex_rust_crate(
# long. Using a higher shard count for app-server-all-test should help
# mitigate this risk.
"app-server-all-test": 32,
# Windows-cross tests get a five-minute budget and pay more per-shard
# process startup overhead, so fewer shards keep the work comfortably
# under budget without multiplying that overhead.
"app-server-all-test-windows-cross": 8,
"app-server-unit-tests": 8,
},
test_sizes = {
"app-server-all-test-windows-cross": "medium",
},
test_tags = ["no-sandbox"],
)
-12
View File
@@ -3,16 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "apply-patch",
crate_name = "codex_apply_patch",
test_sizes = {
"apply-patch-all-test-windows-cross": "medium",
},
# Cold Windows runs take about 54s, while remote results have reported
# about 1s and made the medium budget look oversized. Run it alone and
# bypass remote test-result caching so CI measures the cold runtime.
test_tags_by_target = {
"apply-patch-all-test-windows-cross": [
"exclusive-if-local",
"no-remote-cache",
],
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "code-mode-protocol",
crate_name = "codex_code_mode_protocol",
test_sizes = {
"code-mode-protocol-unit-tests-windows-cross": "medium",
},
)
-4
View File
@@ -3,8 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "codex-api",
crate_name = "codex_api",
test_sizes = {
"codex-api-clients-test-windows-cross": "medium",
"codex-api-unit-tests-windows-cross": "medium",
},
)
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "codex-backend-openapi-models",
crate_name = "codex_backend_openapi_models",
test_sizes = {
"codex-backend-openapi-models-unit-tests-windows-cross": "medium",
},
)
@@ -4,7 +4,4 @@ codex_rust_crate(
name = "codex-experimental-api-macros",
crate_name = "codex_experimental_api_macros",
proc_macro = True,
test_sizes = {
"codex-experimental-api-macros-unit-tests-windows-cross": "medium",
},
)
@@ -4,9 +4,6 @@ codex_rust_crate(
name = "collaboration-mode-templates",
compile_data = glob(["templates/*.md"]),
crate_name = "codex_collaboration_mode_templates",
test_sizes = {
"collaboration-mode-templates-unit-tests-windows-cross": "medium",
},
)
exports_files(
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "connectors",
crate_name = "codex_connectors",
test_sizes = {
"connectors-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "context-fragments",
crate_name = "codex_context_fragments",
test_sizes = {
"context-fragments-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -12,7 +12,4 @@ codex_rust_crate(
],
),
crate_name = "codex_core_plugins",
test_sizes = {
"core-plugins-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -12,7 +12,4 @@ codex_rust_crate(
],
),
crate_name = "codex_core_skills",
test_sizes = {
"core-skills-unit-tests-windows-cross": "medium",
},
)
-4
View File
@@ -48,9 +48,5 @@ codex_rust_crate(
"core-unit-tests": 32,
"core-unit-tests-windows-cross": 4,
},
test_sizes = {
"core-all-test-windows-cross": "medium",
"core-unit-tests-windows-cross": "medium",
},
test_tags = ["no-sandbox"],
)
-3
View File
@@ -16,8 +16,5 @@ codex_rust_crate(
# they install process-global test-binary dispatch state, and the remote
# exec-server cases already rely on serialization around the full CLI path.
integration_test_args = ["--test-threads=1"],
test_sizes = {
"exec-server-unit-tests-windows-cross": "medium",
},
test_tags = ["no-sandbox"],
)
-3
View File
@@ -7,8 +7,5 @@ codex_rust_crate(
"exec-all-test": 16,
"exec-all-test-windows-cross": 2,
},
test_sizes = {
"exec-all-test-windows-cross": "medium",
},
test_tags = ["no-sandbox"],
)
-3
View File
@@ -11,7 +11,4 @@ codex_rust_crate(
],
),
crate_name = "codex_features",
test_sizes = {
"features-unit-tests-windows-cross": "medium",
},
)
-6
View File
@@ -3,10 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "file-system",
crate_name = "codex_file_system",
# This test is short once running, but it hit the 60s Windows timeout when
# several freshly invalidated tests launched together. Serialize local runs
# to avoid runner startup contention while keeping the small test size.
test_tags_by_target = {
"file-system-unit-tests-windows-cross": ["exclusive-if-local"],
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "git-utils",
crate_name = "codex_git_utils",
test_sizes = {
"git-utils-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "keyring-store",
crate_name = "codex_keyring_store",
test_sizes = {
"keyring-store-unit-tests-windows-cross": "medium",
},
)
-4
View File
@@ -6,8 +6,4 @@ codex_rust_crate(
extra_binaries = [
"//codex-rs/bwrap:bwrap",
],
test_sizes = {
"linux-sandbox-all-test-windows-cross": "medium",
"linux-sandbox-unit-tests-windows-cross": "medium",
},
)
-6
View File
@@ -3,10 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "read",
crate_name = "codex_memories_read",
# This test is short once running, but it hit the 60s Windows timeout when
# several freshly invalidated tests launched together. Serialize local runs
# to avoid runner startup contention while keeping the small test size.
test_tags_by_target = {
"read-unit-tests-windows-cross": ["exclusive-if-local"],
},
)
-3
View File
@@ -6,7 +6,4 @@ codex_rust_crate(
"templates/**",
]),
crate_name = "codex_memories_write",
test_sizes = {
"write-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -12,7 +12,4 @@ codex_rust_crate(
],
),
crate_name = "codex_plugin",
test_sizes = {
"plugin-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "process-hardening",
crate_name = "codex_process_hardening",
test_sizes = {
"process-hardening-unit-tests-windows-cross": "medium",
},
)
-4
View File
@@ -6,8 +6,4 @@ codex_rust_crate(
extra_binaries = [
"//codex-rs/cli:codex",
],
test_sizes = {
"rmcp-client-streamable_http_recovery-test-windows-cross": "medium",
"rmcp-client-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "rollout",
crate_name = "codex_rollout",
test_sizes = {
"rollout-unit-tests-windows-cross": "medium",
},
)
-6
View File
@@ -3,10 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "secrets",
crate_name = "codex_secrets",
# This test is short once running, but it hit the 60s Windows timeout when
# several freshly invalidated tests launched together. Serialize local runs
# to avoid runner startup contention while keeping the small test size.
test_tags_by_target = {
"secrets-unit-tests-windows-cross": ["exclusive-if-local"],
},
)
-3
View File
@@ -4,7 +4,4 @@ codex_rust_crate(
name = "shell-command",
compile_data = ["src/command_safety/powershell_parser.ps1"],
crate_name = "codex_shell_command",
test_sizes = {
"shell-command-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "shell-escalation",
crate_name = "codex_shell_escalation",
test_sizes = {
"shell-escalation-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -12,7 +12,4 @@ codex_rust_crate(
],
),
crate_name = "codex_skills",
test_sizes = {
"skills-unit-tests-windows-cross": "medium",
},
)
-12
View File
@@ -9,16 +9,4 @@ codex_rust_crate(
"migrations/**",
]),
crate_name = "codex_state",
test_sizes = {
"state-unit-tests-windows-cross": "medium",
},
# Cold Windows runs exceed the 60s short timeout, while remote results have
# reported about 15s and made the medium budget look oversized. Run it alone
# and bypass remote test-result caching so CI measures the cold runtime.
test_tags_by_target = {
"state-unit-tests-windows-cross": [
"exclusive-if-local",
"no-remote-cache",
],
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "stdio-to-uds",
crate_name = "codex_stdio_to_uds",
test_sizes = {
"stdio-to-uds-stdio_to_uds-test-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "terminal-detection",
crate_name = "codex_terminal_detection",
test_sizes = {
"terminal-detection-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "uds",
crate_name = "codex_uds",
test_sizes = {
"uds-unit-tests-windows-cross": "medium",
},
)
@@ -3,10 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "approval-presets",
crate_name = "codex_utils_approval_presets",
# This test is short once running, but it hit the 60s Windows timeout when
# several freshly invalidated tests launched together. Serialize local runs
# to avoid runner startup contention while keeping the small test size.
test_tags_by_target = {
"approval-presets-unit-tests-windows-cross": ["exclusive-if-local"],
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "cache",
crate_name = "codex_utils_cache",
test_sizes = {
"cache-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -14,7 +14,4 @@ codex_rust_crate(
"CODEX_REPO_ROOT_MARKER": "$(rlocationpath :repo_root.marker)",
},
test_data_extra = ["repo_root.marker"],
test_sizes = {
"cargo-bin-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "elapsed",
crate_name = "codex_utils_elapsed",
test_sizes = {
"elapsed-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "fuzzy-match",
crate_name = "codex_utils_fuzzy_match",
test_sizes = {
"fuzzy-match-unit-tests-windows-cross": "medium",
},
)
+3 -3
View File
@@ -4,10 +4,10 @@ codex_rust_crate(
name = "image",
crate_name = "codex_utils_image",
test_shard_counts = {
# The native test needs four shards to stay inside its short budget.
"image-unit-tests": 4,
# Windows-cross gets a medium budget automatically and fits in one
# shard, avoiding extra local Windows process startup overhead.
"image-unit-tests-windows-cross": 1,
},
test_sizes = {
"image-unit-tests-windows-cross": "medium",
},
)
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "output-truncation",
crate_name = "codex_utils_output_truncation",
test_sizes = {
"output-truncation-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "path-uri",
crate_name = "codex_utils_path_uri",
test_sizes = {
"path-uri-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "plugins",
crate_name = "codex_utils_plugins",
test_sizes = {
"plugins-unit-tests-windows-cross": "medium",
},
)
@@ -3,13 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "rustls-provider",
crate_name = "codex_utils_rustls_provider",
test_sizes = {
"rustls-provider-preinstalled-test-windows-cross": "medium",
},
# This unit test is short once running, but it hit the 60s Windows timeout
# when several freshly invalidated tests launched together. Serialize local
# runs to avoid runner startup contention while keeping its small size.
test_tags_by_target = {
"rustls-provider-unit-tests-windows-cross": ["exclusive-if-local"],
},
)
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "sleep-inhibitor",
crate_name = "codex_utils_sleep_inhibitor",
test_sizes = {
"sleep-inhibitor-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "stream-parser",
crate_name = "codex_utils_stream_parser",
test_sizes = {
"stream-parser-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "string",
crate_name = "codex_utils_string",
test_sizes = {
"string-unit-tests-windows-cross": "medium",
},
)
-3
View File
@@ -3,7 +3,4 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "template",
crate_name = "codex_utils_template",
test_sizes = {
"template-unit-tests-windows-cross": "medium",
},
)
-12
View File
@@ -6,16 +6,4 @@ codex_rust_crate(
"codex-windows-sandbox-setup.manifest",
],
crate_name = "codex_windows_sandbox",
test_sizes = {
"windows-sandbox-rs-unit-tests-windows-cross": "medium",
},
# Cold Windows runs exceed the 60s short timeout, while remote results have
# reported about 3s and made the medium budget look oversized. Run it alone
# and bypass remote test-result caching so CI measures the cold runtime.
test_tags_by_target = {
"windows-sandbox-rs-unit-tests-windows-cross": [
"exclusive-if-local",
"no-remote-cache",
],
},
)
+25 -23
View File
@@ -35,6 +35,13 @@ WINDOWS_GNULLVM_ONLY = select({
"//conditions:default": ["@platforms//:incompatible"],
})
_NEXT_TEST_SIZE = {
"small": "medium",
"medium": "large",
"large": "enormous",
"enormous": "enormous",
}
# libwebrtc uses Objective-C categories from native archives. Any Bazel-linked
# macOS binary/test that can pull it in must keep category symbols alive.
MACOS_WEBRTC_RUSTC_LINK_FLAGS = select({
@@ -198,7 +205,6 @@ def codex_rust_crate(
test_shard_counts = {},
test_sizes = {},
test_tags = [],
test_tags_by_target = {},
unit_test_timeout = None,
extra_binaries = [],
extra_binaries_non_windows = [],
@@ -244,12 +250,11 @@ def codex_rust_crate(
variants inherit the native target's count unless callers
override the generated variant name explicitly.
test_sizes: Mapping from generated test target name to Bazel test size.
All generated tests default to small. Callers can override slower
targets individually, including Windows-cross and Wine tests.
Native and Wine tests default to small. Windows-cross tests default
to one size larger than the corresponding native target, capped at
enormous. Callers can override generated targets individually.
test_tags: Tags applied to unit + integration test targets.
Typically used to disable the sandbox, but see https://bazel.build/reference/be/common-definitions#common.tags
test_tags_by_target: Mapping from generated test target name to
additional Bazel tags for that target.
unit_test_timeout: Optional Bazel timeout for the unit-test target
generated from `src/**/*.rs`.
extra_binaries: Additional binary labels to surface as test data and
@@ -381,7 +386,7 @@ def codex_rust_crate(
test_bin = ":" + unit_test_binary,
workspace_root_marker = "//codex-rs/utils/cargo-bin:repo_root.marker",
target_compatible_with = target_compatible_with,
tags = _test_tags(test_tags, test_tags_by_target, unit_test_target_name),
tags = test_tags,
**unit_test_kwargs
)
@@ -531,7 +536,7 @@ def codex_rust_crate(
test_bin = ":" + integration_test_binary,
workspace_root_marker = "//codex-rs/utils/cargo-bin:repo_root.marker",
target_compatible_with = WINDOWS_GNULLVM_INCOMPATIBLE,
tags = _test_tags(test_tags, test_tags_by_target, test_name),
tags = test_tags,
**test_kwargs
)
else:
@@ -557,7 +562,7 @@ def codex_rust_crate(
rustc_env = rustc_env,
env = integration_test_cargo_env,
target_compatible_with = WINDOWS_GNULLVM_INCOMPATIBLE,
tags = _test_tags(test_tags, test_tags_by_target, test_name),
tags = test_tags,
**test_kwargs
)
@@ -607,7 +612,7 @@ def codex_rust_crate(
test_bin = "//codex-rs/exec-server/testing:wine-exec-test-runner",
workspace_root_marker = "//codex-rs/utils/cargo-bin:repo_root.marker",
target_compatible_with = WINE_TEST_TARGET_COMPATIBLE_WITH,
tags = _test_tags(test_tags, test_tags_by_target, wine_test_name) + ["manual"],
tags = test_tags + ["manual"],
**wine_test_kwargs
)
@@ -645,7 +650,7 @@ def codex_rust_crate(
test_bin = ":" + windows_cross_test_binary,
workspace_root_marker = "//codex-rs/utils/cargo-bin:repo_root.marker",
target_compatible_with = WINDOWS_GNULLVM_ONLY,
tags = _test_tags(test_tags, test_tags_by_target, windows_cross_test_name),
tags = test_tags,
**windows_cross_test_kwargs
)
@@ -665,14 +670,6 @@ def codex_rust_crate(
if unknown_test_shard_counts:
fail("test_shard_counts contains unknown generated test targets: {}".format(", ".join(unknown_test_shard_counts)))
unknown_test_tags = sorted([
test_name
for test_name in test_tags_by_target
if test_name not in generated_test_names
])
if unknown_test_tags:
fail("test_tags_by_target contains unknown generated test targets: {}".format(", ".join(unknown_test_tags)))
def _test_shard_count(test_shard_counts, test_name):
shard_count = test_shard_counts.get(test_name)
if shard_count == None:
@@ -683,12 +680,17 @@ def _test_shard_count(test_shard_counts, test_name):
return shard_count
def _test_tags(test_tags, test_tags_by_target, test_name):
return test_tags + test_tags_by_target.get(test_name, [])
def _test_size(test_sizes, test_name):
size = test_sizes.get(test_name, "small")
if size not in ["small", "medium", "large", "enormous"]:
size = test_sizes.get(test_name)
if size == None and test_name.endswith("-windows-cross"):
native_test_name = test_name.removesuffix("-windows-cross")
native_size = test_sizes.get(native_test_name, "small")
if native_size not in _NEXT_TEST_SIZE:
fail("test_sizes[{}] must be a valid Bazel test size".format(native_test_name))
size = _NEXT_TEST_SIZE[native_size]
if size == None:
size = "small"
if size not in _NEXT_TEST_SIZE:
fail("test_sizes[{}] must be a valid Bazel test size".format(test_name))
return size