Conversation
…1 auth When using Alibaba (DashScope) with an anthropic-compatible endpoint, model names like qwen3.5-plus were being normalized to qwen3-5-plus. Alibaba's API expects the dot. Added preserve_dots parameter to normalize_model_name() and build_anthropic_kwargs(). Also fixed 401 auth: when provider is alibaba or base_url contains dashscope/aliyuncs, use only the resolved API key (DASHSCOPE_API_KEY). Never fall back to resolve_anthropic_token(), and skip Anthropic credential refresh for DashScope endpoints. Cherry-picked from PR #1748 by crazywriter1. Fixes #1739.
PR #2314 checked for provider names 'alibaba-coding-plan' and 'alibaba-coding-plan-anthropic' which don't exist in the provider registry. The provider is always 'alibaba' — the condition was dead code. Fixed to check self.provider == 'alibaba'.
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
Two fixes in one PR:
1. Salvage of PR #1748 (by @crazywriter1) — Fixes #1739
Model name dots mangled:
normalize_model_name()was converting dots to hyphens unconditionally (qwen3.5-plus→qwen3-5-plus). DashScope expects the dot. Addedpreserve_dotsparameter tonormalize_model_name()andbuild_anthropic_kwargs(), threaded through all 4 call sites inrun_agent.py.401 auth (wrong credential): When provider is alibaba or base_url contains dashscope/aliyuncs, the agent was falling back to
resolve_anthropic_token()(ANTHROPIC_TOKEN), sending an Anthropic key to Alibaba's endpoint → 401. Now uses only the passedapi_key(DASHSCOPE_API_KEY) for Alibaba/DashScope, and skips Anthropic credential refresh.2. Fix for #2314 — dead provider check
PR #2314 (merged today) injected model identity into the system prompt for Alibaba Coding Plan, but checked for
self.provider in ("alibaba-coding-plan", "alibaba-coding-plan-anthropic"). Those provider names don't exist in the provider registry — the provider is always"alibaba". The condition was dead code. Fixed toself.provider == "alibaba".Changes:
agent/anthropic_adapter.py—normalize_model_name(preserve_dots=False),build_anthropic_kwargs(preserve_dots=False)run_agent.py—_anthropic_preserve_dots()helper, Alibaba-awareeffective_key, skip Anthropic credential refresh, fix provider checktests/test_anthropic_adapter.py—test_preserve_dots_for_alibaba_dashscopeDropped from #1748: Unrelated
delegate_tool.pychange (dead local variable).Tests: 5693 passed, 0 failures.
Credit: @crazywriter1 (original author for #1748, commit authorship preserved).