Commit 3051655
fix(login): don't abort browser login when a single poll request stalls (#26)
A single poll of /cli-session/<nonce>/key that outlived the 5s
per-request http.Client timeout escaped the retry loop as fatal:
since Go 1.16 the client's timeout error matches
errors.Is(err, context.DeadlineExceeded), so it was indistinguishable
from the overall login deadline and rendered as "login timed out"
after ~5 seconds instead of the advertised 90.
Classify the terminal condition via ctx.Err() (the outer deadline or
a cancel) instead of the error sentinel; per-request stalls now fold
into pollTransient and the loop keeps polling. The client timeout
moves to a package-level var so the regression test can shrink it —
the test stalls the first response past the client timeout, serves
the key on the second, and asserts the poll survives (fails before
the fix, passes after).
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent eb6dfc9 commit 3051655
2 files changed
Lines changed: 50 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
| |||
240 | 245 | | |
241 | 246 | | |
242 | 247 | | |
243 | | - | |
| 248 | + | |
244 | 249 | | |
245 | 250 | | |
246 | 251 | | |
| |||
278 | 283 | | |
279 | 284 | | |
280 | 285 | | |
281 | | - | |
282 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
283 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
284 | 295 | | |
285 | 296 | | |
286 | 297 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
174 | 210 | | |
175 | 211 | | |
176 | 212 | | |
| |||
0 commit comments