#20095: fix(model-forward-compat): extend claude-sonnet-4.6 forward-compat to github-copilot provider
agents
size: S
Cluster:
AI Provider Enhancements
## What this fixes (temporary shim)
Requests to `github-copilot/claude-sonnet-4.6` were failing silently because OpenClaw’s forward-compat resolver only handled provider="anthropic" for Sonnet 4.6. Copilot wasn’t matched, so the model lookup returned undefined and fell through the fallback chain.
This PR extends the provider guard to include `github-copilot`, cloning the existing Copilot `claude-sonnet-4.5` template as `claude-sonnet-4.6`. That restores routing and replies immediately.
- Wire behavior: Calls Copilot with model id `claude-sonnet-4.6` (actual 4.6 responses)
- Local metadata: Uses Sonnet 4.5 Copilot parameters (128k context) until upstream catalog adds proper 4.6 entry
## Why not change the Copilot catalog here?
OpenClaw relies on pi-ai’s generated model catalog. Changing OpenClaw’s dead-code Copilot models file has no effect. The correct long-term fix lives upstream in pi-mono.
## Upstream status
- PR opened (pi-mono): SeeYangZhi/pi-mono#1 — adds `github-copilot/claude-sonnet-4.6` to generator with Copilot endpoint + headers
- OSS Vacation: pi-mono’s issue tracker/PRs reopen **Feb 23, 2026**; PRs may auto-close until then. Approved contributors can submit after vacation without reapproval. For support, join Discord.
## Scope & safety
- Single-line provider guard change in `model-forward-compat.ts`
- Adds unit tests proving `github-copilot/claude-sonnet-4.6` resolves via 4.5 template and that `anthropic` behavior is unchanged
- No other behavior changes
## TL;DR
- Now: OpenClaw resolves `github-copilot/claude-sonnet-4.6` and replies
- Temporary: Uses Copilot Sonnet 4.5 local metadata (128k) until upstream publishes 4.6 in catalog
- Later: Upstream PR will provide the proper Copilot 4.6 entry; once adopted, OpenClaw will reflect correct context/pricing automatically
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Extends the `claude-sonnet-4.6` forward-compatibility resolver to handle the `github-copilot` provider in addition to `anthropic`. Previously, the provider guard in `resolveAnthropicSonnet46ForwardCompatModel` only matched `anthropic`, causing `github-copilot/claude-sonnet-4.6` to silently fail model resolution.
- **One-line fix** in `src/agents/model-forward-compat.ts`: broadens the provider guard to also accept `github-copilot`, allowing the existing clone-from-sonnet-4.5 logic to run for both providers
- **New test file** `src/agents/model-forward-compat.test.ts`: covers dot variant, hyphen variant, anthropic regression, and negative case for unrelated providers
- Clean, focused change with no side effects on other resolvers or providers
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge — it's a minimal, well-tested one-line guard extension with no risk to existing behavior.
- The change is a single additional condition in a provider guard, the existing anthropic path is unaffected (confirmed by regression test), and the new github-copilot path is covered by focused unit tests. The clone logic downstream is already provider-agnostic.
- No files require special attention.
<sub>Last reviewed commit: 6fac229</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#20747: feat(copilot): support Claude models with correct context windows (...
by yuf1011 · 2026-02-19
85.2%
#23250: feat: add Sonnet 4.6 forward compat for google-antigravity
by Oceanswave · 2026-02-22
83.2%
#19533: fix: allow forward-compat models in buildAllowedModelSet
by Anthony-g-dev · 2026-02-17
82.7%
#13119: fix: add forward-compat for google-antigravity claude-opus-4-6 models
by sdb001 · 2026-02-10
82.0%
#16891: fix(models): generic opus-4-6 forward-compat for all providers
by battman21 · 2026-02-15
79.7%
#18697: fix: include forward-compat models in model catalog for allowlist val…
by dmitry-orabey · 2026-02-17
79.2%
#11447: feat(providers): add Claude models to GitHub Copilot provider
by yylonly · 2026-02-07
79.0%
#21181: fix(models): add gemini-3.1-pro-preview forward-compat for google-g...
by Mellowambience · 2026-02-19
78.7%
#12220: fix: forward-compat models now respect user-configured contextWindow
by Batuhan4 · 2026-02-09
78.4%
#10831: fix(agents): set Opus 4.6 context window to 1M in forward-compat fa...
by slawt · 2026-02-07
77.6%