Skip to content

fix(tui,app): keep variants saved for a model speed - #65982

Draft
vimtor wants to merge 1 commit into
devfrom
fix-speed-variants
Draft

vimtor wants to merge 1 commit into
devfrom
fix-speed-variants

Conversation

@vimtor

@vimtor vimtor commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

What broke

#65749 made a model's speeds (such as gpt-5.5-fast) share one reasoning variant, stored under the base model's key (openai/gpt-5.5). Before that change each speed was a model of its own, with its variant saved under its own key. After upgrading, the TypeScript TUI and the desktop/web app read only the base-model key. So a variant a user had saved for a speed model was silently ignored.

Who: users who had saved a variant for a speed model (for example variant: {"openai/gpt-5.5-fast": "high"}) and have no entry for the base model.

Trigger: in a new draft that has no configured variant, select GPT-5.5, then Fast. The prompt uses the default variant instead of high. Existing sessions are not affected, because their variant is stored with the session.

Introduced by #65749, at packages/tui/src/context/local.tsx (preferredSelection) and packages/app/src/providers/models/models.tsx (getVariant).

Fix

Both clients still read the shared base-model variant first. When that key has no entry, they now fall back to the model's own key, then to the first of its speeds that has a saved variant. This migrates old speed-keyed preferences when they are read. Writes still go to the shared base key, so the first variant the user picks replaces the old entry.

Because a model's speeds share one variant, the old speed entry also applies when the model runs at its standard speed, as long as no base-model entry exists.

Clients covered

  • Covered: the TypeScript TUI (packages/tui) and the desktop/web app (packages/app).
  • Not covered: the native Rust TUI (packages/cli-rs/crates/tui/src/local.rs, preferred), from feat(cli-rs): bring the Rust client up to v2.4.0, and fix finished subagents #65825. It reads only the base-model key and has the same gap. This PR changes only how preferences are read and never rewrites the saved file, so the Rust TUI is not fixed indirectly. It needs its own change.

Tests

  • packages/tui/test/component/dialog-speed.test.tsx: "a variant saved for a speed before speeds shared their model's variant still applies to it"
  • packages/app/test-browser/fixtures/model-selection.ts: "a variant saved for a speed before speeds shared their model's variant still applies in a draft"

Output before the fix:

(fail) a variant saved for a speed before speeds shared their model's variant still applies to it
@@ -3,3 +3,3 @@
    "providerID": "provider",
-   "variant": "high",
+   "variant": undefined,
  }
313 |   expect(composer.variant.current()).toBe("high")
error: expect(received).toBe(expected)
Expected: "high"
Received: undefined
(fail) a variant saved for a speed before speeds shared their model's variant still applies in a draft

Both pass after the fix. Package typechecks, packages/app unit and browser tests, packages/tui tests and bun run check all pass. One file-watcher test in packages/tui (test/plugin-source.test.ts) failed once during the full run; it is unrelated to this change and passes when run alone.

Found by the daily review job.

This branch has not been deployed

No deployments
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.

1 participant