Skip to content

fix(github-copilot): listed Chat Completions-only and new Claude models fail their first turn - #167941

Merged
obviyus merged 2 commits into
mainfrom
fix/copilot-listed-endpoint-transport
Oct 9, 2026
Merged

obviyus merged 2 commits into
mainfrom
fix/copilot-listed-endpoint-transport

Conversation

@obviyus

@obviyus obviyus commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: GitHub Copilot models fail on their first turn when the account lists a chat model that only serves Chat Completions (kimi-k3 today), or a Claude model OpenClaw does not recognize yet (a newly launched Claude).

User Impact

User impact: every chat model a Copilot account shows in the picker now answers its first turn, including Claude models released after the installed OpenClaw version. No config, schema, or protocol changes.

Merge danger: low. Shipped models keep their current transport and thinking shape (the transport only changes when the account's listing says the default endpoint is unsupported; Claude capabilities are only derived for rows that list xhigh, which every currently listed adaptive Claude model already matches by ID). Older listings without supported_endpoints keep the ID rules.

Why This Change Was Made

Copilot's /models already says how each model can be called:

  • supported_endpoints names the endpoints a model accepts. OpenClaw picked the transport from the model ID only, so a non-Claude, non-Gemini ID always went to /responses. kimi-k3 lists only /chat/completions and was rejected (unsupported_api_for_model). The Copilot plugin now keeps the family transport when it is listed and otherwise uses a listed endpoint, with the existing Copilot Chat Completions request options.
  • Copilot lists effort levels instead of Anthropic's capability tree, so Claude request shaping fell back to ID rules. An unknown Claude ID got manual thinking.type: enabled budgets, which current Claude models reject (Use thinking.type.adaptive and output_config.effort). Claude rows that list xhigh (only adaptive-thinking Claude models offer it) now carry the existing params.claudeCapabilities contract (fix(anthropic): newly listed Claude models stay hidden until an OpenClaw release #167658), so they get adaptive thinking and the listed xhigh/max levels before OpenClaw learns their ID.

The fetchCopilotUsage tests moved from models.test.ts to usage.test.ts (their owner) to keep models.test.ts under the line cap; no test was removed.

Evidence

Real GitHub Copilot (Individual) account, device-flow sign-in on isolated profiles and loopback Gateways.

  • Sign-in with the Gateway running: Copilot picker 0 → 29 rows, no restart. Account /models returned 54 rows; the picker equals the listed type: chat + model_picker_enabled: true rows exactly (context/prompt limits and vision match). Hidden: 3 embeddings, 7 internal Fireworks rows (copilot-search/exec-agent/trajectory-compaction), gpt-5.6-luna-utility, gpt-5.4-nano, and legacy GPT-3.5/4/4o/4.1 rows, all model_picker_enabled: false.
  • One reply OK turn per picker model on origin/main (164210c): 27/29 ok. kimi-k3 failed with HTTP 400 unsupported_api_for_model on openai-responses. claude-haiku-4.5 at --thinking low was refused locally (the listing gives it no efforts); it passes at default/off.
  • With this branch: kimi-k3 200 on openai-completions (low and medium). Regression set across transports and vendors: gpt-5-mini, grok-4.7, mai-code-1.1-flash (Responses), gemini-3.8-flash (Chat Completions), claude-haiku-5.5 (Messages): all 200.
  • New-model simulation (throwaway worktree, never pushed): removed gpt-5.6-terra and claude-haiku-5.5 from the bundled manifests, ID rules/aliases, the recommended list, and a local copy of catalog.openclaw.ai served through models.catalogRefresh.url. Both still appeared after sign-in (29 rows). On main, gpt-5.6-terra worked (default/low) but claude-haiku-5.5 failed with HTTP 400 (thinking.type.enabled is not supported). With this branch applied, both returned 200 at default, low, max, and off.
  • node scripts/run-vitest.mjs extensions/github-copilot: 17 files, 214 tests pass. The new Claude test fails without the fix (manual budget payload) and passes with it.

@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: github-copilot size: M labels Oct 9, 2026
@obviyus

obviyus commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Maintainer decision: accept the heuristic. A Copilot Claude row that lists xhigh effort is treated as adaptive thinking with xhigh/max per its listed efforts, so new Claude models on Copilot work on their first turn; rows without that signal keep the ID rules.

@obviyus
obviyus marked this pull request as ready for review October 9, 2026 19:51
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 9, 2026
@clawsweeper

clawsweeper Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The GitHub Copilot plugin uses account-listed endpoints and Claude thinking capabilities so newly listed models can complete their first turn.

Example: A user asks github-copilot/kimi-k3 to reply OK.

  • Before: The Responses request fails with HTTP 400 unsupported_api_for_model.
  • After: The Chat Completions request succeeds with HTTP 200.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with convincing reported end-to-end results, meaningful regressions, and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The complete PR body reports real Copilot account turns through isolated Gateways: kimi-k3 recovers from Responses HTTP 400 to Chat Completions HTTP 200, and a real Claude model with ID metadata masked recovers from rejected manual thinking to HTTP 200 across default, low, max, and off. Cross-transport controls support preservation of existing behavior; the unknown-ID case is explicitly a local simulation against the real provider.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Users select an available Copilot model but their first message fails because OpenClaw sends an unsupported endpoint or thinking format.
Reason: The live failures violate the existing catalog's promise that listed models are usable. The repair is bounded, uses established contracts, and comes from a contributor with prior merged work in the affected catalog and capability paths.

Merge readiness

✅ Ready for maintainer review

This PR retains useful work that current main does not provide. The reported live results support the repair, and no actionable correctness or security finding remains.

Priority: P2
Reviewed head: 5445c872db06d44b5682b60e155f2187bef22110

Before merge

None.

Findings

None.

Agent review details

How this fits together

The GitHub Copilot provider plugin converts an authenticated account's model listing into models available to OpenClaw. Its endpoint and thinking metadata determine how the shared inference transports construct requests.

flowchart TD
  A[Authenticated Copilot account] --> B[Account model listing]
  B --> C[Copilot catalog projection]
  C --> D[Choose listed endpoint]
  C --> E[Resolve thinking capabilities]
  D --> F[Shared inference transport]
  E --> F
  F --> G[Copilot model response]
Loading

Technical review

Best possible solution:

Keep endpoint and effort projection in the Copilot plugin and reuse the shared Claude request contract.

Do we have a high-confidence way to reproduce the issue?

Yes, the source establishes the path: current main sends a Chat Completions-only kimi-k3 listing through Responses and lacks adaptive capability metadata for unknown Claude IDs. The contributor also reports matching live baseline failures; this review did not run a current-main reproduction.

Is this the best way to solve the issue?

Yes, this repairs the provider's catalog projection directly and feeds its existing transports and shared Claude predicates. It preserves older-listing fallback behavior without adding another catalog or configuration path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 97ead0272fa6.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current main still needs the repair: Current main selects transport from vendor and model ID, and constructs Claude thinking metadata without listed capability params. The merge-base-to-current-main comparison contains no changes to the Copilot plugin or its provider documentation. (extensions/github-copilot/models.ts:184, 97ead0272fa6)
  • Endpoint repair stays in the existing owner: The projection preserves the preferred transport when advertised, chooses a supported alternative otherwise, and retains ID-based behavior when endpoint metadata is absent. Chat Completions compatibility follows the selected transport. (extensions/github-copilot/models.ts:195, 5445c872db06)
  • Shared Claude contract is reused: Copilot projects xhigh-bearing Messages rows into the existing claudeCapabilities params and carries them into thinking policy. The shared Claude predicates already consume these flags, and the Anthropic transport uses the resulting adaptive-thinking decision. (extensions/github-copilot/models.ts:267, 5445c872db06)
  • Real Copilot after-fix evidence: The complete PR body reports isolated profiles and loopback Gateways using a real Individual account: kimi-k3 changes from HTTP 400 on Responses to HTTP 200 on Chat Completions; a real Claude model with local ID knowledge removed changes from rejected manual thinking to HTTP 200 at default, low, max, and off. Controls cover Responses, Chat Completions, and Messages. Captured body identity: f2303a7724d57ee85b213d7f1e47505b2fef84aa4700767a43c771baa01ffa47; the full body was also read through REST. (5445c872db06)
  • Related merged work supplies a contract, not a replacement: fix(anthropic): newly listed Claude models stay hidden until an OpenClaw release #167658 is merged and established listed Claude capability overrides in the shared implementation. Its body explicitly distinguishes Copilot rows, which previously lacked these params; it does not supersede this PR's Copilot projection. (packages/llm-core/src/model-contracts/anthropic.ts:16, b34025176354)
  • Feature-history routing: Scoped history connects live catalog discovery to Eduardo Piva, repeated metadata maintenance to Peter Steinberger, and prior merged Copilot catalog repairs to obviyus/Ayaan Zaidi. GitHub commit metadata verifies obviyus on the prior merged catalog repair. Some older blobs are unavailable locally; REST commit and PR records supplement that limit. (extensions/github-copilot/models.ts:327, 29614f7a6893)

Likely related people:

  • Ayaan Zaidi: Raw commit 29614f7 adds extensions/github-copilot/models.ts:326 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 29614f7a6893; files: extensions/github-copilot/models.ts)
  • Peter Steinberger: Raw commit 9ed5370 adds extensions/github-copilot/model-metadata.ts:2 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9ed537071bc4; files: extensions/github-copilot/model-metadata.ts)
  • Eduardo Piva: Raw commit 75405f6 adds extensions/github-copilot/models.ts:196 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 75405f64d0a7; files: extensions/github-copilot/models.ts)

