## Objective
Related conversations can’t share an OpenAI cache key without also
sharing a thread ID. We currently derive `prompt_cache_key` directly
from `thread_id`, tying cache reuse to conversation identity.
## Solution
Add an optional `prompt_cache_key` to `LanguageModelRequest` and use it
in both OpenAI Chat Completions and Responses conversions. We still fall
back to `thread_id` when no key is supplied, so existing callers keep
their current behavior.
This lets callers share a cache key across parent and child
conversations while keeping their conversation and transport identities
separate.
## Testing
Added regression coverage for explicit keys, legacy fallback, provider
capability gating, and serialization compatibility.
## Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- N/A
a8535d86b7Agus Zubiaga committed on 9/18/2026, 6:44:49 PM· committed by GitHubparent650a8d1