opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix: track reasoning by output_index for copilot compatibility

Open NateSmyth opened this issue 3 days ago • 5 comments

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.

NateSmyth avatar Jan 17 '26 20:01 NateSmyth

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

github-actions[bot] avatar Jan 17 '26 20:01 github-actions[bot]

/review

rekram1-node avatar Jan 17 '26 20:01 rekram1-node

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

github-actions[bot] avatar Jan 17 '26 20:01 github-actions[bot]

lgtm

github-actions[bot] avatar Jan 17 '26 20:01 github-actions[bot]

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.

NateSmyth avatar Jan 17 '26 22:01 NateSmyth