PR surface

Source +35, Tests +80, Docs +5. Total +120 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 45 10 +35
Tests 2 218 138 +80
Docs 1 7 2 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 270 150 +120

Review metrics

Metric Value Why it matters
Production versus test LOC Production +45/-10; tests +218/-138 The modest production growth extends the existing catalog owner; most test churn relocates existing usage coverage.

Labels

Label changes:

  • add P2: The repair addresses first-turn failures for a bounded subset of GitHub Copilot models.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The repair addresses first-turn failures for a bounded subset of GitHub Copilot models.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

Reviewed October 9, 2026, 3:57 PM ET / 19:57 UTC.

@obviyus
obviyus merged commit d6158cc into main Oct 9, 2026
172 of 174 checks passed
@obviyus
obviyus deleted the fix/copilot-listed-endpoint-transport branch October 9, 2026 19:59
@obviyus

obviyus commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in d6158cc. Copilot now uses the API each listed model supports (kimi-k3 works) and sends adaptive thinking to listed Claude models OpenClaw doesn't know yet (simulated new Claude model works at every level). Proof: real Copilot Individual account, 29/29 picker models match the account's picker list, real turns per model, new-model simulation.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 10, 2026
…ls fail their first turn (openclaw#167941)

## What Problem This Solves

Fixes: GitHub Copilot models fail on their first turn when the account lists a chat model that only serves Chat Completions (`kimi-k3` today), or a Claude model OpenClaw does not recognize yet (a newly launched Claude).

## User Impact

User impact: every chat model a Copilot account shows in the picker now answers its first turn, including Claude models released after the installed OpenClaw version. No config, schema, or protocol changes.

Merge danger: low. Shipped models keep their current transport and thinking shape (the transport only changes when the account's listing says the default endpoint is unsupported; Claude capabilities are only derived for rows that list `xhigh`, which every currently listed adaptive Claude model already matches by ID). Older listings without `supported_endpoints` keep the ID rules.

## Why This Change Was Made

Copilot's `/models` already says how each model can be called:

- `supported_endpoints` names the endpoints a model accepts. OpenClaw picked the transport from the model ID only, so a non-Claude, non-Gemini ID always went to `/responses`. `kimi-k3` lists only `/chat/completions` and was rejected (`unsupported_api_for_model`). The Copilot plugin now keeps the family transport when it is listed and otherwise uses a listed endpoint, with the existing Copilot Chat Completions request options.
- Copilot lists effort levels instead of Anthropic's capability tree, so Claude request shaping fell back to ID rules. An unknown Claude ID got manual `thinking.type: enabled` budgets, which current Claude models reject (`Use thinking.type.adaptive and output_config.effort`). Claude rows that list `xhigh` (only adaptive-thinking Claude models offer it) now carry the existing `params.claudeCapabilities` contract (openclaw#167658), so they get adaptive thinking and the listed xhigh/max levels before OpenClaw learns their ID.

The `fetchCopilotUsage` tests moved from `models.test.ts` to `usage.test.ts` (their owner) to keep `models.test.ts` under the line cap; no test was removed.

## Evidence

Real GitHub Copilot (Individual) account, device-flow sign-in on isolated profiles and loopback Gateways.

- Sign-in with the Gateway running: Copilot picker 0 → 29 rows, no restart. Account `/models` returned 54 rows; the picker equals the listed `type: chat` + `model_picker_enabled: true` rows exactly (context/prompt limits and vision match). Hidden: 3 embeddings, 7 internal Fireworks rows (copilot-search/exec-agent/trajectory-compaction), `gpt-5.6-luna-utility`, `gpt-5.4-nano`, and legacy GPT-3.5/4/4o/4.1 rows, all `model_picker_enabled: false`.
- One `reply OK` turn per picker model on `origin/main` (2fd61a9): 27/29 ok. `kimi-k3` failed with HTTP 400 `unsupported_api_for_model` on `openai-responses`. `claude-haiku-4.5` at `--thinking low` was refused locally (the listing gives it no efforts); it passes at default/off.
- With this branch: `kimi-k3` 200 on `openai-completions` (low and medium). Regression set across transports and vendors: `gpt-5-mini`, `grok-4.7`, `mai-code-1.1-flash` (Responses), `gemini-3.8-flash` (Chat Completions), `claude-haiku-5.5` (Messages): all 200.
- New-model simulation (throwaway worktree, never pushed): removed `gpt-5.6-terra` and `claude-haiku-5.5` from the bundled manifests, ID rules/aliases, the recommended list, and a local copy of catalog.openclaw.ai served through `models.catalogRefresh.url`. Both still appeared after sign-in (29 rows). On main, `gpt-5.6-terra` worked (default/low) but `claude-haiku-5.5` failed with HTTP 400 (`thinking.type.enabled is not supported`). With this branch applied, both returned 200 at default, low, max, and off.
- `node scripts/run-vitest.mjs extensions/github-copilot`: 17 files, 214 tests pass. The new Claude test fails without the fix (manual budget payload) and passes with it.

Co-authored-by: Ayaan Zaidi <[email protected]>
@clawsweeper clawsweeper Bot mentioned this pull request Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: github-copilot P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant