fix(bedrock): only add cachePoint where the model supports it - #22
Merged
Merged
Conversation
Amazon Nova accepts explicit cache checkpoints in system and messages but
rejects one in toolConfig.tools ('extraneous key [cachePoint] is not
permitted'), failing every tool-enabled prompt with a cacheKey. Gate cache
points per model family: Claude gets system/messages/tools, Nova gets
system/messages, everything else gets none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On jambonz.cloud, agent prompts to
amazon.nova-lite-v1:0fail with:feature-server always sets
cacheKeyon agent prompts, and the Bedrock adapter unconditionally appended acachePointtosystem,toolConfig.toolsand the last message. Feature-server then retries without tools, so the call degrades to an LLM that can't use tools.Fix
Gate cache points by model, per the Bedrock prompt caching docs and the Nova model cards:
anthropic.claude*amazon.nova*Matching is by substring, so cross-region profile IDs (
us.,global., …) work. An application inference profile ARN (no model name in it) gets no cache points, which is the safe outcome.Tests
New cases in
bedrock.cache-key.test.tsfor Nova (plain andus.prefixed), a cross-region Claude profile, and Llama. The Nova and Llama cases fail without the fix. Full suite passes (545).🤖 Generated with Claude Code