← Back to PRs

#17560: fix: Anthropic Prompt Caching Not Working - Missing cache_control Headers

by MisterGuy420 open 2026-02-15 22:19 View on GitHub →
agents stale size: XS
## Summary This fix resolves the issue where Anthropic prompt caching was not working even when `cacheRetention` was configured. The problem was that the model config lookup did not handle model aliases (e.g., "sonnet" -> "anthropic/claude-sonnet-4-5") or short keys. ## Changes - Updated `resolveExtraParams` in `extra-params.ts` to: 1. First try exact match with `provider/modelId` 2. Then try resolving model alias using `parseModelRef` 3. Finally try short key match (just modelId) - Added debug logging to help identify config lookup issues ## Testing - TypeScript compilation passes - Config pruning defaults tests pass - The fix allows cacheRetention to be properly looked up when users configure with model aliases or short keys Fixes openclaw/openclaw#17537 <!-- greptile_comment --> <h3>Greptile Summary</h3> Updated `resolveExtraParams` to handle model aliases and short keys when looking up `cacheRetention` config. Previously only exact `provider/modelId` keys were supported, preventing prompt caching from working when users configured models using aliases like "sonnet" or short keys. The fix adds a fallback chain: exact match → alias resolution via `parseModelRef` → short key match. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk - The fix is well-structured with a clear fallback chain, properly uses existing `parseModelRef` helper, includes debug logging for troubleshooting, and addresses a specific bug without introducing breaking changes or security concerns - No files require special attention <sub>Last reviewed commit: 7432844</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs