← Back to PRs

#5500: Fix #5290 Bedrock Auto Discovery fails to retrieve or support Inferen…

by heqiqi open 2026-01-31 15:23 View on GitHub →
agents
## Summary Refactor Bedrock model discovery to use Inference Profiles API and add debug logging for model response troubleshooting. ## Changes ### Bedrock Discovery (bedrock-discovery.ts) - Switch from ListFoundationModelsCommand to ListInferenceProfilesCommand - Add pagination support with nextToken handling - Filter by typeEquals: "SYSTEM_DEFINED" - Simplify provider extraction from inference profile ID ### Debug Logging (pi-embedded-subscribe.handlers.messages.ts) - Log raw assistantMessageEvent for debugging streaming responses - Log assistant response text at message end (truncated to 500 chars) ## Testing - Verified Claude models work correctly via Bedrock - Identified Nova model issue (empty responses) - tracked in upstream pi-mono,waiting pi-ai fix it <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This change updates Bedrock model auto-discovery to enumerate **inference profiles** via `ListInferenceProfilesCommand` (with pagination and `typeEquals: "SYSTEM_DEFINED"`) instead of listing foundation models directly. Discovered entries are mapped into `ModelDefinitionConfig` for `amazon-bedrock` in `src/agents/models-config.providers.ts`. Key behavioral differences: provider filtering is now derived from `inferenceProfileId`, and discovery no longer checks streaming support / output modalities / input modalities from the API response (it always returns `input: ["text"]`). <h3>Confidence Score: 3/5</h3> - This PR is likely safe to merge, but there are a couple of edge-case risks that could make discovery return no models depending on Bedrock API response formats. - The core refactor is straightforward and scoped to one file, but provider/status parsing now relies on assumptions about `ListInferenceProfiles` field casing and ID formatting; if those assumptions don’t hold in some regions/accounts, auto-discovery may silently return an empty list. - src/agents/bedrock-discovery.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs