Commit efdb349
fix: always apply Anthropic beta headers wrapper for OAuth token support
The `createAnthropicBetaHeadersWrapper` was only applied when
`resolveAnthropicBetas` returned non-empty (i.e., when `context1m` or
`anthropicBeta` was set in agent extra params). When `context-1m` was
configured via model-level headers instead of extra params, the wrapper
was never applied, so the critical `oauth-2025-04-20` beta was never
injected for OAuth tokens (`sk-ant-oat-*`). This caused Anthropic to
reject all requests with HTTP 401 "OAuth authentication is currently
not supported."
Now the wrapper is always applied for Anthropic providers, ensuring
OAuth token detection and beta injection runs unconditionally.
Fixes #41444
Related: #19769, #19789
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 0c7f078 commit efdb349
2 files changed
Lines changed: 35 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1348 | 1348 | | |
1349 | 1349 | | |
1350 | 1350 | | |
1351 | | - | |
| 1351 | + | |
1352 | 1352 | | |
1353 | 1353 | | |
1354 | 1354 | | |
| |||
1358 | 1358 | | |
1359 | 1359 | | |
1360 | 1360 | | |
1361 | | - | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
1362 | 1384 | | |
1363 | 1385 | | |
1364 | 1386 | | |
| |||
1425 | 1447 | | |
1426 | 1448 | | |
1427 | 1449 | | |
1428 | | - | |
| 1450 | + | |
1429 | 1451 | | |
1430 | 1452 | | |
1431 | 1453 | | |
1432 | 1454 | | |
1433 | 1455 | | |
1434 | 1456 | | |
1435 | | - | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
1436 | 1461 | | |
1437 | 1462 | | |
1438 | 1463 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
367 | 368 | | |
368 | 369 | | |
369 | 370 | | |
| |||
0 commit comments