fix: track reasoning by output_index for copilot compatibility
Problem
Copilot changes the item_id on every event, meaning reasoning delta get dropped because they don't match the stored ID.
Fix
Reuse the existing currentTextId pattern that is already used for text streaming
Testing
Verified with:
"provider": {
"github-copilot": {
"models": {
"gpt-5.2-codex": {
"variants": {
"reasoning-test": {
"reasoningEffort": "high",
"reasoningSummary": "auto",
"include": [
"reasoning.encrypted_content"
],
"store": false
}
}
}
}
}
}
Throws an error pre-fix.
"reasoning part <long base64 string>:0 not found"
Post-fix shows reasoning blocks in the UI.
Screenshot
Only works for Codex models via the /responses endpoint.
The following comment was made by an LLM, it may be inaccurate:
No duplicate PRs found
/review
Thanks for your contribution!
This PR doesn't have a linked issue. All PRs must reference an existing issue.
Please:
- Open an issue describing the bug/feature (if one doesn't exist)
- Add
Fixes #<number>orCloses #<number>to this PR description
See CONTRIBUTING.md for details.
lgtm
Tested all GPT-5* models with /responses, they all work
Only exceptions are gpt-5-codex and gpt-5.1-codex-mini, which don't work from either endpoint.
vs code uses /responses for them but they don't seem to work in opencode. Probably something to do with being "preview" models.