fix(adapter): map persona-friendly slugs (claude-code, anthropic) to registry names #10

Merged
claude-ceo-assistant merged 1 commits from fix/dispatch-alias-map-followup into main 2026-05-08 21:24:29 +00:00

Phase 4 verification of #9 surfaced an edge case: persona env files use friendlier slugs than the registry's canonical names, and the slug-detection path in _resolve_model_and_provider_from_env only matched verbatim.

With MODEL_PROVIDER=claude-code (lead persona env) the slug check fell through, the YAML had no explicit provider, and the model-prefix matcher saw MODEL=MiniMax-M2.7 and routed the lead to MiniMax — even though CLAUDE_CODE_OAUTH_TOKEN was set and obviously meant to be used.

Fix

New _PROVIDER_SLUG_ALIASES map applied before the slug-vs-legacy detection:

  • claude-codeanthropic-oauth (Claude Code subscription path)
  • anthropicanthropic-api (direct Anthropic API key path)

Tests

  • test_persona_env_lead_with_minimax_model_routes_via_oauth — locks in the alias-map behavior so a future contributor can't silently re-introduce the lead-mis-routed-to-MiniMax bug.
  • test_anthropic_alias_resolves_to_anthropic_api — covers the second alias path.
  • test_persona_env_lead_claude_code_resolves_correctly — updated to assert the new (correct) behavior: provider == "anthropic-oauth", not None.

Full adapter suite: 78/78 pass.

Phase 4 verification of #9 surfaced an edge case: persona env files use friendlier slugs than the registry's canonical names, and the slug-detection path in `_resolve_model_and_provider_from_env` only matched verbatim. With MODEL_PROVIDER=claude-code (lead persona env) the slug check fell through, the YAML had no explicit provider, and the model-prefix matcher saw MODEL=MiniMax-M2.7 and routed the lead to MiniMax — even though CLAUDE_CODE_OAUTH_TOKEN was set and obviously meant to be used. ## Fix New `_PROVIDER_SLUG_ALIASES` map applied before the slug-vs-legacy detection: * `claude-code` → `anthropic-oauth` (Claude Code subscription path) * `anthropic` → `anthropic-api` (direct Anthropic API key path) ## Tests * `test_persona_env_lead_with_minimax_model_routes_via_oauth` — locks in the alias-map behavior so a future contributor can't silently re-introduce the lead-mis-routed-to-MiniMax bug. * `test_anthropic_alias_resolves_to_anthropic_api` — covers the second alias path. * `test_persona_env_lead_claude_code_resolves_correctly` — updated to assert the new (correct) behavior: `provider == "anthropic-oauth"`, not None. Full adapter suite: **78/78 pass**.
claude-ceo-assistant added 1 commit 2026-05-08 21:24:20 +00:00
fix(adapter): map persona-friendly slugs (claude-code, anthropic) to registry names
Some checks failed
CI / Adapter unit tests (push) Successful in 1m46s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 50s
CI / Adapter unit tests (pull_request) Successful in 2m16s
CI / validate (pull_request) Successful in 6m18s
CI / validate (push) Failing after 18m56s
8adc3576fd
Phase 4 verification surfaced a follow-up edge case the initial fix missed:
the persona env files use friendlier slugs than the registry's canonical names:
  * MODEL_PROVIDER=claude-code  -> anthropic-oauth (Claude Code subscription)
  * MODEL_PROVIDER=anthropic    -> anthropic-api  (direct Anthropic API key)

Without an alias map, a lead workspace's MODEL_PROVIDER=claude-code env
fell through the slug-detection path; when the YAML didn't pin a
provider, the model-prefix matcher saw MODEL=MiniMax-M2.7 and routed the
lead to MiniMax — even though CLAUDE_CODE_OAUTH_TOKEN was clearly the
intended auth path.

Add _PROVIDER_SLUG_ALIASES with the two operator-facing slugs that don't
match registry names verbatim. The alias map is consulted before the
slug-vs-legacy detection, so claude-code now resolves to anthropic-oauth
and the lead boots through OAuth as intended.

Tests
-----
+ test_persona_env_lead_with_minimax_model_routes_via_oauth — lock in
  the alias-map behavior so a future contributor can't silently re-introduce
  the lead-mis-routed-to-MiniMax bug.
+ test_anthropic_alias_resolves_to_anthropic_api — covers the second
  alias path.

Updated test_persona_env_lead_claude_code_resolves_correctly to assert
the new (correct) behavior: provider == 'anthropic-oauth', not None.

Full adapter suite: 78/78 pass.
claude-ceo-assistant merged commit 4b038f2947 into main 2026-05-08 21:24:29 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: molecule-ai/molecule-ai-workspace-template-claude-code#10
No description provided.