Skip to content

fix: Alibaba/DashScope: preserve model dots, fix 401 auth, fix dead provider check (salvage #1748 + fix #2314)#2332

Merged
teknium1 merged 2 commits intomainfrom
hermes/hermes-0fa141a3
Mar 21, 2026
Merged

fix: Alibaba/DashScope: preserve model dots, fix 401 auth, fix dead provider check (salvage #1748 + fix #2314)#2332
teknium1 merged 2 commits intomainfrom
hermes/hermes-0fa141a3

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

@teknium1 teknium1 commented Mar 21, 2026

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-plusqwen3-5-plus). DashScope expects the dot. Added preserve_dots parameter to normalize_model_name() and build_anthropic_kwargs(), threaded through all 4 call sites in run_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 passed api_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 to self.provider == "alibaba".

Changes:

  • agent/anthropic_adapter.pynormalize_model_name(preserve_dots=False), build_anthropic_kwargs(preserve_dots=False)
  • run_agent.py_anthropic_preserve_dots() helper, Alibaba-aware effective_key, skip Anthropic credential refresh, fix provider check
  • tests/test_anthropic_adapter.pytest_preserve_dots_for_alibaba_dashscope

Dropped from #1748: Unrelated delegate_tool.py change (dead local variable).

Tests: 5693 passed, 0 failures.

Credit: @crazywriter1 (original author for #1748, commit authorship preserved).

crazywriter1 and others added 2 commits March 21, 2026 09:38
…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'.
@teknium1 teknium1 changed the title fix: Alibaba/DashScope: preserve model dots (qwen3.5-plus) and fix 401 auth (salvage #1748) Mar 21, 2026
@teknium1 teknium1 merged commit b73d221 into main Mar 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants