Skip to content

fix(workspaces): keep probe auth single-header - #1077

Open
Shrivats-Bogam wants to merge 1 commit into
TraderAlice:devfrom
Shrivats-Bogam:fix/anthropic-probe-single-auth
Open

fix(workspaces): keep probe auth single-header#1077
Shrivats-Bogam wants to merge 1 commit into
TraderAlice:devfrom
Shrivats-Bogam:fix/anthropic-probe-single-auth

Conversation

@Shrivats-Bogam

Copy link
Copy Markdown

What

The Workspace/credential "Test" button (probeAnthropic) could send two auth headers at once:

  • Authorization: Bearer <key> and x-api-key: <ambient key> in bearer mode
  • x-api-key: <key> and Authorization: Bearer <ambient token> in x-api-key mode

whenever ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN exist in the environment. The @anthropic-ai/sdk falls back to those env vars when the matching constructor option is undefined (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 is undefined, so null keeps the wire carrying only the configured key:

  • bearer mode: { authToken: key, apiKey: null }
  • x-api-key mode: { 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: clean
  • Full pnpm 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

@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant