openclaw - 💡(How to fix) Fix github-copilot: Claude Opus 1m variants treated as 128K context (and xhigh blocked for 4.7-1m-internal) [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#72824Fetched 2026-04-28 06:31:54
View on GitHub
Comments
1
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
commented ×1

OpenClaw's GitHub Copilot extension treats Copilot's long-context Claude Opus variants (claude-opus-4.6-1m, claude-opus-4.7-1m-internal) as if they had a 128K context window, even though Copilot's /models endpoint advertises 1,000,000 input tokens / 64,000 output tokens for both. The 4.7 variant also loses access to xhigh reasoning effort, which Copilot does support upstream for that one.

Root Cause

Two related places hard-code defaults instead of consulting per-id metadata:

  1. extensions/github-copilot/models.ts → resolveCopilotForwardCompatModel(...) falls through to a synthetic catch-all that uses DEFAULT_CONTEXT_WINDOW = 128_000 and DEFAULT_MAX_TOKENS = 8192 for any id not already in the registry.
  2. extensions/github-copilot/models-defaults.ts → buildCopilotModelDefinition(...) uses the same 128K/8K defaults when seeding agents.defaults.models.
  3. extensions/github-copilot/index.ts → COPILOT_XHIGH_MODEL_IDS = ["gpt-5.4", "gpt-5.3-codex", "gpt-5.2", "gpt-5.2-codex"] does not include the Claude variants that advertise reasoning_effort: ["low","medium","high","xhigh"] upstream.

Empirical verification that reasoning_effort is honored end-to-end (same prompt, model claude-opus-4.7-1m-internal):

effort=low     completion_tokens=1073  elapsed=24.4s
effort=medium  completion_tokens=1459  elapsed=20.6s
effort=high    completion_tokens=1855  elapsed=35.1s
effort=xhigh   completion_tokens=1767  elapsed=29.6s

So high and xhigh are real upstream behavior changes, not silent caps - the OpenClaw runtime is just refusing to send xhigh for these ids.

Fix Action

Fix

Open PR adds a small COPILOT_KNOWN_CAPABILITIES table in extensions/github-copilot/models.ts consulted by both code paths above, plus extends COPILOT_XHIGH_MODEL_IDS to include claude-opus-4.7-1m-internal. Tests added in extensions/github-copilot/models.test.ts.

Code Example

claude-opus-4.6-1m            ctx=1000000 out=64000 effort=[low,medium,high]      adaptive=True
claude-opus-4.6                ctx=200000  out=32000 effort=[low,medium,high]      adaptive=True
claude-opus-4.7-1m-internal    ctx=1000000 out=64000 effort=[low,medium,high,xhigh] adaptive=True
claude-opus-4.7                ctx=200000  out=32000 effort=[medium]                adaptive=True

---

effort=low     completion_tokens=1073  elapsed=24.4s
effort=medium  completion_tokens=1459  elapsed=20.6s
effort=high    completion_tokens=1855  elapsed=35.1s
effort=xhigh   completion_tokens=1767  elapsed=29.6s
RAW_BUFFERClick to expand / collapse

Issue: GitHub Copilot Claude Opus "1m" variants get 128K context window instead of 1M

Summary

OpenClaw's GitHub Copilot extension treats Copilot's long-context Claude Opus variants (claude-opus-4.6-1m, claude-opus-4.7-1m-internal) as if they had a 128K context window, even though Copilot's /models endpoint advertises 1,000,000 input tokens / 64,000 output tokens for both. The 4.7 variant also loses access to xhigh reasoning effort, which Copilot does support upstream for that one.

Repro

GitHub Copilot's /models response (verified against https://api.githubcopilot.com/models with a normal Copilot OAuth token):

claude-opus-4.6-1m            ctx=1000000 out=64000 effort=[low,medium,high]      adaptive=True
claude-opus-4.6                ctx=200000  out=32000 effort=[low,medium,high]      adaptive=True
claude-opus-4.7-1m-internal    ctx=1000000 out=64000 effort=[low,medium,high,xhigh] adaptive=True
claude-opus-4.7                ctx=200000  out=32000 effort=[medium]                adaptive=True

In OpenClaw 2026.4.23+, after switching the active model to github-copilot/claude-opus-4.7-1m-internal:

  • 📊 session_status reports Context: …/200k instead of 1M (the 200K is the OpenClaw DEFAULT_CONTEXT_TOKENS fallback because the synthetic copilot model is built with contextWindow: 128_000, which is below the agents-runtime fallback).
  • /think xhigh is rejected with "thinkingLevel xhigh is not supported for github-copilot/claude-opus-4.7-1m-internal".

Root cause

Two related places hard-code defaults instead of consulting per-id metadata:

  1. extensions/github-copilot/models.ts → resolveCopilotForwardCompatModel(...) falls through to a synthetic catch-all that uses DEFAULT_CONTEXT_WINDOW = 128_000 and DEFAULT_MAX_TOKENS = 8192 for any id not already in the registry.
  2. extensions/github-copilot/models-defaults.ts → buildCopilotModelDefinition(...) uses the same 128K/8K defaults when seeding agents.defaults.models.
  3. extensions/github-copilot/index.ts → COPILOT_XHIGH_MODEL_IDS = ["gpt-5.4", "gpt-5.3-codex", "gpt-5.2", "gpt-5.2-codex"] does not include the Claude variants that advertise reasoning_effort: ["low","medium","high","xhigh"] upstream.

Empirical verification that reasoning_effort is honored end-to-end (same prompt, model claude-opus-4.7-1m-internal):

effort=low     completion_tokens=1073  elapsed=24.4s
effort=medium  completion_tokens=1459  elapsed=20.6s
effort=high    completion_tokens=1855  elapsed=35.1s
effort=xhigh   completion_tokens=1767  elapsed=29.6s

So high and xhigh are real upstream behavior changes, not silent caps - the OpenClaw runtime is just refusing to send xhigh for these ids.

Fix

Open PR adds a small COPILOT_KNOWN_CAPABILITIES table in extensions/github-copilot/models.ts consulted by both code paths above, plus extends COPILOT_XHIGH_MODEL_IDS to include claude-opus-4.7-1m-internal. Tests added in extensions/github-copilot/models.test.ts.

Longer-term

The cleanest fix would be to fetch capabilities from /models at provider discovery time and adopt the upstream max_context_window_tokens, max_output_tokens, and supports.reasoning_effort directly. This PR is intentionally narrower (no async plumbing, no caching) and only patches the two known divergences. Happy to follow up with a discovery-based PR if maintainers want it.

extent analysis

TL;DR

Update the COPILOT_KNOWN_CAPABILITIES table and COPILOT_XHIGH_MODEL_IDS in extensions/github-copilot/models.ts to reflect the correct capabilities of Claude Opus variants.

Guidance

  • Verify that the COPILOT_KNOWN_CAPABILITIES table is correctly populated with the capabilities of each model variant, including context window and supported reasoning efforts.
  • Update the COPILOT_XHIGH_MODEL_IDS list to include claude-opus-4.7-1m-internal to enable xhigh reasoning effort for this model.
  • Test the changes using the provided empirical verification method to ensure that the reasoning_effort is honored end-to-end.
  • Consider implementing a longer-term fix that fetches capabilities from the /models endpoint at provider discovery time to ensure accuracy and reduce maintenance.

Example

No code snippet is provided as the issue already includes a proposed fix in the form of an Open PR.

Notes

The proposed fix is intentionally narrow and only addresses the known divergences between OpenClaw and Copilot's advertised capabilities. A more comprehensive solution would involve fetching capabilities from the /models endpoint at provider discovery time.

Recommendation

Apply the workaround by updating the COPILOT_KNOWN_CAPABILITIES table and COPILOT_XHIGH_MODEL_IDS as proposed in the Open PR, as this is a targeted fix that addresses the specific issue at hand.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING