Skip to content

test: clear the Windows-only failures behind the smoke job's first stop - #4585

Merged
kovtcharov-amd merged 11 commits into
amd:mainfrom
kovtcharov:kalin/windows-smoke-tests
Oct 4, 2026
Merged

kovtcharov-amd merged 11 commits into
amd:mainfrom
kovtcharov:kalin/windows-smoke-tests

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

The Windows smoke job stops at the first failing test, so every fix so far has only revealed the next Windows-only failure. This clears all the ones known so far in one go so the job can finally reach the end. One is more than a Windows problem: the sidecar tests' fake process (pid 4242) reached the real tree-kill, so on Linux and macOS each run sent SIGTERM to whatever real process group held that id, and the error was swallowed.

  • Uninstall shebang tests: they fake Linux only inside the uninstall module, so pyfakefs teardown no longer calls os.getuid on Windows. Installer-leftover paths are built the way the platform prints them.
  • Sidecar manager tests: only real child processes reach the tree-kill (and so taskkill on Windows); os.killpg/os.getpgid fakes no longer error on Windows, where they don't exist.
  • CLI refusal test: the subprocess gets USERPROFILE/SYSTEMROOT (Windows finds its home and starts Python from them) and reads its output as UTF-8 (the refusal prints an emoji).
  • Dev-anchor tests: expected paths are built the way the platform prints them.
  • Reap tests: the two that assert a process-group kill skip on Windows, where the code deliberately skips that kill (a documented gap).

Test-only change. Merge this before #4580, which now only raises the smoke-job timeouts. The macOS smoke failure was fixed by #4662.

Test plan

  • pytest tests/unit/test_agent_sidecar_manager.py tests/unit/installer/test_uninstall_command.py tests/unit/test_cli_refusal_exit_codes.py tests/unit/test_daemon_cli_dev_anchor.py tests/unit/test_daemon_agents_routes.py tests/unit/test_project_map.py on macOS after merging main: 298 passed, 4 skipped
  • Unit Tests (Windows smoke) gets past these files on this PR's run
  • With ci(unit): give the macOS and Windows smoke jobs time to finish #4580 also merged, Unit Tests (Windows smoke) is green on main

Kalin Ovtcharov added 7 commits October 2, 2026 20:36
The fake-spawn helper let shutdown reach the real tree-kill: on Windows its
taskkill went through the patched Popen and crashed, and on POSIX it sent
SIGTERM to process group 4242, whatever that is on the machine. Stub the
tree-kill and the group probe in the helper.
A second test patches Popen itself rather than using the fake-spawn helper, so
its shutdown still ran taskkill (Windows) or killpg (POSIX) against the fake
pid. An autouse fixture now passes only real Popen children to the tree-kill.
Windows' os has neither, so monkeypatch.setattr raised before the test ran;
raising=False creates the stand-in instead.
The stripped env set only HOME, but Windows resolves the home dir from
USERPROFILE, so the child crashed at import before printing the refusal.
The refusal prints an emoji; on Windows the parent decoded the pipe as cp1252
and got None for stdout. Pin the child's and the reader's encoding to UTF-8.
reap_stale deliberately leaves a dead leader's survivors alone on Windows (a
documented gap: no process group to kill), so asserting a group kill there
can only fail.
…them

The fake daemon replied with a POSIX string while the resolver returned a Path,
which Windows renders with backslashes, so the CLI saw a mismatch that no real
daemon would report.
@github-actions github-actions Bot added the tests Test changes label Oct 3, 2026
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

This PR changes tests only. It clears the next batch of failures that show up only on Windows, so the Windows smoke job can run to the end. It also fixes a real hazard on Linux and macOS: the sidecar tests' fake process id could reach the real kill-the-process-group call and signal whatever unrelated process group owned that id. The new safety net only lets real child processes reach that call, which is the right fix. Nothing blocks merge.

I have two small cleanups, both optional. One recorded value is never checked. And now that the safety net exists, the old per-test stubs for the kill functions do nothing and could be deleted instead of loosened.

Real-world evidence

