Commit f2c32e8
committed
fix: address round-4 review comments on 401 handling
Four fixes from claude[bot] review on the AuthProvider approach:
1. Drain 401 response body after onUnauthorized() succeeds, before the
retry. Unconsumed bodies block socket recycling in undici. All three
401 sites now drain before return.
2. _startOrAuthSse() 401 retry was return await, causing onerror to
fire twice (recursive call's catch + outer catch both fire). Changed
to return (not awaited) matching the send() pattern. Removed the
try/finally, added flag reset to success path + outer catch instead.
3. Migration docs still referenced SdkErrorCode.ClientHttpAuthentication
for the 401-after-auth case, but that throw site was replaced by
_authRetryInFlight which throws UnauthorizedError. Updated both
migration.md and migration-SKILL.md.
4. Pre-existing: 403 upscoping auth() call passed this._fetch instead
of this._fetchWithInit, dropping custom requestInit options during
token requests. All other auth() calls in this transport already
used _fetchWithInit.1 parent 65b5099 commit f2c32e8
4 files changed
Lines changed: 18 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | 134 | | |
136 | 135 | | |
137 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
585 | 585 | | |
586 | 586 | | |
587 | 587 | | |
588 | | - | |
| 588 | + | |
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
| |||
617 | 617 | | |
618 | 618 | | |
619 | 619 | | |
620 | | - | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
621 | 623 | | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | 624 | | |
626 | 625 | | |
627 | 626 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
278 | 279 | | |
279 | 280 | | |
280 | 281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
233 | 231 | | |
234 | 232 | | |
235 | 233 | | |
| |||
251 | 249 | | |
252 | 250 | | |
253 | 251 | | |
| 252 | + | |
254 | 253 | | |
255 | 254 | | |
| 255 | + | |
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| |||
510 | 510 | | |
511 | 511 | | |
512 | 512 | | |
| 513 | + | |
513 | 514 | | |
514 | 515 | | |
515 | 516 | | |
| |||
549 | 550 | | |
550 | 551 | | |
551 | 552 | | |
552 | | - | |
| 553 | + | |
553 | 554 | | |
554 | 555 | | |
555 | 556 | | |
| |||
0 commit comments