Skip to content

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

Closed
MisterGuy420 wants to merge 1 commit into
openclaw:mainfrom
MisterGuy420:fix/issue-17537
Closed

fix: Anthropic Prompt Caching Not Working - Missing cache_control Headers#17560
MisterGuy420 wants to merge 1 commit into
openclaw:mainfrom
MisterGuy420:fix/issue-17537

Conversation

@MisterGuy420

@MisterGuy420 MisterGuy420 commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

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 #17537

Greptile Summary

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.

Confidence Score: 5/5

  • 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

Last reviewed commit: 7432844

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Feb 22, 2026
@vincentkoc

Copy link
Copy Markdown
Member

you have been detected be spamming with unwarranted prs and issues and your issues and prs have been automatically closed. please read contributing guide Contributing.md.

@vincentkoc vincentkoc closed this Feb 22, 2026
@MisterGuy420 MisterGuy420 deleted the fix/issue-17537 branch February 22, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Anthropic Prompt Caching Not Working - Missing cache_control Headers

4 participants