N/A: this PR touches tests only, so there's no CLI, API, MCP or UI surface to exercise. The verdict rests on static review. I couldn't run the tests here (pytest isn't installed in this runner), and the PR's CI checks, including Unit Tests (Windows smoke), were still pending when this review was written. The Windows-smoke item in the Test plan is the real proof.

🔍 Technical details

Issues found

🟢 The recorded signals are never asserted (tests/unit/test_agent_sidecar_manager.py:432): captured["signals"] is filled in but no test reads it. Either assert on it in a shutdown test (e.g. [15] on a clean stop) or use a plain no-op so it doesn't look like coverage.

🟢 The _group_alive stub doesn't match how _signal_tree is patched (tests/unit/test_agent_sidecar_manager.py:439): the real method is a @staticmethod. lambda self, pgid only works because every caller goes through self._group_alive(...), and a class-level call would raise TypeError. Patch it the same way as the line above:

        mgr.AgentSidecarManager, "_group_alive", staticmethod(lambda pgid: False)

🟢 The leftover killpg/getpgid stubs are now dead (test_agent_sidecar_manager.py:695-696, 720-721, 824-825, 860-861): the autouse _never_signal_a_fake_pid fixture stops _FakeProc before os.killpg is reached, so these four pairs only feed _group_alive's killpg(pgid, 0) probe. Adding raising=False is fine. Deleting them, and stubbing _group_alive where the probe matters, would make the intent clearer. The comment at line 823 ("killpg must be a no-op…") is also stale now.

Strengths

  • The autouse guard checks for a real Popen instance (the class is captured at import, before any test patches it). That's the right test to draw: any test that builds a fake proc is protected automatically, without each test having to remember to.
  • The Windows skips on the two group-kill reap tests give a reason that points at the code's documented gap, instead of hiding a failure.
  • Building the dev-anchor expectations with Path(...) makes them match what the CLI really prints on each OS, without platform branches in the test.

The fake-spawn helper recorded each signal but nothing read them; a clean stop
now asserts one SIGTERM and no SIGKILL. The group-alive stub is patched as the
staticmethod it replaces, and a stale killpg comment says what the stub is for.
kovtcharov pushed a commit to kovtcharov/gaia that referenced this pull request Oct 4, 2026
These five test files carried copies of the platform fixes that amd#4580 and
amd#4585 land on their own; keeping them here would only make the three PRs
conflict. This PR's change is the local model default.
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Oct 4, 2026
…md#4662)

Every open PR shows these two failures; this clears them. The macOS one
is fixed here; the Windows one is fixed by amd#4585, so the smoke jobs go
green once both merge.

- **macOS, `test_memory_turn_recall`:** an audio test imported the
Whisper ASR module, and that import loaded torch. Once torch is loaded,
macOS has two OpenMP runtimes in the process (torch's and faiss's), so
memory recall refuses every faiss search for the rest of the run. torch
and whisper are now imported only when an ASR is actually created. The
recall test runs and passes; it isn't skipped. amd#4580 handles this
failure by skipping the test, so drop that half of amd#4580 when this
merges.
- **Windows, `test_resolves_direct_shebang_posix`:** the test faked
Linux by patching `sys.platform` for the whole process. pyfakefs
teardown then took the POSIX path and called `os.getuid`, which doesn't
exist on Windows. amd#4585 now patches only the uninstall module's view of
the platform, so this PR doesn't touch it.

The macOS failure dates from amd#4061 (Sep 28), which added the recall test
after the torch-loading audio test from amd#3616. The smoke job runs with
`-x`, so earlier failures hid it until amd#4562 fixed those on Oct 2.

## Test plan
- [x] New `test_importing_whisper_asr_does_not_load_torch` fails on main
and passes here
- [x] Locally on macOS, all audio and memory tests in CI order: 433
passed, `test_memory_turn_recall` included
- [x] Locally on macOS, every unit test up to and including the recall
test: torch never loads, and recall passes. The 13 failures are local
env noise (CLI binaries not on PATH, pip frontends); none import the
audio module
- [ ] CI: "Unit Tests (macOS smoke)" passes `test_memory_turn_recall.py`

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
kovtcharov added a commit to kovtcharov/gaia that referenced this pull request Oct 4, 2026
…md#4662

amd#4585 now patches only the uninstall module's platform, and its autouse
fixture never tree-kills a fake sidecar pid, which is the only path that
ran taskkill. amd#4662 fixed the torch import that broke faiss recall on
macOS, so the recall test no longer needs a skip. This PR keeps only the
smoke-job timeouts.
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Oct 4, 2026
Merged via the queue into amd:main with commit c4a5c42 Oct 4, 2026
@kovtcharov-amd
kovtcharov-amd deleted the kalin/windows-smoke-tests branch October 4, 2026 19:46
aksh8b pushed a commit to aksh8b/gaia that referenced this pull request Oct 5, 2026
)

The macOS and Windows unit-test smoke jobs hit their 30-minute limit
before the suite finishes, so even with every test fixed they can't go
green. This raises the limits to fit a full run: 45 min on macOS (a full
run takes ~33) and 60 on Windows (15 min reached 6,873 of ~18,000
tests).

The test fixes this PR first carried now live elsewhere: the Windows
`os.getuid` teardown and the sidecar taskkill in amd#4585, and the macOS
recall failure in amd#4662 (merged; it removes the torch import at its root
instead of skipping the test). Merge amd#4585 first; this PR no longer
touches any test file, so the two don't conflict.

## Test plan
- [ ] CI: after amd#4585, "Unit Tests (macOS smoke)" and "Unit Tests
(Windows smoke)" run to the end inside the new limits
- [x] Locally (macOS): `test_memory_turn_recall.py`,
`test_agent_sidecar_manager.py`, `installer/test_uninstall_command.py`
at main's versions: 148 passed, 4 skipped

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants