Commit b5b8bbf
authored
Fix/auth retry 384 (#387)
* fix(core): retry HTTP/auth on reconnect after offline init (#384)
PR #381 fixed offline model discovery by catching setupHTTP errors, but
hasCompletedServicesInit was still set to true, permanently locking the
SDK in offline mode for the session.
Introduce a separate hasCompletedHTTPSetup flag to track HTTP/auth
status independently from core services initialization. When
ensureServicesReady() detects that core init is done but HTTP is not,
it calls retryHTTPSetup() to attempt authentication again. This allows
the SDK to recover automatically when connectivity returns.
Also fixes stale telemetry comment that claimed HTTP was configured
when it may not have been (offline path).
* fix(core): add auth retry mechanism for offline-to-online transitions (#384)
After PR #381, the SDK could initialize offline but hasCompletedServicesInit
was set to true, permanently locking out HTTP/auth retries for the session.
Introduce a separate hasCompletedHTTPSetup flag to track HTTP/auth status
independently from core services initialization. ensureServicesReady() now
detects when core init succeeded but HTTP failed, and calls retryHTTPSetup()
to attempt auth again — enabling seamless offline-to-online transitions.
Changes:
- Add hasCompletedHTTPSetup flag (set only on setupHTTP success)
- Modify ensureServicesReady() to retry HTTP when core is done but auth isn't
- Add retryHTTPSetup() helper (idempotent, failures silently logged)
- Fix stale telemetry comment to reflect offline-mode possibility
- Reset hasCompletedHTTPSetup in reset() for clean test state
* refactor(core): address CodeRabbit feedback on auth retry PR
- Update completeServicesInitialization() docstring to clarify that its
fast-path bypasses HTTP retry (handled by ensureServicesReady())
- Remove unnecessary throws from retryHTTPSetup() since errors are
caught internally and never propagate1 parent ac41467 commit b5b8bbf
1 file changed
Lines changed: 46 additions & 7 deletions
Lines changed: 46 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| 145 | + | |
143 | 146 | | |
144 | 147 | | |
145 | 148 | | |
| |||
293 | 296 | | |
294 | 297 | | |
295 | 298 | | |
296 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
297 | 303 | | |
298 | 304 | | |
299 | 305 | | |
| |||
321 | 327 | | |
322 | 328 | | |
323 | 329 | | |
| 330 | + | |
324 | 331 | | |
325 | 332 | | |
326 | 333 | | |
327 | 334 | | |
328 | 335 | | |
329 | 336 | | |
330 | 337 | | |
331 | | - | |
332 | | - | |
| 338 | + | |
333 | 339 | | |
334 | | - | |
| 340 | + | |
335 | 341 | | |
336 | 342 | | |
337 | 343 | | |
| |||
376 | 382 | | |
377 | 383 | | |
378 | 384 | | |
379 | | - | |
| 385 | + | |
| 386 | + | |
380 | 387 | | |
381 | | - | |
382 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
383 | 396 | | |
384 | 397 | | |
385 | 398 | | |
386 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
387 | 426 | | |
388 | 427 | | |
389 | 428 | | |
| |||
0 commit comments