Skip to content

feat: adopt ModelCapabilitiesOverride for vision-capable model switching (fixes #643)#824

Open
github-actions[bot] wants to merge 1 commit intomainfrom
fix/issue-643-model-capabilities-override
Open

feat: adopt ModelCapabilitiesOverride for vision-capable model switching (fixes #643)#824
github-actions[bot] wants to merge 1 commit intomainfrom
fix/issue-643-model-capabilities-override

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 1, 2026

Changes

When switching models mid-session via SwitchToAsync, PolyPilot now passes a ModelCapabilitiesOverride instead of null for models that have vision or reasoning capabilities.

What changed

  1. ModelCapabilities.GetCapabilitiesOverride(string modelSlug) — new static method that maps the existing ModelCapability flags to an SDK ModelCapabilitiesOverride object:

    • Vision-capable models (e.g. gemini-3-pro): sets Supports.Vision = true and provides Limits.Vision with supported media types (image/png, image/jpeg, image/gif, image/webp), max 10 images, and 20 MB size limit
    • Reasoning-expert models (e.g. claude-opus-4.6, gpt-5): sets Supports.ReasoningEffort = true
    • Models without vision or reasoning flags: returns null (server defaults apply)
  2. CopilotService.ChangeModelAsync — now calls GetCapabilitiesOverride(normalizedModel) and passes the result to SwitchToAsync instead of hardcoded null

Why

SDK v0.2.2 added ModelCapabilitiesOverride to ModelApi.SwitchToAsync(). By passing capabilities, the CLI can enforce proper image limits and token budgets per model instead of relying on server defaults. This is especially useful for vision-capable models where image constraints differ.

Testing

  • 9 new unit tests in ModelSelectionTests.cs covering all branches of GetCapabilitiesOverride:
    • Vision models get vision support + limits
    • Reasoning models get reasoning effort flag
    • Non-vision/non-reasoning models return null
    • Unknown models return null
    • Models with both flags get both set
  • Integration test in ModelCapabilitiesOverrideTests.cs for CI validation
  • All 3686 existing tests pass ✅

Fixes #643

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • 192.0.2.1

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "192.0.2.1"

See Network Configuration for more information.

Generated by Agent Fix for issue #643 · ● 23.3M ·

Pass ModelCapabilitiesOverride to SwitchToAsync instead of null.
For vision-capable models (e.g. gemini-3-pro), sets vision support
flags and image limits. For reasoning-expert models, sets the
reasoningEffort support flag.

Adds GetCapabilitiesOverride() to ModelCapabilities that maps
existing model capability flags to SDK ModelCapabilitiesOverride.

Fixes #643

Co-authored-by: copilot-agentic-workflow[bot] <224017+copilot-agentic-workflow[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Adopt ModelCapabilitiesOverride for vision-capable model switching

0 participants