← Back to PRs

#20095: fix(model-forward-compat): extend claude-sonnet-4.6 forward-compat to github-copilot provider

by SeeYangZhi open 2026-02-18 14:26 View on GitHub →
agents size: S
## 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