Commit 691f863
committed
fix(onboard): drop attempt cap so recovery is truly deadline-driven (NVIDIA#6320 advisor)
Advisor re-review kept blocking on the same concern: with maxAttempts
still passed to waitUntilAsync alongside the deadline, a fast-failing
probe sequence exits after N attempts even though the deadline still
permits more polling. The reported "max wait Xs" language then
under-promises the wait the system was willing to spend, and the loop
regresses to the exact fixed-attempt behavior NVIDIA#3768 is meant to
replace.
Fix:
1. Drop `maxAttempts: recoveryPollCount` from the waitUntilAsync
options. The loop is now purely deadline-driven; the interval and
probe cost naturally bound the total attempt count. Under a
3 * 2s = 6s budget with fast-failing mocked probes, the loop now
runs 3 probes and 3 sleeps until the top-of-loop deadline check
terminates it, instead of the earlier 3 probes / 2 sleeps under the
attempt cap.
2. Rewrite the error message to describe the actual deadline, not a
hedged "budget + attempt cap" mix: "Gateway 'X' did not become
ready within the configured Ns recovery deadline (Is poll
interval)".
3. Inject Date.now via a new `now` deps hook so the deadline test can
drive a captured virtual clock without vi.useFakeTimers globally
patching timers (which hangs the async loop). The virtual clock
advances only when the injected sleepSeconds mock is called, so
time progresses deterministically at unit-test speed with zero
real wall-clock waits.
4. Rewrite the timeout test to match the new deadline-only semantics:
asserts 3 probes and 3 sleeps at 2s each under a 6s budget, and
that the error message mentions "6s recovery deadline (2s poll
interval)".
5. Adjust the zero-count edge test's message assertion to match the
new deadline-only error text.
11/11 tests pass. Biome and changed-file typecheck are clean. The
pre-existing typecheck error in test/helpers/mcp-lifecycle-lock-
properties.ts is unrelated to this branch's diff.
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>1 parent c963a2b commit 691f863
2 files changed
Lines changed: 65 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
8 | 24 | | |
9 | 25 | | |
10 | 26 | | |
| |||
86 | 102 | | |
87 | 103 | | |
88 | 104 | | |
89 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
90 | 109 | | |
91 | 110 | | |
92 | | - | |
| 111 | + | |
| 112 | + | |
93 | 113 | | |
94 | 114 | | |
95 | | - | |
| 115 | + | |
96 | 116 | | |
97 | 117 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
102 | 130 | | |
103 | 131 | | |
104 | 132 | | |
| |||
146 | 174 | | |
147 | 175 | | |
148 | 176 | | |
149 | | - | |
150 | | - | |
151 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
152 | 183 | | |
153 | 184 | | |
154 | | - | |
| 185 | + | |
155 | 186 | | |
156 | 187 | | |
157 | | - | |
| 188 | + | |
158 | 189 | | |
159 | 190 | | |
160 | | - | |
161 | | - | |
162 | 191 | | |
163 | 192 | | |
164 | 193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
62 | 67 | | |
63 | 68 | | |
64 | 69 | | |
| |||
185 | 190 | | |
186 | 191 | | |
187 | 192 | | |
| 193 | + | |
188 | 194 | | |
189 | 195 | | |
190 | 196 | | |
| |||
201 | 207 | | |
202 | 208 | | |
203 | 209 | | |
204 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
205 | 219 | | |
206 | 220 | | |
207 | 221 | | |
208 | | - | |
| 222 | + | |
209 | 223 | | |
210 | 224 | | |
211 | 225 | | |
| |||
224 | 238 | | |
225 | 239 | | |
226 | 240 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
232 | 244 | | |
233 | | - | |
| 245 | + | |
234 | 246 | | |
235 | | - | |
| 247 | + | |
236 | 248 | | |
237 | 249 | | |
238 | 250 | | |
| |||
0 commit comments