You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PR #25303 causes mass KV invalidation on model switch (Plan↔Build↔Compact) #32603
Switching between Plan and Build modes (or using a custom compaction model) causes long delays due to vLLM prefix cache invalidation. The model must re-process the entire conversation history on each model switch.
The bug was introduced in PR #25303 ("fix: bedrock reasoning issue", May 2026) which modified packages/opencode/src/session/message-v2.ts to convert reasoning parts to text when switching models. While this fixed Bedrock signature validation errors, it broke vLLM prefix caching because the reasoning_content field is lost during the conversion.
Plan and Build modes may use different model IDs (e.g., Qwen3.6-27B-Plan vs Qwen3.6-27B-Build) as this is currently the only way to configure different sampling parameters per the model card (temperature, presence_penalty, etc.). Custom compaction models also trigger this issue. Switching models triggers the reasoning→text conversion, causing cache misses even though the underlying model may be the same.
Reasoning parts should never be converted to text, regardless of model switches. Any other model should receive the full context intact, including reasoning history. Any blanket conversion of prior chat history triggers mass KV cache invalidation.
Plugins
N/A
OpenCode version
1.17.7
Steps to reproduce
Start a session in Build mode
Have a conversation to build up prefix cache
Switch to Plan mode (or trigger compaction with custom model)
Send a message
Observe long delay as vLLM re-processes history
Screenshot and/or share link
Network capture analysis shows:
Build mode: Assistant messages include reasoning_content field
Plan mode (after switch): reasoning_content field missing from assistant messages
This confirms the field is being stripped when switching modes, causing the cache miss.
This issue might be a duplicate of existing issues. Please check:
fix: thinking block signature lost when model differs, breaking multi-turn with extended thinking #22813: Same root cause area — reasoning parts in message-v2.ts are modified/stripped when a different model is detected, breaking multi-turn behavior. That issue focuses on Anthropic signature loss; this one focuses on vLLM KV cache invalidation from reasoning_content field removal — but both stem from the same conversion logic.
Activity
github-actions commentedon Jun 16, 2026
This issue might be a duplicate of existing issues. Please check:
message-v2.tsare modified/stripped when a different model is detected, breaking multi-turn behavior. That issue focuses on Anthropic signature loss; this one focuses on vLLM KV cache invalidation fromreasoning_contentfield removal — but both stem from the same conversion logic.If your issue is distinct, please clarify how it differs from #22813 in particular.
github-actions commentedon Aug 16, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.