fix: replay Opus reasoning, stream thinking, keep inline system messages - #7
Merged
Merged
Conversation
- Send signed prior thinking back to Copilot as reasoning_text and reasoning_opaque. Dropping it made Opus re-plan on every tool turn; the same Opus 5.5 xhigh Claude Code task went from 209-379s to ~100s. - Forward Copilot's reasoning_text/reasoning_opaque to Claude Code as thinking and signature deltas (and thinking blocks when not streaming), so long turns show progress instead of looking frozen. - Keep role:"system" messages inside messages[] (SessionStart hook context, reminders) as user context. They were stripped as an assistant prefill or attributed to the model. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Opus 5.5 through the proxy was much slower than it needed to be, and Claude Code looked frozen during long turns. Three fixes:
reasoning_textandreasoning_opaque, which is what VS Code's Copilot client does. Unsigned blocks are still dropped.reasoning_textandreasoning_opaqueare forwarded asthinking_deltaandsignature_deltaevents, or as a thinking block when not streaming, so long turns show progress.role: "system"messages. Claude Code sends SessionStart hook context and reminders insidemessages[]. They were stripped as an "assistant prefill" or attributed to the model. They now reach Copilot as user context, on both the chat-completions and Responses paths.Results
Same real Claude Code 2.1.281 task (Opus 5.5, read 3 files and grep tests), run one at a time:
Tradeoffs
Testing
bun test: 219 pass. New tests cover reasoning replay, signature-only blocks, thinking/signature streaming, and inline system messages.🤖 Generated with Claude Code