Support packaged managed Codex binary paths (#42318)

## What changed

- Prefer the managed executable under `packages/standalone/current/bin` when it exists.
- Fall back to the legacy `packages/standalone/current` executable layout.
- Preserve platform-specific missing-install paths so launch validation and lifecycle commands continue to behave as expected.

## Testing

- Add a path-selection test covering missing, legacy, and packaged installs.

GitOrigin-RevId: 4c0d066257e9984a35e3b95dd83c768d9ce69431
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-02 17:52:16 +00:00
1 parent f252c23b88
commit a94a5db629
2 files changed
+41 -3

No files matched your search

@@ -0,0 +1,21 @@
use pretty_assertions::assert_eq;
#[test]
fn discovers_package_and_legacy_installs() {
let home = tempfile::TempDir::new().expect("home");
let current = home.path().join("packages/standalone/current");
let legacy = current.join(super::managed_codex_file_name());
let expected = if cfg!(windows) {
current.join("bin").join("codex.exe")
} else {
legacy.clone()
};
assert_eq!(super::managed_codex_bin(home.path()), expected);
std::fs::create_dir_all(&current).expect("current directory");
std::fs::write(&legacy, b"legacy").expect("legacy executable");
assert_eq!(super::managed_codex_bin(home.path()), legacy);
let packaged = current.join("bin").join(super::managed_codex_file_name());
std::fs::create_dir(current.join("bin")).expect("bin directory");
std::fs::write(&packaged, b"packaged").expect("packaged executable");
assert_eq!(super::managed_codex_bin(home.path()), packaged);
}