Repository navigation
fix(adk): allow the Bedrock runtime origin in Harness egress - #3438
xianshujun wants to merge 2 commits into
Conversation
Signed-off-by: xianshujun <xianshupang@gmail.com>
| // matching allowlist entry CanonicalAccess rejects the credential and | ||
| // the revision cannot be admitted. | ||
| if bedrock := modelConfig.Spec.Bedrock; bedrock != nil { | ||
| destinations = append(destinations, "https://bedrock-runtime."+bedrock.Region+".amazonaws.com:443") |
There was a problem hiding this comment.
This is the third place that builds the Bedrock runtime origin from the region. go/core/internal/translator/credentials.go (~line 279) builds it to bind the bearer token, and go/core/internal/translator/claude/compiler.go (~line 254) builds it again for its egress list. The bug in #3408 came from the credential binding and the allowlist disagreeing, and the Ollama case hit the same problem and fixed it with one shared function (models.OllamaReachesCloud).
Could we add a small helper, e.g. models.BedrockRuntimeOrigin(region), and call it from all three places, so they can't drift apart again?
cc: @EItanya
There was a problem hiding this comment.
Agreed, I think we take the opportunity while we're here to standardize this into a single helper function
Credential compilation, the Claude and Codex egress lists, and the ADK egress allowlist each rebuilt https://bedrock-runtime.<region>.amazonaws.com on their own, so one site could drift from another — which is how the credential binding and the allowlist disagreed in kagent-dev#3408. models.BedrockRuntimeOrigin is now the single definition all four call. Signed-off-by: xianshujun <xianshupang@gmail.com>
Fixes #3408.
The kagent Harness compiles its egress allowlist from
agentConfigDestinations, which has provider defaults for OpenAI, Anthropic, Gemini, Mistral and Ollama but no Bedrock case.CompileCredentialsstill binds the Bedrock bearer token tohttps://bedrock-runtime.<region>.amazonaws.com:443, soegress.CanonicalAccessrejects the credential as "not explicitly allowed" and the revision cannot be admitted or applied to an Actor.Add the regional Bedrock runtime origin, derived from
ModelConfig.spec.bedrock.region, and a regression test that compiles a kagent Harness against a Bedrock bearer-token ModelConfig.Tests
All packages pass. The new test fails without the fix (the allowlist comes back empty for the Bedrock case) and passes with it.