fix(workspaces): keep probe auth single-header - #1077
Open
Shrivats-Bogam wants to merge 1 commit into
Open
Conversation
|
@Shrivats-Bogam is attempting to deploy a commit to the luokerenx4's Team Team on Vercel. A member of the Team first needs to authorize it. |
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.
What
The Workspace/credential "Test" button (probeAnthropic) could send two auth headers at once:
Authorization: Bearer <key>andx-api-key: <ambient key>in bearer modex-api-key: <key>andAuthorization: Bearer <ambient token>in x-api-key modewhenever
ANTHROPIC_API_KEY/ANTHROPIC_AUTH_TOKENexist in the environment. The @anthropic-ai/sdk falls back to those env vars when the matching constructor option isundefined(client.mjs:70-75), and the probe only set one option — the other came from the environment.Dual auth is exactly what agent-probe.spec.ts pins against: gateways like MiniMax's international endpoint 401 ambiguous dual-header requests, and Anthropic's own API 401s OAuth-via-Bearer. The failure was reproducible on any machine with the env vars set (local repro confirmed both headers on the wire).
Fix
Pass the unused credential explicitly as
null— the SDK's env fallback only applies when the option isundefined, sonullkeeps the wire carrying only the configured key:{ authToken: key, apiKey: null }{ apiKey: key, authToken: null }Verification
agent-probe.spec.ts: 6/6 pass locally (3/6 before the fix on a machine with ANTHROPIC_* env vars set)npx tsc --noEmit: cleanpnpm test: 4014 passed / 2 failed / 39 skipped — both residual failures are environmental on Windows (symlink EPERM without Developer Mode; timing flake), unrelated to this change