Skip to content

Skip third-party prefix when a per-tier model override is fully-qualified#34

Open
robobryce wants to merge 1 commit into
brycelelbach:mainfrom
robobryce:fix/per-tier-fully-qualified-model-id
Open

Skip third-party prefix when a per-tier model override is fully-qualified#34
robobryce wants to merge 1 commit into
brycelelbach:mainfrom
robobryce:fix/per-tier-fully-qualified-model-id

Conversation

@robobryce
Copy link
Copy Markdown
Contributor

Summary

  • A / in an AAB_CLAUDE_CODE_*_MODEL value now signals it is already a fully-qualified gateway ID, so the third-party prefix is not prepended. Bare names continue to take the prefix as before.
  • Lets a single odd-tier-out coexist with the prefix scheme. On the NVIDIA Anthropic-compatible gateway, for example, Opus and Sonnet share the prefix aws/anthropic/bedrock- while Haiku uses aws/anthropic/claude-haiku-4-5-v1 (no bedrock-, with -v1). Setting AAB_CLAUDE_CODE_HAIKU_MODEL=aws/anthropic/claude-haiku-4-5-v1 now keeps the prefix in effect for the others and skips it for Haiku.
  • Without the change, the only ways to land the right Haiku ID on a gateway like that were to drop the prefix scheme entirely (and set every tier's full ID by hand) or post-process the bashrc block — both undo the "set one prefix and forget it" property of the per-tier overrides.

Implementation

  • New helper qualify_third_party_model prefix model in bootstrap.bash. If model contains / it returns model verbatim; otherwise it returns prefix + model.
  • update_bashrc and update_etc_environment now route every model name (the top-level AAB_CLAUDE_CODE_MODEL and the three per-tier overrides) through that helper when emitting the third-party branch's exports, replacing the inline ${third_party_prefix}${model} concatenation.
  • README + the bootstrap.bash env-var doc block updated with the new escape rule.

Test plan

Run from a regular checkout (not a .claude/worktrees/ worktree per AGENTS.md guidance).

  • ./test.bash (lint + unit) — 68 of 69 pass; the one failure (install_claude_code_plugins warns and skips when claude binary is absent) reproduces verbatim on plain upstream/main with bats -f "warns and skips when claude binary is absent" tests/bootstrap.bats, so it is unrelated to this change. Two new unit tests cover the helper (qualify_third_party_model prepends prefix to bare model names / ... returns fully-qualified ids verbatim); one new update_bashrc test and one new update_etc_environment test cover the integration.
    ok 4 qualify_third_party_model prepends prefix to bare model names
    ok 5 qualify_third_party_model returns fully-qualified ids verbatim
    ok 23 update_bashrc treats per-tier override containing '/' as fully-qualified (skips prefix)
    ok 24 update_bashrc fully-qualified per-tier override resolves verbatim when provider flips
    ok 50 update_etc_environment treats per-tier override containing '/' as fully-qualified (skips prefix)
    
  • ./test.bash --docker — passed: full bootstrap inside fresh ubuntu:22.04, tests/e2e-assertions.bash reports all PASS lines including ANTHROPIC_DEFAULT_{HAIKU,SONNET,OPUS}_MODEL exported in both provider branches.
  • Live exercise of the new behavior: ran bootstrap.bash inside a fresh ubuntu:22.04 container with AAB_CLAUDE_CODE_INFERENCE_PROVIDER=third-party, AAB_CLAUDE_CODE_MODEL_THIRD_PARTY_PREFIX=aws/anthropic/bedrock-, and AAB_CLAUDE_CODE_HAIKU_MODEL=aws/anthropic/claude-haiku-4-5-v1. Both ~/.bashrc's third-party branch and /etc/environment ended up with:
    ANTHROPIC_DEFAULT_HAIKU_MODEL=aws/anthropic/claude-haiku-4-5-v1
    ANTHROPIC_DEFAULT_SONNET_MODEL=aws/anthropic/bedrock-claude-sonnet-4-6
    ANTHROPIC_DEFAULT_OPUS_MODEL=aws/anthropic/bedrock-claude-opus-4-7
    
    i.e. Haiku verbatim (prefix correctly skipped), Sonnet and Opus prefix-prepended.
  • ./test.bash --secrets — N/A: change touches no committed credentials, only model-name string handling and tests.
  • ./test.bash --e2e on a disposable VM — covered by the --docker run above (it invokes --e2e end-to-end inside a fresh container) and by the targeted live exercise. No additional VM run needed for this change.
  • Backwards compatibility — update_bashrc applies third-party prefix to every per-tier model and update_bashrc honors per-tier AAB_CLAUDE_CODE_*_MODEL overrides (existing tests, both bare-name) still pass, confirming bare names continue to take the prefix.

🤖 Generated with Claude Code

…fied

A `/` in an `AAB_CLAUDE_CODE_*_MODEL` value now signals it is already a
fully-qualified gateway ID, so the third-party prefix is not prepended.
Bare names continue to take the prefix as before.

Some inference gateways use asymmetric naming across tiers — on the
NVIDIA Anthropic-compatible endpoint, Opus and Sonnet share the prefix
`aws/anthropic/bedrock-` while Haiku uses `aws/anthropic/claude-haiku-
4-5-v1` (no `bedrock-`, with `-v1`). Without per-tier escape, the only
way to express that was to drop the prefix scheme entirely. With this
change, callers can leave the prefix set for the regular tiers and pass
the odd-tier-out's full ID via the per-tier override.
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.

2 participants