← Back to Pull requests

fix: list models reports context limits for Bedrock aliases on application inference profiles #10035

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 14, 2026 08:32 UTC
Author

Summary

Models listed through a key alias whose model_id is a Bedrock application inference profile came back from GET /v1/models and GET /anthropic/v1/models without context_length, max_input_tokens and max_output_tokens. enrichModel looked the model up by its bare name and by model.Alias (the profile ID), and neither is a datasheet key. Pricing for the same model works because resolvePricing also tries the alias's model_name.

Changes

  • framework/modelcatalog/modelinfo.go: when both lookups miss, enrichModel resolves the alias through the catalog's keyconfig (ResolveAlias) and looks up its model_name, as GetModelCapabilityEntryForModel already 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. ResolveAlias is a map lookup, and on a miss it also tries the provider's regex: 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 a model_name adds one more GetPricingEntryForModel (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.go from dev with 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 via model_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 enrich case); 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 on dev I had to fix pool_test.go:291 locally (NewTestCatalog now returns two values); that file isn't part of this PR.

    Type of change

  • Bug fix

  • Feature

  • Refactor

  • Documentation

  • Chore/CI
  • Affected areas

  • Core (Go)

  • Transports (HTTP)

  • Providers/Integrations

  • Plugins

  • UI (React)

  • Docs
  • How to test

    cd framework/modelcatalog
    go test -count=1 -run TestEnrichModelsResponses -v .
    go test -count=1 ./...
    

    TestEnrichModelsResponsesThroughAliasModelName sets 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 without model_name and one whose model_name is not in the catalog.

  • dev: FAIL, the aliased model gets MaxInputTokens = nil / MaxOutputTokens = nil on both list and retrieve (want 1000000 / 128000).

  • this PR: PASS. The two negative aliases stay unenriched.
  • go vet and 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-name in tests/e2e/api/runners/build-model-catalog-wiring.mjs, collection regenerated. It runs on the server's standard bedrock provider (datasheet rows are keyed by standard provider names, so a run-scoped custom provider is never enriched) and adds a key (bedrock_key_config from env.AWS_*) serving only a run-scoped alias whose model_id is a placeholder application inference profile ARN and whose model_name is anthropic.claude-haiku-4-5-20251001-v1:0. A new assertModelLimits step polls GET /v1/models?provider=bedrock (row bedrock/<alias>, alias = the ARN, context_length/max_input_tokens/max_output_tokens > 0) and GET /anthropic/v1/models (row <alias>, max_input_tokens/max_tokens > 0); teardown deletes the provider. On dev both rows are listed without limits, so the polls fail. collection-scripts.test.mjs pins the row id, alias and limit field each route is checked on. The catalog suite now needs AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_REGION in the server's env (README and skill updated). Offline: both generators regenerate with no unrelated diff, node tests/e2e/api/collections/collection-scripts.test.mjs 131 passed, go test ./modelcatalog/... ok. provider-harness.json is unchanged from dev.

    Live run (not run here, it calls Bedrock):

    make build LOCAL=1
    tests/e2e/api/runners/individual/run-newman-model-catalog-wiring-tests.sh --binary tmp/bifrost-http --port 8097
    

    The wiring scenario does not cover model retrieve (GET /v1/models/{model} and the Anthropic retrieve route): Bedrock does not implement it (BedrockProvider.ModelRetrieve returns an unsupported-operation error), so a retrieve for the alias fails before enrichment runs. TestEnrichModelsResponsesThroughAliasModelName covers EnrichModelRetrieveResponse directly.

    Breaking changes

  • Yes

  • No
  • Related issues

    Closes #9932

    Security considerations

    None.

    Checklist

  • I read docs/contributing/README.md and followed the guidelines

  • I added/updated tests where appropriate

  • I updated documentation where needed

  • I verified builds succeed (Go and UI)

  • I verified the CI pipeline passes locally if applicable
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: mansur-akhmadi Review duration: 24574m
    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
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.7% · Safe to merge
    27.7%