Skip to content

GitHub Copilot GPT-6 models do not send selected reasoning effort #51850

Closed

Description

@andrii-riabchun

Description

When using GPT-6 models through the GitHub Copilot provider, OpenCode does not include the selected reasoning effort in the outgoing /responses request.

OpenCode correctly records the selected variant, for example:

{
  "providerID": "github-copilot",
  "id": "gpt-6-luna",
  "variant": "max"
}

but the outgoing request does not contain a reasoning field:

{
  "model": "gpt-6-luna",
  "include": ["reasoning.encrypted_content"],
  "stream": true
}

The same happens with gpt-6-sol.

In comparison, gpt-5.6-luna with max correctly sends:

{
  "model": "gpt-5.6-luna",
  "reasoning": {
    "effort": "max",
    "summary": "auto"
  },
  "include": ["reasoning.encrypted_content"],
  "stream": true
}

Plugins

OpenCode version

2.0.18

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Sep 28, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    • #48247: GPT-6 model-ID handling in provider request transforms affects reasoning-related options. That issue focuses on Azure behavior, so please check whether its investigation also covers the missing reasoning effort on GitHub Copilot.
  2. andrii-riabchun commented on Sep 28, 2026

    @andrii-riabchun
    Author

    Made a plugin to workaround the issue

    // ~/.config/opencode/plugins/github-copilot-gpt6-reasoning.ts
    
    const COPILOT_HOST = "api.githubcopilot.com"
    const COPILOT_RESPONSES_PATH = /(?:^|\/)responses(?:\/|$)/
    
    function isCopilotResponsesRequest(url: string) {
      try {
        const parsed = new URL(url)
        return parsed.hostname === COPILOT_HOST && COPILOT_RESPONSES_PATH.test(parsed.pathname)
      } catch {
        return false
      }
    }
    
    export default {
      id: "github-copilot.gpt6-reasoning",
    
      async setup(ctx: any) {
        await ctx.session.hook("http.request", async (event: any) => {
          if (!isCopilotResponsesRequest(event.request.url)) return
    
          try {
            // Copilot Responses bodies look like {"model":"gpt-6","input":[...]}; `include` and `reasoning` may be absent.
            // Clone the one-shot body before parsing, and replace the request only after the rewrite succeeds.
            const body = JSON.parse(await event.request.clone().text()) as Record<string, unknown>
            const model = event.model
            const effort = model?.variant
    
            if (
              model?.providerID === "github-copilot" &&
              typeof model.id === "string" &&
              model.id.startsWith("gpt-6") &&
              typeof effort === "string" &&
              typeof body.model === "string" &&
              body.model.startsWith("gpt-6")
            ) {
              // GitHub Copilot's GPT-6 Responses route needs reasoning in the raw body; OpenCode's option is not forwarded.
              body.reasoning = { effort, summary: "auto" }
              const include = Array.isArray(body.include) ? body.include : []
    
              if (!include.includes("reasoning.encrypted_content")) {
                include.push("reasoning.encrypted_content")
              }
    
              body.include = include
              event.request = new Request(event.request, { body: JSON.stringify(body) })
            }
          } catch {
            // Leave malformed requests untouched.
          }
        })
      },
    }
  3. rekram1-node commented on Sep 29, 2026

    @rekram1-node
    Collaborator

    Some of our copilot support has been slacking, ill polish it soon

  4. rekram1-node commented on Sep 29, 2026

    @rekram1-node
    Collaborator

    Merged fix, will release later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions