bug: Rust Core Coverage CI broken on main since PR #3023 — inference_local_admin_raw_coverage_e2e regressions
Summary
`Rust Core Coverage (cargo-llvm-cov)` has been failing on every PR-CI run (and on `main` itself) since PR #3023 (commit `5345f2a8`) merged on 2026-05-30. The two failing tests both live in the new `tests/inference_local_admin_raw_coverage_e2e.rs` file added by that PR. There is no open issue tracking it as of filing.
Sample failing runs:
- main: https://github.com/tinyhumansai/openhuman/actions/runs/26697858714
- PR #3034 (React-only, unrelated): https://github.com/tinyhumansai/openhuman/actions/runs/26699645226
- PRs #2954 / #3016 / #3017 / #3029 (all of @oxoxDev's open PRs) all failing the same job
Failure A — missing PATH isolation
`local_admin_reports_unhealthy_runtime_and_lm_studio_issue_shapes` (tests/inference_local_admin_raw_coverage_e2e.rs:466) asserts `!assets.ollama_available` at line 485. Unlike the sibling test at line 270 which sets up `EnvVarGuard::set("PATH", scripts.path())` + an `exit 42` stub, this test does no `PATH` isolation. On CI runners that have `ollama` somewhere on the system PATH (or an `OLLAMA_BIN` set), `assets.ollama_available` returns `true` → assertion fails.
Fix shape: add `let _path = EnvVarGuard::set("PATH", tempdir.path());` + `EnvVarGuard::unset("OLLAMA_BIN")` to mirror the sibling test.
Failure B — parallel-test env-var race
`local_admin_covers_assets_diagnostics_downloads_and_ops_errors` (line 253) calls `service.download_asset(&config, "chat")` at line 330, which panics at line 332 with `"ollama tags request failed: error sending request for url (http://localhost:11434/api/tags)"`. The test correctly sets `OPENHUMAN_OLLAMA_BASE_URL` via `EnvVarGuard::set` at line 282, but the actual `/api/tags` call hits the hardcoded default.
Root cause: `LocalAiService::has_model()` (src/openhuman/inference/local/service/ollama_admin.rs:1403) delegates to `has_model_at(&ollama_base_url(), …)`. Three tests in this same binary mutate `OPENHUMAN_OLLAMA_BASE_URL` concurrently (lines 282, 440, 472). Cargo runs them in parallel and `EnvVarGuard` does not serialize — one test's guard scope ends or is overwritten before another reads the env var.
Fix shape (two options):
- Serialize the env-mutating tests with `serial_test::serial` or a module-level `OnceLock<Mutex<()>>`, or
- Refactor `has_model()` to take a `&Config` and call the config-aware `ollama_base_url_from_config()` resolver so the test's `config.local_ai.base_url` short-circuits the env lookup. (Cleaner; removes a hidden global dependency.)
Impact
Every PR opened after 2026-05-30 has been red on this gate. PR authors (including me on PR #3034) have been routing around it. Filing because nobody else has — happy to take a fix as a follow-up; opening a partial PR for Failure A shortly.
Update — re-checked against current `main` (`850d2758`) after filing:
- Failures A and B are both resolved. A `fn env_lock()` static mutex was added to `inference_local_admin_raw_coverage_e2e.rs` (visible at line 88) and threaded into the three env-mutating tests at lines 270, 412, 486. PATH leakage at line 486 is also gone — the lock serializes the env-mutating tests so the assertions hold. Looks like that landed in PR #3033 or a sibling commit between this issue filing and now.
- CI is still red on `Rust Core Coverage`, but for a different reason now. The current failure is a compile error in `src/openhuman/threads/turn_state/mirror_tests.rs:221`:
PR #3054 (`feat(ui): user-friendly tool and agent labels`) added `display_name: Optionerror[E0063]: missing field `display_name` in initializer of `openhuman::agent::progress::AgentProgress`` to the `SubagentSpawned` variant and updated every production call site, but missed this one test literal in `mirror_tests.rs`. Opening a one-line follow-up PR for it.
This issue (#3061) can be closed — the test isolation work it described is done.
Resolved — Rust Core Coverage is green on main again.
- The originally-reported test-isolation regressions (failures A & B in
inference_local_admin_raw_coverage_e2e.rs) were fixed by theenv_lock()serialization mutex (landed via #3033). - Remaining stale assertions + env-race serialization across the Rust Core Coverage suite were cleaned up in #3156, which greened the CI.
- The follow-up
mirror_tests.rscompile error (missingdisplay_name, introduced by #3054) is also fixed on currentmain; #3065 was closed unmerged as superseded.
Latest main CI is green across PR CI, Code Quality, and Push on main. Closing as completed.