Skip to content

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

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

fix(core): preserve prompt cache affinity#42248
phall1 wants to merge 1 commit into
anomalyco:devfrom
phall1:cache-affinity

Conversation

@phall1

@phall1phall1 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-actionsgithub-actionsBot 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. 👍

Sign up for freeto 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

1 participant

@phall1