Skip to content

fix(core): resolve reasoning variants for GitLab Duo models - #51082

Merged
rekram1-node merged 2 commits into
anomalyco:v2from
vglafirov:fix/gitlab-variants
Oct 6, 2026
Merged

rekram1-node merged 2 commits into
anomalyco:v2from
vglafirov:fix/gitlab-variants

Conversation

@vglafirov

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #51081

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Variant.resolve only builds variants for packages listed in PROTOCOLS. gitlab-ai-provider wasn't listed, so every GitLab model resolved to [] and lost the reasoning_options declared in models.dev.

This adds a gitlab protocol that routes on the model's backend and emits settings in the shape gitlab-ai-provider reads from providerOptions.gitlab (the option key already resolves to gitlab in aisdk.ts):

  • Claude (adaptive, e.g. Opus 4.8+/5.x, Sonnet 5, Fable): thinking: { type: "adaptive", effort }, which the provider serializes to thinking: { type: "adaptive", display: "summarized" } + output_config.effort. The toggle "off" state is thinking: { type: "disabled" }. Always-thinking models (Fable) get no toggle, same as anthropicMessages.
  • Claude (manual, ≤ 4.5): budget variants using thinking: { type: "enabled", budgetTokens }. Unlike direct Anthropic Opus 4.5, no effort is sent, because the provider's thinking config can't combine the two.
  • GPT / Codex: reasoningEffort via openaiChat. The provider maps this to reasoning_effort (Chat) or reasoning.effort (Responses) itself.
  • duo-workflow-*: no variants (server-side agent).

Which GitLab models get variants is still controlled by models.dev reasoning_options. Models with an empty list stay empty.

How did you verify your code works?

  • Added spells GitLab Duo variants for gitlab-ai-provider routes to packages/core/test/variant.test.ts. The variant, GitLab plugin, models-dev, provider, and aisdk tests pass, and bun run typecheck in packages/core is clean.
  • Ran Variant.resolve against the live https://models.dev/api.json GitLab catalog. For example, duo-chat-opus-5-5 → low…max with {"thinking":{"type":"adaptive","effort":"max"}}, duo-chat-sonnet-5 → none,low…max, duo-chat-gpt-6-sol → none,low…max with {"reasoningEffort":"max"}, and models with reasoning_options = [] → none.

Screenshots / recordings

N/A (no UI change)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@vglafirov
vglafirov force-pushed the fix/gitlab-variants branch from 6ed66ec to 8c66015 Compare October 5, 2026 14:21
@vglafirov

Copy link
Copy Markdown
Contributor Author

Rebased onto current v2. The only conflict was the @ai-sdk/cohere entry in PROTOCOLS, which went away when Cohere moved to the native provider (#52633). The variant logic is unchanged.

I re-checked it against the bundled models.dev snapshot on v2. Without this change, all 30 GitLab models resolve to no variants. With it, the 15 that declare reasoning_options get them. That now includes the new duo-chat-sonnet-5-5 and duo-chat-gpt-6-1-sol, which become selectable with the gitlab-ai-provider 6.19.0 bump in #53352. bun typecheck passes, and the variant, GitLab plugin and aisdk tests give 71 pass, 0 fail.

@rekram1-node
rekram1-node merged commit 5ae8a3c into anomalyco:v2 Oct 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants