Skip to content

fix(core): preserve prompt cache affinity - #42248

Closed
phall1 wants to merge 1 commit into
anomalyco:devfrom
phall1:cache-affinity
Closed

phall1 wants to merge 1 commit into
anomalyco:devfrom
phall1:cache-affinity

Conversation

@phall1

@phall1 phall1 commented Aug 13, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #42246

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

V2 generated a stable session cache key but only passed it through the OpenAI provider namespace. This meant OpenRouter did not receive the key its route already supports, while native OpenAI Chat did not lower the key into prompt_cache_key.

This passes the session key to OpenRouter, lowers it for native OpenAI Chat, and leaves generic OpenAI-compatible providers unchanged because they may reject unsupported fields. It restores the cache-affinity behavior described by #39907.

How did you verify your code works?

  • 36 focused LLM route tests passed
  • 85 SessionRunner tests passed
  • bun typecheck passed in packages/llm and packages/core
  • full workspace typecheck passed across 30 packages
  • Prettier passed for all touched files

Screenshots / recordings

Not applicable; this only changes provider request bodies.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@sambokai

sambokai commented Sep 6, 2026 •

Copy link
Copy Markdown

is this issue dead? has it already been implemented in #39907?

@phall1

phall1 commented Sep 9, 2026

Copy link
Copy Markdown
Author

is this issue dead? has it already been implemented in #39907?

Have not been tracking closely - will close. Thank you for the bump

@phall1 phall1 closed this Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

V2 drops prompt cache affinity for OpenRouter and OpenAI Chat

2 participants