From afe09f3f1452d1955edd5f0ccc417eb3d3491879 Mon Sep 17 00:00:00 2001 From: anuragg-saxenaa Date: Fri, 17 Apr 2026 12:34:22 +0700 Subject: [PATCH] fix(github): strip thinking/reasoning_effort for Copilot chat completions (closes #623) GitHub Copilot /chat/completions endpoint does not support the thinking or reasoning_effort fields. OpenClaw sends thinking: { type: "enabled" } for Claude models which causes a 400 Bad Request. Added supportsThinking() and strip both fields in transformRequest before sending to the upstream endpoint. Co-authored-by: anuragg-saxenaa Made-with: Cursor --- open-sse/executors/github.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/open-sse/executors/github.js b/open-sse/executors/github.js index 22feae3..9e2f654 100644 --- a/open-sse/executors/github.js +++ b/open-sse/executors/github.js @@ -114,6 +114,12 @@ export class GithubExecutor extends BaseExecutor { return !/gpt-5\.4/i.test(model); } + // GitHub Copilot /chat/completions doesn't support thinking/reasoning_effort. + // OpenClaw sends thinking: { type: "enabled" } for Claude models which causes 400. + supportsThinking() { + return false; + } + transformRequest(model, body, stream, credentials) { const transformed = { ...body }; if (this.requiresMaxCompletionTokens(model) && transformed.max_tokens !== undefined) { @@ -124,6 +130,11 @@ export class GithubExecutor extends BaseExecutor { if (!this.supportsTemperature(model) && transformed.temperature !== undefined) { delete transformed.temperature; } + // Strip thinking/reasoning_effort — unsupported on /chat/completions + if (!this.supportsThinking(model)) { + delete transformed.thinking; + delete transformed.reasoning_effort; + } return transformed; }