From b5f969a2210a5c667b451842b166d0d5826df2fe Mon Sep 17 00:00:00 2001 From: Marcus Haas Date: Thu, 29 Oct 2026 15:53:11 +0100 Subject: [PATCH 1/3] [K-Marcus] Capture native Desktop restart baseline failures --- .github/workflows/codex-desktop-test.yml | 86 ++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/codex-desktop-test.yml diff --git a/.github/workflows/codex-desktop-test.yml b/.github/workflows/codex-desktop-test.yml new file mode 100644 index 00000000000..83d6d3dddaf --- /dev/null +++ b/.github/workflows/codex-desktop-test.yml @@ -0,0 +1,86 @@ +name: Codex Desktop restart regression +on: + push: + branches: [codex/w296-desktop-restart-test] + paths: + - .github/workflows/codex-desktop-test.yml + - rust/src/codex_accounts/codex_desktop.rs +permissions: + contents: read +jobs: + desktop: + runs-on: windows-latest + timeout-minutes: 35 + defaults: + run: + shell: pwsh + env: + CARGO_BUILD_JOBS: '2' + CARGO_PROFILE_DEV_DEBUG: '0' + CARGO_PROFILE_TEST_DEBUG: '0' + RUSTFLAGS: -C target-feature=+crt-static + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # stable + with: + toolchain: 1.98.0 + components: rustfmt + - name: Native original Desktop tests with fixture diagnostics + run: | + @' + import pathlib, subprocess, os, json + root = pathlib.Path.cwd() + out = pathlib.Path(os.environ['RUNNER_TEMP']) / 'desktop-proof' + out.mkdir() + harness = out / 'harness' + (harness / 'src' / 'codex_accounts').mkdir(parents=True) + (harness / 'Cargo.toml').write_text('''[package] + name = "desktop-proof" + version = "0.1.0" + edition = "2024" + [dependencies] + base64 = "0.22.1" + dirs = "6.0.0" + thiserror = "2.0.18" + tempfile = "3.26.0" + ''') + (harness / 'src' / 'lib.rs').write_text('pub mod codex_accounts { pub mod file_locations; pub mod codex_desktop; }') + refs = { + 'main': '2634b666549a33da3c9cd8aa18d661dc702fa83a', + 'vibetv-base': '935b98b118f1599c191ccf2754a6f352d806ffac', + 'pr19-dot16': 'b1174a1010cc2f1af572429a486ef42a4929be65', + 'pr20': 'ba43f0d2113aeb6ded6490399eff729fd770bd4c', + } + results = [] + for label, ref in refs.items(): + for name in ['file_locations', 'codex_desktop']: + source = subprocess.check_output(['git', 'show', f'{ref}:rust/src/codex_accounts/{name}.rs']).decode() + if name == 'codex_desktop': + old = '"{}",\n String::from_utf8_lossy(&output.stderr)' + new = '"exit={:?} stdout={} stderr={} fixture_log={}",\n output.status.code(),\n String::from_utf8_lossy(&output.stdout),\n String::from_utf8_lossy(&output.stderr),\n std::fs::read_to_string(dir.path().join("support/codex-desktop-restart.log")).unwrap_or_default()' + assert source.count(old) == 1 + source = source.replace(old, new) + (harness / 'src' / 'codex_accounts' / f'{name}.rs').write_text(source) + command = ['cargo', 'test', '--manifest-path', str(harness / 'Cargo.toml'), 'restart_uses_manifest_gui_and_leaves_standalone_cli_alone', '--', '--nocapture'] + process = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) + print(f'BASELINE {label} {ref} exit={process.returncode}', flush=True) + print(process.stdout, flush=True) + (out / f'{label}.log').write_text(process.stdout) + results.append(dict(label=label, ref=ref, exit=process.returncode)) + (out / 'results.json').write_text(json.dumps(results, indent=2)) + if any(row['exit'] != 0 for row in results): + raise SystemExit('Native baseline failures recorded; inspect fixture_log') + '@ | python - + if ($LASTEXITCODE -ne 0) { throw 'Baseline failures; inspect fixture log' } + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + if: always() + with: + name: desktop-proof-${{ github.run_id }} + path: | + ${{ runner.temp }}/desktop-proof/*.log + ${{ runner.temp }}/desktop-proof/results.json + if-no-files-found: error + retention-days: 14 From 7b8a834deab1eac699e4e90784be68d286ba2996 Mon Sep 17 00:00:00 2001 From: Marcus Haas Date: Thu, 29 Oct 2026 15:56:20 +0100 Subject: [PATCH 2/3] [K-Marcus] Normalize Desktop restart fixture paths on Windows --- .github/workflows/codex-desktop-test.yml | 31 ++++++++++++++++++------ rust/src/codex_accounts/codex_desktop.rs | 11 ++++++--- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/.github/workflows/codex-desktop-test.yml b/.github/workflows/codex-desktop-test.yml index 83d6d3dddaf..4804f6f185b 100644 --- a/.github/workflows/codex-desktop-test.yml +++ b/.github/workflows/codex-desktop-test.yml @@ -28,7 +28,7 @@ jobs: with: toolchain: 1.98.0 components: rustfmt - - name: Native original Desktop tests with fixture diagnostics + - name: Native red-green proof on main, PR base, .16 and PR20 run: | @' import pathlib, subprocess, os, json @@ -42,10 +42,10 @@ jobs: version = "0.1.0" edition = "2024" [dependencies] - base64 = "0.22.1" - dirs = "6.0.0" - thiserror = "2.0.18" - tempfile = "3.26.0" + base64 = "=0.22.1" + dirs = "=6.0.0" + thiserror = "=2.0.18" + tempfile = "=3.27.0" ''') (harness / 'src' / 'lib.rs').write_text('pub mod codex_accounts { pub mod file_locations; pub mod codex_desktop; }') refs = { @@ -55,6 +55,8 @@ jobs: 'pr20': 'ba43f0d2113aeb6ded6490399eff729fd770bd4c', } results = [] + fixed = (root / 'rust/src/codex_accounts/codex_desktop.rs').read_text() + assert '$fixturePackage = [System.IO.Path]::GetFullPath({package})' in fixed for label, ref in refs.items(): for name in ['file_locations', 'codex_desktop']: source = subprocess.check_output(['git', 'show', f'{ref}:rust/src/codex_accounts/{name}.rs']).decode() @@ -63,6 +65,7 @@ jobs: new = '"exit={:?} stdout={} stderr={} fixture_log={}",\n output.status.code(),\n String::from_utf8_lossy(&output.stdout),\n String::from_utf8_lossy(&output.stderr),\n std::fs::read_to_string(dir.path().join("support/codex-desktop-restart.log")).unwrap_or_default()' assert source.count(old) == 1 source = source.replace(old, new) + source = source.replace("throw 'Wrong launcher'", "throw ('Wrong launcher actual=[' + $FilePath + '] expected=[' + (Join-Path $fixturePackage 'app\\ChatGPT.exe') + ']')") (harness / 'src' / 'codex_accounts' / f'{name}.rs').write_text(source) command = ['cargo', 'test', '--manifest-path', str(harness / 'Cargo.toml'), 'restart_uses_manifest_gui_and_leaves_standalone_cli_alone', '--', '--nocapture'] process = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) @@ -70,11 +73,23 @@ jobs: print(process.stdout, flush=True) (out / f'{label}.log').write_text(process.stdout) results.append(dict(label=label, ref=ref, exit=process.returncode)) + assert process.returncode == 101 and 'Restart failed: Wrong launcher' in process.stdout, 'Expected path-mismatch baseline failure' + (harness / 'src' / 'codex_accounts' / 'codex_desktop.rs').write_text(fixed) + process = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) + print(f'FIXED {label} {ref} exit={process.returncode}', flush=True) + print(process.stdout, flush=True) + (out / f'{label}-fixed.log').write_text(process.stdout) + results.append(dict(label=label + '-fixed', ref=ref, exit=process.returncode)) + assert process.returncode == 0, 'Fixed Desktop fixture failed' (out / 'results.json').write_text(json.dumps(results, indent=2)) - if any(row['exit'] != 0 for row in results): - raise SystemExit('Native baseline failures recorded; inspect fixture_log') '@ | python - - if ($LASTEXITCODE -ne 0) { throw 'Baseline failures; inspect fixture log' } + if ($LASTEXITCODE -ne 0) { throw 'Desktop red-green proof failed' } + - name: Full library suite at this exact PR head + run: | + cargo fmt --all --check + if ($LASTEXITCODE -ne 0) { throw 'Rust format failed' } + cargo test -p codexbar --lib --locked --target x86_64-pc-windows-msvc + if ($LASTEXITCODE -ne 0) { throw 'Full library suite failed' } - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 if: always() with: diff --git a/rust/src/codex_accounts/codex_desktop.rs b/rust/src/codex_accounts/codex_desktop.rs index 10eeedcf5c8..62b91f4c562 100644 --- a/rust/src/codex_accounts/codex_desktop.rs +++ b/rust/src/codex_accounts/codex_desktop.rs @@ -347,7 +347,8 @@ mod tests { std::fs::write(session.join("unrelated-file"), b"preserve").unwrap(); let script = format!( r#" -$fixturePackage = {package} +# Match the restart script: Windows may expand an 8.3 temp path here. +$fixturePackage = [System.IO.Path]::GetFullPath({package}) $script:stopped = $false function Get-AppxPackage {{ [pscustomobject]@{{ InstallLocation = $fixturePackage; Version = '1.0' }} }} function Get-CimInstance {{ @@ -389,8 +390,12 @@ if (-not $script:stopped -or -not $script:launched) {{ throw 'Restart did not co .unwrap(); assert!( output.status.success(), - "{}", - String::from_utf8_lossy(&output.stderr) + "exit={:?} stdout={} stderr={} fixture_log={}", + output.status.code(), + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr), + std::fs::read_to_string(dir.path().join("support/codex-desktop-restart.log")) + .unwrap_or_default() ); assert!(!session.join("Local Storage").exists()); assert!(!session.join("Preferences").exists()); From c8e11559ed78df845a1ee732e511025b458d1320 Mon Sep 17 00:00:00 2001 From: marcus7989 <158066843+marcus7989@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:51:18 +0100 Subject: [PATCH 3/3] [K-Marcus] Drop one-off Desktop test workflow after counter-review --- .github/workflows/codex-desktop-test.yml | 101 ----------------------- 1 file changed, 101 deletions(-) delete mode 100644 .github/workflows/codex-desktop-test.yml diff --git a/.github/workflows/codex-desktop-test.yml b/.github/workflows/codex-desktop-test.yml deleted file mode 100644 index 4804f6f185b..00000000000 --- a/.github/workflows/codex-desktop-test.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Codex Desktop restart regression -on: - push: - branches: [codex/w296-desktop-restart-test] - paths: - - .github/workflows/codex-desktop-test.yml - - rust/src/codex_accounts/codex_desktop.rs -permissions: - contents: read -jobs: - desktop: - runs-on: windows-latest - timeout-minutes: 35 - defaults: - run: - shell: pwsh - env: - CARGO_BUILD_JOBS: '2' - CARGO_PROFILE_DEV_DEBUG: '0' - CARGO_PROFILE_TEST_DEBUG: '0' - RUSTFLAGS: -C target-feature=+crt-static - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - fetch-depth: 0 - persist-credentials: false - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # stable - with: - toolchain: 1.98.0 - components: rustfmt - - name: Native red-green proof on main, PR base, .16 and PR20 - run: | - @' - import pathlib, subprocess, os, json - root = pathlib.Path.cwd() - out = pathlib.Path(os.environ['RUNNER_TEMP']) / 'desktop-proof' - out.mkdir() - harness = out / 'harness' - (harness / 'src' / 'codex_accounts').mkdir(parents=True) - (harness / 'Cargo.toml').write_text('''[package] - name = "desktop-proof" - version = "0.1.0" - edition = "2024" - [dependencies] - base64 = "=0.22.1" - dirs = "=6.0.0" - thiserror = "=2.0.18" - tempfile = "=3.27.0" - ''') - (harness / 'src' / 'lib.rs').write_text('pub mod codex_accounts { pub mod file_locations; pub mod codex_desktop; }') - refs = { - 'main': '2634b666549a33da3c9cd8aa18d661dc702fa83a', - 'vibetv-base': '935b98b118f1599c191ccf2754a6f352d806ffac', - 'pr19-dot16': 'b1174a1010cc2f1af572429a486ef42a4929be65', - 'pr20': 'ba43f0d2113aeb6ded6490399eff729fd770bd4c', - } - results = [] - fixed = (root / 'rust/src/codex_accounts/codex_desktop.rs').read_text() - assert '$fixturePackage = [System.IO.Path]::GetFullPath({package})' in fixed - for label, ref in refs.items(): - for name in ['file_locations', 'codex_desktop']: - source = subprocess.check_output(['git', 'show', f'{ref}:rust/src/codex_accounts/{name}.rs']).decode() - if name == 'codex_desktop': - old = '"{}",\n String::from_utf8_lossy(&output.stderr)' - new = '"exit={:?} stdout={} stderr={} fixture_log={}",\n output.status.code(),\n String::from_utf8_lossy(&output.stdout),\n String::from_utf8_lossy(&output.stderr),\n std::fs::read_to_string(dir.path().join("support/codex-desktop-restart.log")).unwrap_or_default()' - assert source.count(old) == 1 - source = source.replace(old, new) - source = source.replace("throw 'Wrong launcher'", "throw ('Wrong launcher actual=[' + $FilePath + '] expected=[' + (Join-Path $fixturePackage 'app\\ChatGPT.exe') + ']')") - (harness / 'src' / 'codex_accounts' / f'{name}.rs').write_text(source) - command = ['cargo', 'test', '--manifest-path', str(harness / 'Cargo.toml'), 'restart_uses_manifest_gui_and_leaves_standalone_cli_alone', '--', '--nocapture'] - process = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) - print(f'BASELINE {label} {ref} exit={process.returncode}', flush=True) - print(process.stdout, flush=True) - (out / f'{label}.log').write_text(process.stdout) - results.append(dict(label=label, ref=ref, exit=process.returncode)) - assert process.returncode == 101 and 'Restart failed: Wrong launcher' in process.stdout, 'Expected path-mismatch baseline failure' - (harness / 'src' / 'codex_accounts' / 'codex_desktop.rs').write_text(fixed) - process = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) - print(f'FIXED {label} {ref} exit={process.returncode}', flush=True) - print(process.stdout, flush=True) - (out / f'{label}-fixed.log').write_text(process.stdout) - results.append(dict(label=label + '-fixed', ref=ref, exit=process.returncode)) - assert process.returncode == 0, 'Fixed Desktop fixture failed' - (out / 'results.json').write_text(json.dumps(results, indent=2)) - '@ | python - - if ($LASTEXITCODE -ne 0) { throw 'Desktop red-green proof failed' } - - name: Full library suite at this exact PR head - run: | - cargo fmt --all --check - if ($LASTEXITCODE -ne 0) { throw 'Rust format failed' } - cargo test -p codexbar --lib --locked --target x86_64-pc-windows-msvc - if ($LASTEXITCODE -ne 0) { throw 'Full library suite failed' } - - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 - if: always() - with: - name: desktop-proof-${{ github.run_id }} - path: | - ${{ runner.temp }}/desktop-proof/*.log - ${{ runner.temp }}/desktop-proof/results.json - if-no-files-found: error - retention-days: 14