Skip to content

The open source coding agent.

TypeScript

fix: ensure that github copilot plugin properly sets headers when used in other clients than tui (#12316)

Aiden Clinefba5a79c4571
diff --git a/packages/opencode/src/plugin/copilot.ts b/packages/opencode/src/plugin/copilot.ts
index ef41ee38d37..39ea0d00d28 100644
--- a/packages/opencode/src/plugin/copilot.ts
+++ b/packages/opencode/src/plugin/copilot.ts
@@ -301,17 +301,20 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
},
],
},
- "chat.headers": async (input, output) => {
- if (!input.model.providerID.includes("github-copilot")) return
+ "chat.headers": async (incoming, output) => {
+ if (!incoming.model.providerID.includes("github-copilot")) return
- if (input.model.api.npm === "@ai-sdk/anthropic") {
+ if (incoming.model.api.npm === "@ai-sdk/anthropic") {
output.headers["anthropic-beta"] = "interleaved-thinking-2025-05-14"
}
const session = await sdk.session
.get({
path: {
- id: input.sessionID,
+ id: incoming.sessionID,
+ },
+ query: {
+ directory: input.directory,
},
throwOnError: true,
})