Commit 54f2d74
test: fix three pre-existing flakies surfaced by full-suite runs
These were marked "known flakies, pre-existing on main" in the merge
PR, but every one was a real test bug worth nailing down rather than
papering over. All three reproduced on bare main HEAD.
test_sse_confirmation (3 tests)
Polled ``handler._confirm_result is None`` to detect when the worker
thread had registered itself. But _confirm_result is initialised to
``False`` (not None), so the polling loop exited immediately — resolve
fired before the worker's confirm_tool_execution set up _confirm_event,
and the worker's own setdefault then overwrote the resolved state with
a fresh unset event. Net result: the worker waited for an event that
no one would ever set, hit the internal 90 s confirmation timeout, and
the test failed with "thread still alive".
Fix: poll ``handler._confirm_event is None`` instead. _confirm_event
starts as None and only becomes non-None inside confirm_tool_execution,
so it correctly tracks the registration moment.
test_semaphore_exhausted_returns_429
Created a SECOND asyncio event loop with ``asyncio.new_event_loop()``
and acquired the semaphore on it, then handed the half-locked semaphore
to TestClient (which runs on its OWN loop). ``asyncio.Semaphore``
doesn't promise cross-loop sanity — the waiter list is loop-bound, so
acquire() on TestClient's loop saw inconsistent state under contention.
Fix: use ``Semaphore(0)`` — exhausted from birth, no second loop. Plus
patch ``asyncio.wait_for`` to a 0.2 s timeout in the chat router so
the test goes from 60 s → 0.6 s.
test_llm_command_with_server
Health check accepted any 200, even when ``all_models_loaded == []``.
Worse: even with a model loaded, ``gaia llm`` defaults to whatever the
global default is — post-PR-#865 that's Gemma-4-E4B-it-GGUF. CI runners
almost never have Gemma preloaded, so Lemonade returned 500, the OpenAI
client retried with exponential backoff, and the subprocess timed out
at 60 s.
Fix: extend the health check to require at least one ``llm``/``vlm``
in ``all_models_loaded`` and return that model's name. The test then
passes ``--model <loaded_one>`` so we don't trip the auto-load on a
model the runner doesn't have.
Verified: full unit suite 1630 passed / 0 failed / 15 skipped.1 parent 322ed7c commit 54f2d74
3 files changed
Lines changed: 105 additions & 46 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
102 | 118 | | |
103 | 119 | | |
104 | 120 | | |
105 | 121 | | |
106 | | - | |
107 | | - | |
| 122 | + | |
| 123 | + | |
108 | 124 | | |
109 | | - | |
110 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
111 | 130 | | |
112 | | - | |
113 | | - | |
| 131 | + | |
| 132 | + | |
114 | 133 | | |
115 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
116 | 140 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | 141 | | |
123 | 142 | | |
124 | 143 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | 144 | | |
129 | 145 | | |
130 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
126 | 132 | | |
127 | | - | |
| 133 | + | |
128 | 134 | | |
129 | 135 | | |
130 | 136 | | |
| |||
144 | 150 | | |
145 | 151 | | |
146 | 152 | | |
147 | | - | |
| 153 | + | |
148 | 154 | | |
149 | 155 | | |
150 | 156 | | |
| |||
173 | 179 | | |
174 | 180 | | |
175 | 181 | | |
| 182 | + | |
| 183 | + | |
176 | 184 | | |
177 | | - | |
| 185 | + | |
178 | 186 | | |
179 | 187 | | |
180 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
40 | 54 | | |
41 | 55 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 56 | + | |
46 | 57 | | |
47 | 58 | | |
48 | 59 | | |
49 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
50 | 80 | | |
51 | 81 | | |
52 | | - | |
| 82 | + | |
53 | 83 | | |
54 | 84 | | |
55 | 85 | | |
| |||
58 | 88 | | |
59 | 89 | | |
60 | 90 | | |
61 | | - | |
62 | | - | |
63 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
64 | 97 | | |
65 | 98 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
70 | 115 | | |
71 | | - | |
72 | | - | |
73 | 116 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 117 | + | |
83 | 118 | | |
84 | 119 | | |
85 | 120 | | |
| |||
0 commit comments