From 391bf191c2ef21071d59e9b0a08480efdbad2c17 Mon Sep 17 00:00:00 2001 From: Dmitriy Kovalenko Date: Wed, 7 Oct 2026 21:38:52 +0000 Subject: [PATCH] Fix package smoke tests for Cargo and Bazel debug symbols (#51849) ## Why Cargo and Bazel embed different PDB filenames in the Windows code-mode host executable. The package smoke test must support both names while verifying that the debug symbols match the packaged executable. ## What changed - Keep the archived PDB and copy it to `codex_code_mode_host.pdb`, allowing `dumpbin /PDBPATH` to resolve either name. Accept either path in the assertion. - Set `sandbox_workspace_write.writable_roots = []` explicitly in the smoke-test configuration. GitOrigin-RevId: fc2610f580dad49e38848582bc63f1f829cb766d --- scripts/codex_package/smoke_tests/fixtures.py | 1 + .../smoke_tests/test_codex_package.py | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/codex_package/smoke_tests/fixtures.py b/scripts/codex_package/smoke_tests/fixtures.py index 7427b2b272..b9e0c69b23 100644 --- a/scripts/codex_package/smoke_tests/fixtures.py +++ b/scripts/codex_package/smoke_tests/fixtures.py @@ -85,6 +85,7 @@ suppress_unstable_features_warning = true [sandbox_workspace_write] network_access = true +writable_roots = [] [features] code_mode_only = true diff --git a/scripts/codex_package/smoke_tests/test_codex_package.py b/scripts/codex_package/smoke_tests/test_codex_package.py index 46df0c3cc3..3d0ef56126 100644 --- a/scripts/codex_package/smoke_tests/test_codex_package.py +++ b/scripts/codex_package/smoke_tests/test_codex_package.py @@ -234,11 +234,13 @@ def test_windows_debug_symbols_resolve_packaged_code( code_mode_host_debug_symbols: Path, ) -> None: """Windows host symbols match the packaged executable's debug signature.""" - # Rust embeds an underscored PDB name, but release archives normalize it. - symbols = code_mode_host_debug_symbols.rename( - code_mode_host_debug_symbols.with_name("codex_code_mode_host.pdb") - ) - host = symbols.with_suffix(".exe") + # Cargo embeds an underscored PDB name; Bazel uses the binary's name. + # Offer the archived PDB under both names so dumpbin still verifies that + # its signature matches the packaged executable, regardless of builder. + cargo_symbols = code_mode_host_debug_symbols.with_name("codex_code_mode_host.pdb") + shutil.copy2(code_mode_host_debug_symbols, cargo_symbols) + symbols = (code_mode_host_debug_symbols, cargo_symbols) + host = code_mode_host_debug_symbols.with_suffix(".exe") shutil.copy2(package.cli.with_name("codex-code-mode-host.exe"), host) result = subprocess.run( ["dumpbin", "/PDBPATH", str(host)], @@ -249,4 +251,6 @@ def test_windows_debug_symbols_resolve_packaged_code( check=True, timeout=45, ) - assert str(symbols).casefold() in result.stdout.casefold(), result.stdout + assert any(str(path).casefold() in result.stdout.casefold() for path in symbols), ( + result.stdout + )