Context
Discovered while preparing PR #15 for merge: `agent_provider::opencode::discovery::tests::check_against_live_binary_when_present` passes in isolation but fails in the full `cargo test` suite on the `workspace-cloud-push` branch.
This is a separate test-pollution issue from the `process_kill` one that was fixed in commit `38e78d7` (which was caused by `std::env::set_var("HOME", ...)` in expand_tilde tests leaking globally). The opencode_discovery test was failing on this branch even AFTER that fix, and the test file itself was last touched in commit `0dcf05b` (pre-dating PR #15 entirely).
This means some new test added on `workspace-cloud-push` is polluting the opencode_discovery test, but it's not the expand_tilde set_var one (already fixed).
What's needed
-
Reproduce the failure:
```bash
cargo test --manifest-path src-tauri/Cargo.toml --no-default-features --lib 2>&1 | grep -E "test result|opencode_discovery"
```
On the merged-to-main branch this should show 1 failure (`agent_browser` — pre-existing) plus the opencode_discovery one.
-
Bisect to find the polluter:
- Run with progressively narrower test selections until the opencode_discovery failure goes away
- The polluter is in whatever test was last excluded
-
Identify the pollution mechanism:
- Likely candidates: a test that mutates env vars (similar to the expand_tilde bug), opens fds without closing them, spawns a process and leaks the pid, etc.
- The opencode_discovery test probably does file/binary detection, so any pollution that affects PATH, file existence checks, or process spawning could trip it
-
Fix it:
- Refactor the polluting test to not touch global state, OR
- Save/restore the global state explicitly, OR
- Mark the test as `serial_test` if reliable isolation is impossible
Acceptance criteria
`cargo test --manifest-path src-tauri/Cargo.toml --no-default-features --lib` runs with no failures except the pre-existing `agent_browser::resolve_binary_finds_native_binary_from_project_root` flake (which exists on main and is unrelated).
Out of scope
- Fixing the agent_browser flake (separate pre-existing issue)
- Rewriting the test infrastructure to avoid all pollution categorically
Estimate
30 min to 2 hours depending on how quickly the bisection narrows.
Context
Discovered while preparing PR #15 for merge: `agent_provider::opencode::discovery::tests::check_against_live_binary_when_present` passes in isolation but fails in the full `cargo test` suite on the `workspace-cloud-push` branch.
This is a separate test-pollution issue from the `process_kill` one that was fixed in commit `38e78d7` (which was caused by `std::env::set_var("HOME", ...)` in expand_tilde tests leaking globally). The opencode_discovery test was failing on this branch even AFTER that fix, and the test file itself was last touched in commit `0dcf05b` (pre-dating PR #15 entirely).
This means some new test added on `workspace-cloud-push` is polluting the opencode_discovery test, but it's not the expand_tilde set_var one (already fixed).
What's needed
Reproduce the failure:
```bash
cargo test --manifest-path src-tauri/Cargo.toml --no-default-features --lib 2>&1 | grep -E "test result|opencode_discovery"
```
On the merged-to-main branch this should show 1 failure (`agent_browser` — pre-existing) plus the opencode_discovery one.
Bisect to find the polluter:
Identify the pollution mechanism:
Fix it:
Acceptance criteria
`cargo test --manifest-path src-tauri/Cargo.toml --no-default-features --lib` runs with no failures except the pre-existing `agent_browser::resolve_binary_finds_native_binary_from_project_root` flake (which exists on main and is unrelated).
Out of scope
Estimate
30 min to 2 hours depending on how quickly the bisection narrows.