fix: extend cacheRetention auto-injection and runtime pass-through for amazon-bedrock#22303
Closed
snese wants to merge 2 commits intoopenclaw:mainfrom
Closed
fix: extend cacheRetention auto-injection and runtime pass-through for amazon-bedrock#22303snese wants to merge 2 commits intoopenclaw:mainfrom
snese wants to merge 2 commits intoopenclaw:mainfrom
Conversation
… models The config auto-injection in applyContextPruningDefaults only sets cacheRetention: "short" for provider === "anthropic", skipping Anthropic Claude models accessed via the amazon-bedrock provider. Extend the provider gate to also match amazon-bedrock models whose model ID contains "anthropic.claude". Refs openclaw#21986
…amazon-bedrock The runtime resolveCacheRetention hard-gates on provider === "anthropic" and returns undefined for amazon-bedrock, so cacheRetention set in model params is never consumed at runtime for Bedrock models. Extend the gate to also accept amazon-bedrock when cacheRetention is explicitly configured. No default is applied for Bedrock since pi-ai own provider already defaults to "short" internally. Refs openclaw#21986
LalithaMV
approved these changes
Feb 21, 2026
Contributor
|
Closing as covered by landed equivalent changes. Implemented and landed:
Behavior now matches the intended split:
|
iamjulio
pushed a commit
to NeuroGym-Dev/openclaw
that referenced
this pull request
Feb 23, 2026
* upstream/main: (1467 commits) fix(doctor): use gateway health status for memory search key check (openclaw#22327) refactor: harden reset notice + cron delivery target flow refactor(exec): simplify env-prefixed wrapper modifier check fix(skills): support multiline frontmatter fallback without PyYAML fix(skills): make quick_validate work without PyYAML fix(exec): bind env-prefixed shell wrappers to full approval text fix(browser): derive relay auth token from gateway token in Chrome extension Browser relay: accept raw gateway token in extension auth fix(gateway): include platform and reason in node command rejection error CLI: fix gateway restart health ownership for child listener pids (openclaw#24696) docs: detail per-agent prompt caching configuration fix(config): tighten bedrock cache-retention type narrowing feat(agents): add per-agent stream params overrides for cache tuning (openclaw#17470) (thanks @rrenamed) fix(providers): support Bedrock Anthropic cacheRetention defaults/pass-through (openclaw#22303) (thanks @snese) fix(providers): disable Bedrock prompt caching for non-Anthropic models (openclaw#20866) (thanks @pierreeurope) docs(changelog): note /new and /reset auth-label removal (openclaw#24409) fix(reply): omit auth labels in /new and /reset docs(changelog): correct kimi issue references test(tools): fix kimi web_search mock typing feat(media): add moonshot video provider and wiring ... # Conflicts: # ui/src/ui/app-render.ts # ui/src/ui/controllers/agents.ts
carlosrivera
pushed a commit
to myascendai/meshiclaw
that referenced
this pull request
Feb 23, 2026
…s-through (openclaw#22303) (thanks @snese)
mreedr
pushed a commit
to mreedr/openclaw-custom
that referenced
this pull request
Feb 24, 2026
…s-through (openclaw#22303) (thanks @snese)
plgs2005
pushed a commit
to plgs2005/openclaw
that referenced
this pull request
Feb 24, 2026
…s-through (openclaw#22303) (thanks @snese)
margulans
pushed a commit
to margulans/Neiron-AI-assistant
that referenced
this pull request
Feb 25, 2026
…s-through (openclaw#22303) (thanks @snese)
brianleach
pushed a commit
to brianleach/openclaw
that referenced
this pull request
Feb 26, 2026
…s-through (openclaw#22303) (thanks @snese)
2 tasks
mylukin
pushed a commit
to mylukin/openclaw
that referenced
this pull request
Feb 26, 2026
…s-through (openclaw#22303) (thanks @snese)
r4jiv007
pushed a commit
to r4jiv007/openclaw
that referenced
this pull request
Feb 28, 2026
…s-through (openclaw#22303) (thanks @snese)
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
…s-through (openclaw#22303) (thanks @snese)
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.
Summary
Two changes to make
cacheRetentionwork end-to-end for Anthropic Claude models on theamazon-bedrockprovider.Changes
1.
src/config/defaults.ts— config auto-injectionThe config auto-injection in
applyContextPruningDefaultsonly setscacheRetention: "short"forprovider === "anthropic", skipping Bedrock Claude models. Extended the provider gate to also matchamazon-bedrockmodels whose ID containsanthropic.claude.2.
src/agents/pi-embedded-runner/extra-params.ts— runtime pass-throughresolveCacheRetentionhard-gates onprovider !== "anthropic"and returnsundefinedfor all other providers. This meanscacheRetentionconfigured in model params is never consumed at runtime for Bedrock models. Extended the gate to also acceptamazon-bedrockwhencacheRetentionis explicitly set inextraParams. No default is applied for Bedrock since pi-ai's own provider already defaults to"short"internally.Related
cacheRetention: "long"→ttl: "1h"on unsupported models) is a separate upstream pi-ai concern, tracked in [Bug]: Bedrock cacheRetention: "long" sends unsupported ttl: "1h" to models that only support 5-min TTL #21986 and pi-mono discussion #1571Testing
amazon-bedrock/us.anthropic.claude-opus-4-6-v1cacheRetentionis auto-injected and consumed at runtime for Bedrock Claude modelsGreptile Summary
Extends
cacheRetentionsupport to Anthropic Claude models running on Amazon Bedrock by adding two complementary changes:applyContextPruningDefaultsnow recognizes Bedrock Claude models (matchingamazon-bedrockprovider with model IDs containinganthropic.claude) and applies the defaultcacheRetention: "short"settingresolveCacheRetentionnow accepts Bedrock whencacheRetentionis explicitly configured, allowing the auto-injected or user-specified values to flow through to the streaming APIThe changes correctly preserve the existing behavior for direct Anthropic models while extending support to Bedrock's Anthropic Claude variants. The string matching logic handles both region-prefixed (
us.anthropic.claude-*) and non-prefixed (anthropic.claude-*) model ID formats.Confidence Score: 5/5
.toLowerCase().includes("anthropic.claude")appropriately handles all documented Bedrock Claude model ID formats, and the guard conditionextraParams?.cacheRetention !== undefinedensures Bedrock only gets cacheRetention when explicitly configured (via auto-injection or user config). The changes preserve backward compatibility with direct Anthropic models and existing cacheRetention behavior.Last reviewed commit: fb85a4d
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!