[Bug] Bedrock Mantle and Bundle Fix #2114
mconflitti-pbc
started this conversation in
Bug reports
Replies: 2 comments 1 reply
|
I’m taking a look at this. |
1 reply
|
I’m looking into the Bedrock bundle/startup failure reported here in #2134. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Affected area
AI providers and models
What happened?
Prime Agent 0.9.3 had two independent Bedrock problems:
dist/bundle/amazon-bedrock.js, but the bundle script did not emit that chunk.bedrock-runtimeConverse API. OpenAI frontier models on Bedrock need the OpenAI-compatible Bedrock Mantle Responses API instead.The first problem caused a startup failure:
After the missing chunk was supplied manually, the second problem appeared as an AWS authorization error because the agent was still calling the classic runtime API:
Classic Bedrock models, including Claude, should remain on the existing Converse Stream path.
Steps to reproduce
Use an unpatched global Prime Agent
0.9.3installation. The installation used for this report is the global npm package under nvm:npm list -g --depth=0 prime-agent # prime-agent@0.9.3Authenticate an AWS profile with access to Bedrock and select the region:
Run a Bedrock OpenAI GPT-5 frontier model:
prime-agent \ --provider amazon-bedrock \ --model openai.gpt-5.6-luna \ --thinking off \ --no-tools \ --no-session \ -p 'Reply with exactly OK.'On the unpatched release, observe the missing
dist/bundle/amazon-bedrock.jsmodule error.If that chunk is restored manually and the command is rerun without the Mantle routing change, observe the
bedrock:InvokeModelWithResponseStreamauthorization error foropenai.gpt-5.6-luna.Expected behavior
The command should:
Load the Bedrock provider from the release bundle without a missing-module error.
Route Bedrock
openai.gpt-5.*andglobal.openai.gpt-5.*models through:Use the OpenAI Responses API and AWS SigV4 authentication.
Normalize
global.openai.*inference-profile IDs toopenai.*on the wire.Preserve tool-call conversion for
amazon-bedrock.Leave classic Bedrock Converse Stream models unchanged.
Retain session-based prompt caching through the Responses request body.
The AWS identity still needs the appropriate Bedrock Mantle permission. Being logged in alone does not grant that action.
Prime Agent version
0.9.3
Installation method
npm package
Operating system
macOS
Operating system version
macOS 15.7.9
CPU architecture
arm64 / aarch64
Shell and terminal
zsh 5.9 (arm64-apple-darwin24.0) in Terminal.app
Additional context
Mantle routing
Model generation classifies Bedrock
openai.gpt-5.*andglobal.openai.gpt-5.*entries asopenai-responsesand assigns a regional Mantle base URL:The OpenAI Responses provider lazily loads the AWS Bedrock provider so browser bundles remain valid:
The Mantle path deliberately does not forward Prime session or tracking headers into the AWS-signed request. Those headers caused
SignatureDoesNotMatch. The session ID remains in the request body as the cache key.Global inference-profile IDs are normalized on the wire:
The actual condition is scoped to Amazon Bedrock Mantle models.
Caching
Mantle uses the existing OpenAI Responses cache fields:
noneomits the cache key and retention.shortkeeps the session key without a retention override.PI_CACHE_RETENTION=longrequests 24-hour retention.store: falseprevents response objects from being persisted for stateful response chaining.Classic Bedrock Claude models retain Prime's existing automatic prompt caching. For application inference profile ARNs whose model name cannot be detected:
export AWS_BEDROCK_FORCE_CACHE=1Discussion 1763 bundle fix
The coding-agent bundle has a second entry point with the exact filename required by the lazy loader:
The build fails if
dist/bundle/amazon-bedrock.jsis missing. The Bedrock provider entry exports both direct stream functions and the existingbedrockProviderModulewrapper, covering the Node lazy loader and Bun path.@smithy/hash-nodeis declared as a package dependency because OpenAI's Bedrock provider uses it for SigV4 request hashing.Verification
Focused regression test passed:
npm run checkpassed Biome, TypeScript, installer, and browser smoke checks.The installed bundle's
amazon-bedrock.jsmodule imported successfully and exposed bothstreamBedrockandstreamSimpleBedrock.A live AWS SSO request using:
AWS_PROFILE=claude AWS_REGION=us-east-1 prime-agent \ --provider amazon-bedrock \ --model openai.gpt-5.6-luna \ --thinking off --no-tools --no-session \ -p 'Reply with exactly OK.'returned:
The live identity was the configured AWS SSO role. The focused test also verified the Mantle URL, SigV4 authorization, model ID normalization, cache fields, and exclusion of unsigned Prime headers.
The full source bundle emission was not rerun in the fresh clone because compiled sibling workspace artifacts were not present. The installed release bundle and the source-level check/test evidence above are the available proof.
Related Discussion:
#1763
All reactions