fix: list models reports context limits for Bedrock aliases on application inference profiles #10035
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #10035"
general
weight: 0.35
mansur-akhmadi
Summary
Models listed through a key alias whose
model_idis a Bedrock application inference profile came back fromGET /v1/modelsandGET /anthropic/v1/modelswithoutcontext_length,max_input_tokensandmax_output_tokens.enrichModellooked the model up by its bare name and bymodel.Alias(the profile ID), and neither is a datasheet key. Pricing for the same model works becauseresolvePricingalso tries the alias'smodel_name.Changes
framework/modelcatalog/modelinfo.go: when both lookups miss,enrichModelresolves the alias through the catalog's keyconfig (ResolveAlias) and looks up itsmodel_name, asGetModelCapabilityEntryForModelalready does. It runs only after both existing lookups miss, so models that resolved before resolve the same way.framework/changelog.md: entry.Cost: list-models and model-retrieve only, not the inference path; nothing retained. The new branch runs only after both existing lookups miss.
ResolveAliasis a map lookup, and on a miss it also tries the provider'sregex:aliases one by one (keyconfig/store.go), so a row that misses everything now pays one map lookup plus one match per regex alias on that provider, with no extra allocs. With 10 regex aliases and 50k unknown rows that is about +26% ns/op (measured in review); at a few hundred rows it is in the noise. An alias with amodel_nameadds one moreGetPricingEntryForModel(3 allocs on a hit, 13 on a miss, same as the two lookups before it).go test -run '^$' -bench BenchmarkEnrichListModelsResponse -benchmem -count=6 ./framework/modelcatalog(Apple M5, median of 6;dev=modelinfo.gofromdevwith the same test file):| Benchmark (50 models) | dev | this PR |
|---|---|---|
|
EnrichListModelsResponse/enrich(no aliases, half unknown) | 343 µs, 80225 B, 1025 allocs | 323 µs, 80225 B, 1025 allocs ||
EnrichListModelsResponseAliased(25 aliases resolving viamodel_name, 25 missing) | 925 µs, 29200 B, 625 allocs | 1177 µs, 109008 B, 1400 allocs |Listings without key aliases are unchanged. In the aliased listing most of the difference is the enrichment itself: the 25 resolved models now get pricing and limits copied in (27 allocs each, as in the
enrichcase); the remaining 100 allocs are the extra lookup for the 25 that still miss. ns/op is noisy on this machine, allocs/op is exact. To run it ondevI had to fixpool_test.go:291locally (NewTestCatalognow returns two values); that file isn't part of this PR.Type of change
Affected areas
How to test
TestEnrichModelsResponsesThroughAliasModelNamesets up a Bedrock key with aliases like the one in the issue (claude-opus-5→ profile ID,model_name: anthropic.claude-opus-5), plus an alias withoutmodel_nameand one whosemodel_nameis not in the catalog.dev: FAIL, the aliased model getsMaxInputTokens = nil/MaxOutputTokens = nilon both list and retrieve (want 1000000 / 128000).go vetand gofmt are clean; golangci-lint reports nothing on the changed lines.Routing harness (model-catalog wiring, per the routing-harness rule): scenario
bedrock-alias-model-nameintests/e2e/api/runners/build-model-catalog-wiring.mjs, collection regenerated. It runs on the server's standardbedrockprovider (datasheet rows are keyed by standard provider names, so a run-scoped custom provider is never enriched) and adds a key (bedrock_key_configfromenv.AWS_*) serving only a run-scoped alias whosemodel_idis a placeholder application inference profile ARN and whosemodel_nameisanthropic.claude-haiku-4-5-20251001-v1:0. A newassertModelLimitsstep pollsGET /v1/models?provider=bedrock(rowbedrock/<alias>,alias= the ARN,context_length/max_input_tokens/max_output_tokens> 0) andGET /anthropic/v1/models(row<alias>,max_input_tokens/max_tokens> 0); teardown deletes the provider. Ondevboth rows are listed without limits, so the polls fail.collection-scripts.test.mjspins the row id, alias and limit field each route is checked on. The catalog suite now needsAWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_REGIONin the server's env (README and skill updated). Offline: both generators regenerate with no unrelated diff,node tests/e2e/api/collections/collection-scripts.test.mjs131 passed,go test ./modelcatalog/...ok.provider-harness.jsonis unchanged fromdev.Live run (not run here, it calls Bedrock):
The wiring scenario does not cover model retrieve (
GET /v1/models/{model}and the Anthropic retrieve route): Bedrock does not implement it (BedrockProvider.ModelRetrievereturns an unsupported-operation error), so a retrieve for the alias fails before enrichment runs.TestEnrichModelsResponsesThroughAliasModelNamecoversEnrichModelRetrieveResponsedirectly.Breaking changes
Related issues
Closes #9932
Security considerations
None.
Checklist
docs/contributing/README.mdand followed the guidelines