You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
P1: auth chain puts cloud ANTHROPIC_AUTH_TOKEN ahead of local gateway key (live 401 repro) + key has three names — fix precedence, unify naming #221
P2-1 from the all-ecosystem benchmark (2026-10-25, §6.1 — reproduced live during the eval): the MLX adapter auth chain puts ANTHROPIC_AUTH_TOKEN (a global cloud-proxy token) BEFORE local gateway/engine keys (fusion-mlx-adapter.ts:362-368: FUSION_API_KEY || FUSION_AUTH_TOKEN || ANTHROPIC_API_KEY || ANTHROPIC_AUTH_TOKEN || gateway key || engine key). A developer with a cloud proxy token in their shell env gets their "local" requests authenticated with the cloud credential — 401s against the local gateway (exactly what happened in the eval: two arms failed 401 until env -u ANTHROPIC_AUTH_TOKEN), or worse, requests silently routed/authorized by the wrong credential system.
Compounding: the key has three names across the stack — engine expects FUSION_MLX_API_KEY, gateway config uses its own api_keys list, docs/specs say FUSION_API_KEY. And providers.ts:59-61: setting FUSION_API_KEY forces provider=firstParty, overriding FUSION_MLX_ENABLED — a doc-following user can break local mode by setting the documented key.
Requirements
Precedence flip: when local MLX/gateway mode is active (FUSION_MLX_ENABLED/FUSION_GATEWAY_ENABLED/explicit local base URL), local credentials (FUSION_GATEWAY_API_KEY / FUSION_MLX_API_KEY) win. ANTHROPIC_AUTH_TOKEN/ANTHROPIC_API_KEY are only considered in cloud/firstParty mode, or with explicit opt-in (FUSION_ALLOW_ANTHROPIC_TOKEN_LOCAL=1).
One canonical key name: FUSION_API_KEY documented everywhere as THE key for the fusion stack (gateway and engine); legacy names accepted as aliases with a deprecation warning logged once (name + which alias fired).
Mode resolution order fix (providers.ts): explicit opt-in flags (FUSION_MLX_ENABLED etc.) must not be silently overridden by mere presence of FUSION_API_KEY — key presence selects credentials, not topology. Define and test the full truth table.
Debuggability: --doctor-style or startup debug line: active provider, base URL, which credential name was used (never the value), and "overridden-by" chain when precedence kicks in.
Acceptance criteria (executable)
Repro from the eval: ANTHROPIC_AUTH_TOKEN=<cloud> FUSION_MLX_ENABLED=1 FUSION_GATEWAY_API_KEY=<valid> → request to local gateway authenticates with the gateway key, succeeds (was 401).
Truth-table test matrix: all combinations of {FUSION_API_KEY, ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, FUSION_MLX_ENABLED, FUSION_BASE_URL} → expected provider + credential, each row asserted.
Deprecation warning fires exactly once per session for alias keys.
Docs (README env section): single table of env vars, one canonical key, aliases marked deprecated.
References
Report §6.1 (live 401 debugging), §8 P2-1, §10.3 Phase-2 item J (fix folded early — it blocks cloud-overflow work).
Fixed in 9529ab5 (pushed to main). Topology/credential split: explicit local opt-in outranks key presence; ANTHROPIC_* excluded from the local chain unless FUSION_ALLOW_ANTHROPIC_TOKEN_LOCAL=1; alias keys deprecation-warn once; startup debug line logs provider/baseURL/credential-name; 20-row truth-table test includes the exact eval repro. README documents FUSION_API_KEY as the single canonical key. Ships in v0.5.4.
Activity
dahai80 commentedon Oct 25, 2026
Fixed in 9529ab5 (pushed to main). Topology/credential split: explicit local opt-in outranks key presence; ANTHROPIC_* excluded from the local chain unless FUSION_ALLOW_ANTHROPIC_TOKEN_LOCAL=1; alias keys deprecation-warn once; startup debug line logs provider/baseURL/credential-name; 20-row truth-table test includes the exact eval repro. README documents FUSION_API_KEY as the single canonical key. Ships in v0.5.4.
refactor: drop ANTHROPIC_* env compat and rename vendor wire names (#426