From a3352f7be024ebe2d48f8061fe6f5baaa3331fc2 Mon Sep 17 00:00:00 2001 From: James Long Date: Mon, 9 Nov 2026 13:07:24 -0600 Subject: [PATCH] fix(tui): drop usage and the model detail line from the model picker (#62927) --- packages/tui/src/component/dialog-model.tsx | 28 ++------------------- packages/tui/test/usage-limits.test.tsx | 12 ++++----- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/packages/tui/src/component/dialog-model.tsx b/packages/tui/src/component/dialog-model.tsx index 4990b0fa33e..bd0d3489c90 100644 --- a/packages/tui/src/component/dialog-model.tsx +++ b/packages/tui/src/component/dialog-model.tsx @@ -1,5 +1,5 @@ import type { ModelInfo } from "@opencode/client" -import { createMemo, createSignal, onMount, Show } from "solid-js" +import { createMemo, createSignal, Show } from "solid-js" import { useLocal } from "../context/local" import { DialogSelect } from "../ui/dialog-select" import { useDialog } from "../ui/dialog" @@ -12,9 +12,7 @@ import { modelPreferenceKey } from "../model-preference" import { useLocation } from "../context/location" import { useNewDesigns } from "../config" import { DialogFreeModels } from "./dialog-model-free" -import { FavoriteMarker, ModelDetail, isFreeModel, prioritizeFavorites, sortModelOptions } from "./model-options" -import { DialogUsage, useUsageLimits } from "./usage" -import { formatDollars, usageLevel } from "../util/usage-limits" +import { FavoriteMarker, isFreeModel, prioritizeFavorites, sortModelOptions } from "./model-options" export function DialogModel(props: { providerID?: string }) { const local = useLocal() @@ -62,19 +60,6 @@ function DialogConnectedModels(props: { const newDesigns = useNewDesigns() const data = useData() const location = useLocation() - const dialog = useDialog() - const limits = useUsageLimits() - // Spend moves with every request, so the picker shows fresh limits. - onMount(() => limits.load(true)) - const usage = (model: ModelInfo) => { - const value = limits.usage(model) - if (value) { - const level = usageLevel(value, model) - return { text: `${formatDollars(value.left)} left`, danger: level === "out" || level === "reached" } - } - if (limits.unlimited(model)) return { text: "No limit" } - return undefined - } const [query, setQuery] = createSignal("") // Under new designs, favoriting does not reorder the list until the dialog is reopened. const favoritesAtOpen = [...local.model.favorite()] @@ -120,7 +105,6 @@ function DialogConnectedModels(props: { description: provider?.name ?? model.providerID, category, footer: trailing(model, isFavorite(item)), - detail: newDesigns() ? () => : undefined, onSelect: () => { props.onSelect(model.providerID, model.id) }, @@ -155,7 +139,6 @@ function DialogConnectedModels(props: { category: connected() ? (freeGroup(model) ? "Free" : (provider?.name ?? model.providerID)) : undefined, footer: trailing(model, favorite), free: isFreeModel(model), - detail: newDesigns() ? () => : undefined, onSelect() { props.onSelect(model.providerID, model.id) }, @@ -228,13 +211,6 @@ function DialogConnectedModels(props: { selection: "none", onTrigger: props.onConnect, }, - { - command: "model.dialog.usage", - title: newDesigns() ? "usage" : "Usage", - selection: "none", - hidden: !limits.info(), - onTrigger: () => dialog.replace(() => ), - }, { command: "model.dialog.favorite", title: newDesigns() ? (option) => (isFavorite(option?.value) ? "unfavorite" : "favorite") : "Favorite", diff --git a/packages/tui/test/usage-limits.test.tsx b/packages/tui/test/usage-limits.test.tsx index 781ca6d4c83..6fbade0e696 100644 --- a/packages/tui/test/usage-limits.test.tsx +++ b/packages/tui/test/usage-limits.test.tsx @@ -1,4 +1,4 @@ -import { test } from "bun:test" +import { expect, test } from "bun:test" import { createAppFixture } from "./fixture/app" import { tmpdir } from "./fixture/fixture" import { directory, json } from "./fixture/tui-client" @@ -150,13 +150,13 @@ test("shows what the workspace's limits leave and why a refused turn stopped", a frame.includes("Only you · GPT 5.6 Sol, Claude Opus 5"), ) - // The model picker says what's left on the model it highlights, and opens the same usage list. + // The model picker has no usage action and no per-model detail line; /usage is the way to the full list. setup.mockInput.pressEscape() await setup.waitForFrame((frame) => !frame.includes("Usage › Claude Opus 5")) await setup.mockInput.typeText("/models") setup.mockInput.pressEnter() - await setup.waitForFrame( - (frame) => - frame.includes("Search models") && /\$6 left +\$4\/\$20 per 1M/.test(frame) && frame.includes("usage ctrl+u"), - ) + await setup.waitForFrame((frame) => frame.includes("Search models") && frame.includes("favorite ctrl+f")) + const picker = setup.captureCharFrame() + expect(picker).not.toContain("usage ctrl+u") + expect(picker).not.toContain("per 1M") })