Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(settings): name Settings model options by their vendor account

hxj04121-labd0db0d85d88e
diff --git a/apps/desktop/src/components/settings/EnhancementModelCard.tsx b/apps/desktop/src/components/settings/EnhancementModelCard.tsx
index 416486033..f0c641e00 100644
--- a/apps/desktop/src/components/settings/EnhancementModelCard.tsx
+++ b/apps/desktop/src/components/settings/EnhancementModelCard.tsx
@@ -24,6 +24,7 @@ import {
} from "../../features/chat/composer/model";
import { useAppStore } from "../../stores/app-store";
import { api } from "../../lib/api";
+import { providerDisplayName, providerSearchText } from "../../lib/provider-display";
import { Button, Input, cx } from "../ui";
import { IconCheck, IconChevronDown, IconSearch } from "../icons";
import { AnchoredMenu } from "./AnchoredMenu";
@@ -68,7 +69,7 @@ export function EnhancementModelCard() {
const needle = query.trim().toLowerCase();
if (!needle) return options;
return options.filter(({ provider, modelId }) =>
- `${provider.name} ${modelId}`.toLowerCase().includes(needle),
+ `${providerSearchText(provider)} ${modelId}`.toLowerCase().includes(needle),
);
}, [options, query]);
@@ -163,7 +164,9 @@ export function EnhancementModelCard() {
settings.promptEnhancementProviderId && settings.promptEnhancementModelId ? (
<span className="model-default-value">
<span className="model-default-provider">
- {pinnedProvider?.name ?? settings.promptEnhancementProviderId}
+ {pinnedProvider
+ ? providerDisplayName(pinnedProvider)
+ : settings.promptEnhancementProviderId}
</span>
<span className="model-default-sep" aria-hidden>
·
@@ -264,14 +267,14 @@ export function EnhancementModelCard() {
index > 0 && "has-divider",
)}
>
- {provider.name}
+ {providerDisplayName(provider)}
</div>
) : null}
<button
type="button"
role="option"
aria-selected={isCurrent}
- aria-label={`${provider.name} · ${modelId}`}
+ aria-label={`${providerDisplayName(provider)} · ${modelId}`}
className={cx("model-default-option", isCurrent && "is-current")}
onClick={() => void pickModel(provider.id, modelId)}
>
diff --git a/apps/desktop/src/components/settings/ModelConfigPage.tsx b/apps/desktop/src/components/settings/ModelConfigPage.tsx
index f5d80f474..dc065c016 100644
--- a/apps/desktop/src/components/settings/ModelConfigPage.tsx
+++ b/apps/desktop/src/components/settings/ModelConfigPage.tsx
@@ -20,6 +20,7 @@ import {
} from "@pi-desktop/shared";
import { useAppStore } from "../../stores/app-store";
import { api } from "../../lib/api";
+import { providerDisplayName, providerSearchText } from "../../lib/provider-display";
import { Badge, Button, Field, Input, TooltipButton, cx } from "../ui";
import {
IconCheck,
@@ -136,7 +137,7 @@ export function ModelConfigPage() {
const query = defaultModelQuery.trim().toLowerCase();
if (!query) return defaultModelOptionsList;
return defaultModelOptionsList.filter(({ provider, modelId }) =>
- `${provider.name} ${modelId}`.toLowerCase().includes(query),
+ `${providerSearchText(provider)} ${modelId}`.toLowerCase().includes(query),
);
}, [defaultModelOptionsList, defaultModelQuery]);
@@ -393,7 +394,9 @@ export function ModelConfigPage() {
</div>
{defaultProviderReady ? (
<div className="settings-row-detail model-default-value">
- <span className="model-default-provider">{defaultProvider.name}</span>
+ <span className="model-default-provider">
+ {providerDisplayName(defaultProvider)}
+ </span>
<span className="model-default-sep" aria-hidden>
·
</span>
@@ -467,14 +470,14 @@ export function ModelConfigPage() {
index > 0 && "has-divider",
)}
>
- {provider.name}
+ {providerDisplayName(provider)}
</div>
) : null}
<button
type="button"
role="option"
aria-selected={isCurrent}
- aria-label={`${provider.name} · ${modelId}`}
+ aria-label={`${providerDisplayName(provider)} · ${modelId}`}
className={cx("model-default-option", isCurrent && "is-current")}
disabled={busyId === provider.id}
onClick={() => void setDefaultModel(provider, modelId)}
diff --git a/apps/desktop/src/features/chat/composer/hooks/useComposerModelMenu.ts b/apps/desktop/src/features/chat/composer/hooks/useComposerModelMenu.ts
index a9b07cd72..32cdcde39 100644
--- a/apps/desktop/src/features/chat/composer/hooks/useComposerModelMenu.ts
+++ b/apps/desktop/src/features/chat/composer/hooks/useComposerModelMenu.ts
@@ -14,9 +14,11 @@ import { useAppStore } from "../../../../stores/app-store";
import {
composerModelMatchesQuery,
composerModelsForProvider,
- composerProviderDisplayName,
- composerProviderSearchText,
} from "../../../../lib/composer-models";
+import {
+ providerDisplayName,
+ providerSearchText,
+} from "../../../../lib/provider-display";
import { providerThinkingLevels } from "../../../../lib/session-thinking";
import {
sessionThinkingMenuLevels,
@@ -127,8 +129,8 @@ export function useComposerModelMenu({
);
return {
provider: candidate,
- providerDisplayName: composerProviderDisplayName(candidate),
- providerSearchText: composerProviderSearchText(candidate),
+ providerDisplayName: providerDisplayName(candidate),
+ providerSearchText: providerSearchText(candidate),
models,
};
})
diff --git a/apps/desktop/src/lib/composer-models.ts b/apps/desktop/src/lib/composer-models.ts
index 448cec029..8671aa0bf 100644
--- a/apps/desktop/src/lib/composer-models.ts
+++ b/apps/desktop/src/lib/composer-models.ts
@@ -11,30 +11,6 @@ import {
type ConfiguredProvider = Pick<ProviderPublic, "id" | "models" | "defaultModelId">;
-/**
- * Resolve the provider heading shown in the Composer model menu.
- *
- * OAuth rows keep the vendor name as `provider.name` for runtime identity, but
- * the account-specific display label lives in `oauthAccountLabel`. Prefer that
- * label so duplicate accounts from one vendor remain distinguishable.
- */
-export function composerProviderDisplayName(
- provider: Pick<ProviderPublic, "name" | "oauthAccountLabel">,
-): string {
- return provider.oauthAccountLabel?.trim() || provider.name.trim();
-}
-
-/** Keep both the account label and vendor name searchable in the Composer. */
-export function composerProviderSearchText(
- provider: Pick<ProviderPublic, "name" | "oauthAccountLabel">,
-): string {
- const displayName = composerProviderDisplayName(provider);
- const providerName = provider.name.trim();
- return displayName === providerName
- ? displayName
- : `${displayName} ${providerName}`;
-}
-
function configuredModelIds(provider: ConfiguredProvider): string[] {
const ids = (provider.models ?? [])
.map((binding) => binding.id.trim())
diff --git a/apps/desktop/src/lib/provider-display.ts b/apps/desktop/src/lib/provider-display.ts
new file mode 100644
index 000000000..cf50bfabc
--- /dev/null
+++ b/apps/desktop/src/lib/provider-display.ts
@@ -0,0 +1,27 @@
+/**
+ * How a configured provider is named wherever the UI lists providers.
+ *
+ * An OAuth row keeps the vendor name in `provider.name` for runtime identity,
+ * while the label the user gave that account lives in `oauthAccountLabel`.
+ * Preferring the account label is what keeps two accounts of the same vendor
+ * distinguishable, so every provider list resolves its heading through here
+ * rather than reading `provider.name` directly.
+ */
+import type { ProviderPublic } from "@pi-desktop/shared";
+
+/** The fields a provider list needs to name a row. */
+export type ProviderDisplayFields = Pick<ProviderPublic, "name" | "oauthAccountLabel">;
+
+/** The provider heading shown to the user: account label first, vendor name otherwise. */
+export function providerDisplayName(provider: ProviderDisplayFields): string {
+ return provider.oauthAccountLabel?.trim() || provider.name.trim();
+}
+
+/** Keep both the account label and the vendor name searchable. */
+export function providerSearchText(provider: ProviderDisplayFields): string {
+ const displayName = providerDisplayName(provider);
+ const providerName = provider.name.trim();
+ return displayName === providerName
+ ? displayName
+ : `${displayName} ${providerName}`;
+}
diff --git a/apps/desktop/test/composer-model-thinking-menu.test.mjs b/apps/desktop/test/composer-model-thinking-menu.test.mjs
index 2c6e00893..b22c6da0a 100644
--- a/apps/desktop/test/composer-model-thinking-menu.test.mjs
+++ b/apps/desktop/test/composer-model-thinking-menu.test.mjs
@@ -116,8 +116,8 @@ test("model options are visually nested under their provider heading", () => {
});
test("model groups use the account-aware display name", () => {
- assert.match(composerSource, /composerProviderDisplayName\(candidate\)/);
- assert.match(composerSource, /composerProviderSearchText\(candidate\)/);
+ assert.match(composerSource, /providerDisplayName: providerDisplayName\(candidate\)/);
+ assert.match(composerSource, /providerSearchText: providerSearchText\(candidate\)/);
assert.match(composerSource, /aria-label=\{group\.providerDisplayName\}/);
assert.match(composerSource, /\{group\.providerDisplayName\}/);
});
diff --git a/apps/desktop/test/composer-models.test.mjs b/apps/desktop/test/composer-models.test.mjs
index 5055afbf4..7b1e56741 100644
--- a/apps/desktop/test/composer-models.test.mjs
+++ b/apps/desktop/test/composer-models.test.mjs
@@ -5,8 +5,6 @@ import {
composerModelBadges,
composerModelDisplayName,
composerModelMatchesQuery,
- composerProviderDisplayName,
- composerProviderSearchText,
composerModelsForProvider,
} from "../src/lib/composer-models.ts";
@@ -120,36 +118,6 @@ test("the selected label keeps its alias across equivalent model ids", () => {
);
});
-test("the Composer uses a vendor account label for its provider heading", () => {
- assert.equal(
- composerProviderDisplayName({
- name: "Anthropic",
- oauthAccountLabel: "Work account",
- }),
- "Work account",
- );
-});
-
-test("the Composer falls back to the provider name without an account label", () => {
- assert.equal(
- composerProviderDisplayName({
- name: "Anthropic",
- oauthAccountLabel: " ",
- }),
- "Anthropic",
- );
-});
-
-test("the Composer searches both the account label and vendor name", () => {
- assert.equal(
- composerProviderSearchText({
- name: "Anthropic",
- oauthAccountLabel: "Work account",
- }),
- "Work account Anthropic",
- );
-});
-
test("an exact binding alias wins over a broader equivalent id match", () => {
assert.equal(
composerModelDisplayName(
diff --git a/apps/desktop/test/provider-display-name.test.mjs b/apps/desktop/test/provider-display-name.test.mjs
new file mode 100644
index 000000000..7ec9fc6b7
--- /dev/null
+++ b/apps/desktop/test/provider-display-name.test.mjs
@@ -0,0 +1,124 @@
+/**
+ * Behavioural tests for the provider naming shared by every provider list.
+ *
+ * Two vendor accounts of one vendor carry the same `provider.name`; only the
+ * user's own `oauthAccountLabel` tells them apart (#785). The Composer already
+ * resolved its heading that way, while Settings read `provider.name` directly
+ * and rendered two identical rows, so these tests pin the one rule and pin the
+ * Settings pickers to it.
+ */
+import assert from "node:assert/strict";
+import { readFile } from "node:fs/promises";
+import test from "node:test";
+import {
+ providerDisplayName,
+ providerSearchText,
+} from "../src/lib/provider-display.ts";
+import { defaultModelOptions } from "../src/components/settings/default-model.ts";
+
+const read = (rel) => readFile(new URL(rel, import.meta.url), "utf8");
+
+const binding = (id) => ({
+ id,
+ contextWindow: 128_000,
+ maxTokens: 8_192,
+ thinkingLevels: [],
+ defaultThinkingLevel: null,
+});
+
+/** An OAuth row: the vendor name is shared, the account label is not. */
+const account = (id, oauthAccountLabel, modelId = "gpt-5.5") => ({
+ id,
+ name: "OpenAI",
+ vendorKey: "openai",
+ enabled: true,
+ hasSecret: true,
+ hasOauth: true,
+ authKind: "oauth",
+ oauthAccountLabel,
+ models: [binding(modelId)],
+});
+
+test("a vendor account label names the provider", () => {
+ assert.equal(
+ providerDisplayName({ name: "Anthropic", oauthAccountLabel: "Work account" }),
+ "Work account",
+ );
+});
+
+test("a provider without an account label keeps its vendor name", () => {
+ assert.equal(
+ providerDisplayName({ name: "Anthropic", oauthAccountLabel: " " }),
+ "Anthropic",
+ );
+ assert.equal(providerDisplayName({ name: "Anthropic" }), "Anthropic");
+});
+
+test("both the account label and the vendor name stay searchable", () => {
+ assert.equal(
+ providerSearchText({ name: "Anthropic", oauthAccountLabel: "Work account" }),
+ "Work account Anthropic",
+ );
+ // No label means no duplicated vendor name in the haystack.
+ assert.equal(providerSearchText({ name: "Anthropic" }), "Anthropic");
+});
+
+/*
+ This was the bug: the default picker expands both accounts into options, and
+ naming them by `provider.name` rendered the same heading twice with no way to
+ tell which account a default would be pinned to.
+*/
+test("two accounts of one vendor get distinct headings in the default picker", () => {
+ const options = defaultModelOptions([
+ account("p-work", "Work account"),
+ account("p-personal", "Personal account"),
+ ]);
+
+ assert.deepEqual(
+ options.map(({ provider }) => providerDisplayName(provider)),
+ ["Work account", "Personal account"],
+ );
+});
+
+test("the default picker's query reaches an account by its label", () => {
+ const options = defaultModelOptions([
+ account("p-work", "Work account"),
+ account("p-personal", "Personal account"),
+ ]);
+ // The haystack the pickers build, matched the way they match it.
+ const matches = (query) =>
+ options.filter(({ provider, modelId }) =>
+ `${providerSearchText(provider)} ${modelId}`.toLowerCase().includes(query),
+ );
+
+ assert.deepEqual(
+ matches("personal").map(({ provider }) => provider.id),
+ ["p-personal"],
+ );
+ // The vendor name still reaches every account of that vendor.
+ assert.equal(matches("openai").length, 2);
+ assert.equal(matches("gpt-5.5").length, 2);
+});
+
+test("the Settings model pickers name providers through the shared helper", async () => {
+ for (const rel of [
+ "../src/components/settings/ModelConfigPage.tsx",
+ "../src/components/settings/EnhancementModelCard.tsx",
+ ]) {
+ const source = await read(rel);
+ assert.match(source, /providerDisplayName\(provider\)/, rel);
+ assert.match(source, /aria-label=\{`\$\{providerDisplayName\(provider\)\} · \$\{modelId\}`\}/, rel);
+ assert.match(source, /`\$\{providerSearchText\(provider\)\} \$\{modelId\}`/, rel);
+ // The raw vendor name must not come back for a picker row or its query.
+ assert.doesNotMatch(source, /`\$\{provider\.name\} \$\{modelId\}`/, rel);
+ assert.doesNotMatch(source, /aria-label=\{`\$\{provider\.name\} · \$\{modelId\}`\}/, rel);
+ }
+});
+
+test("the Composer keeps resolving its heading through the same helper", async () => {
+ const source = await read(
+ "../src/features/chat/composer/hooks/useComposerModelMenu.ts",
+ );
+ assert.match(source, /providerDisplayName: providerDisplayName\(candidate\)/);
+ assert.match(source, /providerSearchText: providerSearchText\(candidate\)/);
+});
diff --git a/apps/desktop/test/settings-general.test.mjs b/apps/desktop/test/settings-general.test.mjs
index fdb0ca687..ca49b480a 100644
--- a/apps/desktop/test/settings-general.test.mjs
+++ b/apps/desktop/test/settings-general.test.mjs
@@ -258,7 +258,12 @@ test("default model selector shows every configured model under its provider", (
assert.match(defaultModelPicker, /setDefaultModel\(provider, modelId\)/);
assert.match(providersSource, /settings-text-action model-default-trigger/);
assert.doesNotMatch(providersSource, /defaultModelDescription/);
- assert.match(providersSource, /aria-label=\{`\$\{provider\.name\} · \$\{modelId\}`\}/);
+ // The accessible name follows the provider heading, which is the vendor
+ // account's own label when it has one (#785).
+ assert.match(
+ providersSource,
+ /aria-label=\{`\$\{providerDisplayName\(provider\)\} · \$\{modelId\}`\}/,
+ );
assert.match(providersSource, /placeholder=\{t\("settings\.defaultModelSearch"\)\}/);
assert.match(providersSource, /model-default-results/);
assert.match(stylesSource, /\.model-default-results\s*\{[\s\S]*?overflow-y: auto;/);
diff --git a/docs/spec/03-runtime/13-model-catalog-and-selection.md b/docs/spec/03-runtime/13-model-catalog-and-selection.md
index 9654e09be..f0d9a7b60 100644
--- a/docs/spec/03-runtime/13-model-catalog-and-selection.md
+++ b/docs/spec/03-runtime/13-model-catalog-and-selection.md
@@ -383,6 +383,13 @@ App-level default:
- the picker supports local search across provider name and model ID; its result list scrolls within the floating surface and shows an explicit empty state when no model matches
- the picker uses concise settings-specific search copy; each result gives visual priority to the model ID and keeps the provider as secondary metadata
- results are grouped by provider so a provider name is shown once per group rather than repeated on every model row
+- a provider is named the same way here as in the Composer menu: an OAuth row
+ uses its non-secret account label when present, so two accounts of one vendor
+ stay distinguishable in the group heading, in the summary line that reports
+ the current default, and in each option's accessible name. Search matches the
+ account label and the vendor name, so either spelling reaches the row
+- the Settings prompt-enhancement model picker reuses this menu and resolves its
+ provider names the same way
- if none configured, onboarding checklist requires provider setup before first agent run
Session-level:
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index e01aac822..be8f0490e 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -3550,8 +3550,12 @@ default nor provider configuration. OAuth accounts remain in their separate sect
groups model-level options by provider, marks the exact current entry, bounds
its own height so many configured models scroll instead of stretching the
card, flips above the trigger when there is no room below, and closes on
- Escape, an outside press, or the trigger scrolling out of view;
- global operating mode, command shell, and Enter-to-send live in the Settings
+ Escape, an outside press, or the trigger scrolling out of view.
+ A provider is named here the way the Composer model menu names it: an OAuth
+ row uses its non-secret account label when present, so two accounts of one
+ vendor do not collapse into identical group headings, summary lines, or
+ option names; the search matches the account label and the vendor name.
+ Global operating mode, command shell, and Enter-to-send live in the Settings
AI destination
2. **Vendor accounts** — section title + primary Add account action and one
single-level list panel using the same row surface as AI services; one row
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index f42874a85..62ae18b0d 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -7491,7 +7491,13 @@ identify the platform validation still needed.
be entered. Press Test connection and confirm the result resolves the edited
account. Open the Composer model menu and confirm the edited account label is
used as the OAuth provider group heading, while the configured model alias is
- shown on its model row. 5) Resolve
+ shown on its model row. With both Anthropic accounts configured, open the
+ Defaults picker and confirm the one provider name each group shows is that
+ account's own label, so the two accounts are not two identical `Anthropic`
+ groups, that the summary line above the Change action names the account
+ holding the current default, and that typing an account label filters to that
+ account's models while typing the vendor name still reaches both. Repeat the
+ same check on the Settings prompt-enhancement model picker. 5) Resolve
and use each account separately, including model discovery and one streamed
turn per account. 6) Start the device-code login on a second vendor, including
Meta/Muse when available, then press Cancel while the dialog is polling;