Skip to content

fix: add GPT-5.5 capabilities to GitHub Copilot provider catalog#71924

Closed
muhualing wants to merge 11 commits into
openclaw:mainfrom
muhualing:fix/github-copilot-model-metadata
Closed

fix: add GPT-5.5 capabilities to GitHub Copilot provider catalog#71924
muhualing wants to merge 11 commits into
openclaw:mainfrom
muhualing:fix/github-copilot-model-metadata

Conversation

@muhualing

@muhualing muhualing commented Apr 26, 2026

Copy link
Copy Markdown

Summary

  • fetch GitHub Copilot /models during provider catalog discovery instead of publishing an empty model list
  • map Copilot capability limits into OpenClaw model metadata (contextWindow, maxTokens, input, reasoning, transport API)
  • make GPT-5.5 available in the GitHub Copilot provider catalog with its advertised 400k context / 128k output capability and include it in xhigh thinking profiles

Why

GitHub Copilot exposes current model capabilities via /models, including gpt-5.5 with a 400k context window and 128k max output. The provider catalog previously returned models: [], so newly configured Copilot models fell through to the synthetic dynamic-model path and inherited the conservative 128k/8192 defaults.

Verification

  • corepack pnpm format:check -- extensions/github-copilot/index.ts extensions/github-copilot/index.test.ts
  • corepack pnpm exec vitest run extensions/github-copilot/index.test.ts extensions/github-copilot/models.test.ts

Fixes #71936

@greptile-apps

greptile-apps Bot commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR populates the GitHub Copilot provider catalog by fetching /models at discovery time and mapping the wire format into ProviderRuntimeModel entries, replacing the previous hard-coded empty list. gpt-5.5 is also added to the COPILOT_XHIGH_MODEL_IDS static list. The implementation is defensive (unknown-typed wire fields, positiveInteger guard, .catch(() => []) on the fetch), and the new unit/integration tests cover the happy path well. The pre-existing "uses live plugin config to re-enable discovery" test is the only area that needs attention: it no longer mocks fetchFn, so it silently exercises the real network path and relies on error-handling fallbacks to satisfy models: [].

Confidence Score: 4/5

Safe to merge; only P2 findings present with no correctness-affecting defects in the production path.

All production-path changes are well-guarded and the new tests cover the key scenarios. The two findings are P2: a test that accidentally passes due to error-handling fallbacks instead of explicit mocking, and a fragile /v1/messages substring heuristic for API selection. Neither affects runtime correctness today.

extensions/github-copilot/index.test.ts — the 'uses live plugin config to re-enable discovery after startup disable' test should have a fetchFn mock added.

Comments Outside Diff (1)

  1. extensions/github-copilot/index.test.ts, line 84-118 (link)

    P2 Stale test expects models: [] without mocking fetchFn

    After this PR, catalog.run calls fetchCopilotModelCatalog whenever apiToken is set. This test resolves a non-empty token but passes no fetchFn, so the new code falls through to the global fetch and attempts a real call to https://api.githubcopilot.live/models. The assertion models: [] passes accidentally (the fake token yields a 401 → !response.ok[], or a network error is swallowed by .catch(() => [])) rather than being an intentional controlled assertion. The new "fetches Copilot /models during catalog discovery" test shows the right pattern — add a fetchFn mock here as well to eliminate the unintended network I/O and make the intent explicit.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: extensions/github-copilot/index.test.ts
    Line: 84-118
    
    Comment:
    **Stale test expects `models: []` without mocking `fetchFn`**
    
    After this PR, `catalog.run` calls `fetchCopilotModelCatalog` whenever `apiToken` is set. This test resolves a non-empty token but passes no `fetchFn`, so the new code falls through to the global `fetch` and attempts a real call to `https://api.githubcopilot.live/models`. The assertion `models: []` passes accidentally (the fake token yields a 401 → `!response.ok``[]`, or a network error is swallowed by `.catch(() => [])`) rather than being an intentional controlled assertion. The new "fetches Copilot /models during catalog discovery" test shows the right pattern — add a `fetchFn` mock here as well to eliminate the unintended network I/O and make the intent explicit.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/github-copilot/index.ts
Line: 78-80

Comment:
**`/v1/messages` substring check is the only Anthropic API heuristic**

