Repository navigation
fix(shared/token-manager): classify env-fallback keyType by capability - #1490
Open
PratikDhanave (PratikDhanave) wants to merge 1 commit into
Open
PratikDhanave (PratikDhanave) wants to merge 1 commit into
PratikDhanave (PratikDhanave) wants to merge 1 commit into
Conversation
acquireTokenFull's env-fallback branch set
keyType = capability === "claude-code-cli" ? "anthropic-api-key" : "github-oauth".
But KEY_CAPABILITY_ENV_VARS maps "anthropic-api" -> ANTHROPIC_API_KEY and
"azure-ai-inference" -> AZURE_AI_INFERENCE_API_KEY, so acquireTokenFull("anthropic-api")
with ANTHROPIC_API_KEY set returned keyType "github-oauth" for an Anthropic key —
while "claude-code-cli" with the same env var returns "anthropic-api-key".
Callers rely on keyType "to set the correct env var" (per the method's JSDoc),
and the capabilities table maps anthropic-api -> anthropic-api-key and
azure-ai-inference -> azure-ai-foundry. Classify accordingly.
Add a regression test for the anthropic-api env fallback.
PratikDhanave (PratikDhanave)
requested a review
from Cedric Vidal (cedricvidal)
as a code owner
October 13, 2026 12:04
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
acquireTokenFull's env-fallback branch (packages/shared/src/token-manager/client.ts) set:But
KEY_CAPABILITY_ENV_VARSmaps"anthropic-api"→ANTHROPIC_API_KEYand"azure-ai-inference"→AZURE_AI_INFERENCE_API_KEY. SoacquireTokenFull("anthropic-api")withANTHROPIC_API_KEYset returnskeyType: "github-oauth"for an Anthropic key — whileacquireTokenFull("claude-code-cli")with the same env var returns"anthropic-api-key". The method's JSDoc says callers usekeyType"to set the correct env var", andcapabilities.tsdocuments anthropic-api → anthropic-api-key, azure-ai-inference → azure-ai-foundry.Change
Classify the env-fallback
keyType:claude-code-cli/anthropic-api→anthropic-api-key;azure-ai-inference→azure-ai-foundry; elsegithub-oauth.Verification
Regression test —
acquireTokenFull("anthropic-api")withANTHROPIC_API_KEYset. Fails before (github-oauth), passes after (anthropic-api-key).vitestclient suite → 14 passed.(Note: only
claude-code-clihas a live caller today, so this is a latent self-contradiction, but a real one.)