Repository navigation
Commit 513975e
Tarek Mahmoud Sayed
Coalesce concurrent cold-start authorizations (modelcontextprotocol#1595)
The post-lock cache re-check only reused a freshly cached token when the
challenge carried a token (usedAccessToken is not null). During a
cold-start connect the client can issue concurrent requests that all send
no token, so each saw a null usedAccessToken, skipped the re-check and ran
a full interactive authorization, producing redundant token exchanges
(observed in CI as two authorization requests on a single connect).
When no token was sent, any valid token now present in the cache was
obtained by another caller and is safe to reuse, so drop the null guard.
The remaining checks still prevent replaying a rejected token (the cached
token must differ from the one that produced the challenge) and still run
the step-up flow for 403 insufficient_scope challenges.
Copilot-Session: 334e4d21-b783-46ae-8dc6-3c3b5defbe371 parent aed4e35 commit 513975e
1 file changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
287 | 289 | | |
288 | | - | |
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
| |||
0 commit comments