The `api` field is resolved by checking whether any `supported_endpoints` entry contains the substring `"/v1/messages"`. If the Copilot API surfaces Anthropic-compatible endpoints under a different path (e.g., `/messages`, `/chat/v1/messages`), the function would silently fall back to `"openai-responses"` for those models. A comment explaining the expected endpoint format, or a slightly broader check, would prevent silent mismapping.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/github-copilot/index.test.ts
Line: 84-118

Comment:
**Stale test expects `models: []` without mocking `fetchFn`**

After this PR, `catalog.run` calls `fetchCopilotModelCatalog` whenever `apiToken` is set. This test resolves a non-empty token but passes no `fetchFn`, so the new code falls through to the global `fetch` and attempts a real call to `https://api.githubcopilot.live/models`. The assertion `models: []` passes accidentally (the fake token yields a 401 → `!response.ok``[]`, or a network error is swallowed by `.catch(() => [])`) rather than being an intentional controlled assertion. The new "fetches Copilot /models during catalog discovery" test shows the right pattern — add a `fetchFn` mock here as well to eliminate the unintended network I/O and make the intent explicit.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix: load github copilot model capabilit..." | Re-trigger Greptile

Comment thread extensions/github-copilot/index.ts Outdated
Comment on lines +78 to +80
api: endpoints.some((endpoint) => endpoint.includes("/v1/messages"))
? "anthropic-messages"
: "openai-responses",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 /v1/messages substring check is the only Anthropic API heuristic

The api field is resolved by checking whether any supported_endpoints entry contains the substring "/v1/messages". If the Copilot API surfaces Anthropic-compatible endpoints under a different path (e.g., /messages, /chat/v1/messages), the function would silently fall back to "openai-responses" for those models. A comment explaining the expected endpoint format, or a slightly broader check, would prevent silent mismapping.

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/github-copilot/index.ts
Line: 78-80

Comment:
**`/v1/messages` substring check is the only Anthropic API heuristic**

The `api` field is resolved by checking whether any `supported_endpoints` entry contains the substring `"/v1/messages"`. If the Copilot API surfaces Anthropic-compatible endpoints under a different path (e.g., `/messages`, `/chat/v1/messages`), the function would silently fall back to `"openai-responses"` for those models. A comment explaining the expected endpoint format, or a slightly broader check, would prevent silent mismapping.

How can I resolve this? If you propose a fix, please make it concise.

@muhualing muhualing changed the title fix: load GitHub Copilot model capabilities from /models fix: add GPT-5.5 capabilities to GitHub Copilot provider catalog Apr 26, 2026
@clawsweeper

clawsweeper Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

Close as implemented on main: the central Copilot GPT-5.5/live /models catalog behavior has landed through a newer merged implementation, so this branch should not be merged as a parallel fix.

So I’m closing this as already implemented rather than keeping a duplicate issue open.

Review details

Best possible solution:

Keep the merged current-main implementation from #79566 and track any further Copilot catalog hardening separately.

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

No. The original source-level repro no longer holds on current main: Copilot catalog discovery now calls /models, gpt-5.5 has static fallback metadata, and the manifest is refreshable.

Is this the best way to solve the issue?

No for merging this branch. The newer mainline implementation is the better solution because it includes the manifest refreshability, static fallback rows, docs/tests, and release provenance missing from this branch.

Security review:

Security review needs attention: The PR branch adds a raw network fetch for a token-derived Copilot catalog URL; this is another reason to avoid merging the superseded branch.

  • [medium] Guard token-derived Copilot catalog fetches — extensions/github-copilot/index.ts:148
    fetchCopilotModelCatalog constructs the request URL from baseUrl and calls raw fetch; provider catalog refresh should use the existing guarded outbound-fetch pattern before this branch could be merged.
    Confidence: 0.82

