[PR #9124] fix: track reasoning by output_index for copilot compatibility #12991

Closed
opened 2026-02-16 18:17:52 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9124

State: closed
Merged: Yes


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 copilot_reasoning

Only works for Codex models via the /responses endpoint.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9124 **State:** closed **Merged:** Yes --- ## 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: ```json "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. <details> <summary> Screenshot </summary> <img width="1125" height="1219" alt="copilot_reasoning" src="https://github.com/user-attachments/assets/a0fed21b-8b56-4922-8bb7-4456a1b8b369" /> </details> Only works for Codex models via the `/responses` endpoint.
yindo added the pull-request label 2026-02-16 18:17:52 -05:00
yindo closed this issue 2026-02-16 18:17:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12991