What I checked:

  • Current main fetches the live Copilot catalog: Current main's GitHub Copilot catalog hook resolves the Copilot API token, calls fetchCopilotModelCatalog through getCachedLiveCatalogValue, and returns the discovered model rows instead of a hard-coded empty list. (extensions/github-copilot/index.ts:267, c0e287f3c1d1)
  • Current main has GPT-5.5 static fallback metadata: The static Copilot manifest now includes gpt-5.5 with contextWindow: 400000, maxTokens: 128000, and the manifest marks GitHub Copilot discovery as refreshable. (extensions/github-copilot/openclaw.plugin.json:168, c0e287f3c1d1)
  • Current main tests lock in GPT-5.5 metadata: The Copilot model tests assert gpt-5.5 fallback rows resolve to 400k context, 128k max output, reasoning enabled, and the OpenAI Responses API. (extensions/github-copilot/models.test.ts:96, c0e287f3c1d1)
  • Merged fix provenance: GitHub commit metadata for 75405f64d0a79fd332389ae46afd349ebdf60425 shows the newer merged implementation added fetchCopilotModelCatalog, called it from the Copilot catalog hook, changed the manifest to refreshable, and added gpt-5.5 static catalog/default rows. (75405f64d0a7)
  • Follow-up fallback metadata provenance: Commit 880c0944072d83076110078d31c27ef484e380b8 added model-metadata.ts and preserved GPT-5.5 static override metadata for fallback paths after the live-catalog work landed. (extensions/github-copilot/model-metadata.ts:4, 880c0944072d)
  • Release provenance: GitHub compare reports v2026.5.9-beta.1 is ahead of the fix commit with the fix as the merge base, and the release was published on 2026-05-09; v2026.5.7 diverges before the fix. (75405f64d0a7)

Likely related people:

  • efpiva: Authored the newer merged live Copilot catalog implementation that covers this PR's central behavior. (role: merged feature contributor; confidence: high; commits: 75405f64d0a7; files: extensions/github-copilot/index.ts, extensions/github-copilot/models.ts, extensions/github-copilot/openclaw.plugin.json)
  • steipete: Landed the newer implementation and added the follow-up GPT-5.5 fallback metadata commit on the same Copilot model surface. (role: merger and recent area contributor; confidence: high; commits: 880c0944072d, 827b0de0ce74; files: extensions/github-copilot/model-metadata.ts, extensions/github-copilot/models.ts, extensions/github-copilot/models-defaults.ts)
  • fuller-stack-dev: Introduced the dynamic GitHub Copilot model-resolution path that previously supplied conservative synthetic metadata for forward-compatible model IDs. (role: introduced dynamic fallback behavior; confidence: medium; commits: 5137a5130746; files: extensions/github-copilot/models.ts, extensions/github-copilot/models.test.ts, extensions/github-copilot/index.ts)
  • obviyus: Recent history shows the GitHub Copilot static manifest catalog and defaults surface that the GPT-5.5 fallback rows extend. (role: static catalog/defaults contributor; confidence: medium; commits: 42b352c57eb8, 22c42b6b309d; files: extensions/github-copilot/openclaw.plugin.json, extensions/github-copilot/models-defaults.ts, extensions/github-copilot/index.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 9be8d38f9563; fix evidence: release v2026.5.9-beta.1, commit 75405f64d0a7.

@openclaw-barnacle openclaw-barnacle Bot added channel: line Channel integration: line commands Command implementations labels Apr 29, 2026
muhualing and others added 4 commits April 30, 2026 00:03
The Copilot /models endpoint also lists embedding models (e.g.
text-embedding-3-small) consumed by the embedding provider. Filter
them out in mapCopilotWireModel so they aren't surfaced as chat
models with the Responses transport, which would fail at runtime.
@mikeus-hanzlik

Copy link
Copy Markdown

Thanks for working on this. I re-checked the currently published images/tags today and this is still user-visible in the latest beta line.

Findings from v2026.5.2-beta.1 / ghcr.io/openclaw/openclaw:2026.5.2-beta.1:

  • the Docker release workflow built and pushed the arch images and created the manifest; it only failed later during attestation verification
  • extensions/github-copilot/models-defaults.ts still does not include gpt-5.5
  • extensions/github-copilot/index.ts still returns models: [] from the Copilot provider catalog
  • configured/forward-compatible Copilot models therefore still fall through to the synthetic defaults (contextWindow: 128_000, maxTokens: 8192)

That means users can manually configure github-copilot/gpt-5.5, but OpenClaw still does not pick up the Copilot-advertised GPT-5.5 limits (400k context / 128k output) from /models in current published images. This PR still looks like the right fix for the image/user-facing issue.

@ar27111994

Copy link
Copy Markdown

Any updates on when this pr will be merged? Thank you for the detailed fixes.

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

Labels

channel: line Channel integration: line commands Command implementations size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitHub Copilot provider catalog does not load GPT-5.5 capabilities from /models

3 participants