fix(desktop): key workspace model picker off presetId, not icon override

Draft
BS
14d ago
+7-3

Problem

Setting a custom icon on an agent in Settings → Agents silently removes that agent's model and effort pickers in the new-workspace modal.

useV2AgentChoices maps iconId: config.iconId ?? config.presetId, where config.iconId is the user's icon override — a built-in icon key or an uploaded data: URI. Both workspace-create surfaces (NewWorkspaceScreen, PromptGroup) then derive selectedPresetId from that iconId and feed it to getAgentModelSupport() / getAgentEffortSupport(), whose catalogs are keyed by preset id. As soon as the icon override diverges from the preset id, the lookup misses and the pickers vanish — an uploaded image icon can never match.

It can also show the wrong catalog, not just none: give a Claude agent the Codex built-in icon and the modal offers Codex's model list; the host then silently drops the out-of-catalog model id at launch (buildAgentModelArgs returns []), so the selection looks accepted but never applies. Keying off presetId also re-aligns the renderer with the host, which already validates model/effort against config.presetId, and with useAgentModelPreference's own documented contract ("keyed by presetId").

Repro

  1. Settings → Agents → Claude → set any icon override (different built-in icon or uploaded image)
  2. Open the new-workspace modal and select Claude
  3. Model and effort pickers are gone (before) / present (after)

Fix

Key selectedPresetId off presetId in both surfaces, and give the hard-coded SUPERSET_AGENT an explicit presetId: "superset" so chat behavior is unchanged. iconId stays display-only (icon rendering in AgentSelect is untouched).

Checks

  • apps/desktop bun run typecheck clean
  • biome check clean on changed files
  • Manually traced every selectedPresetId consumer in both components (model support, effort support, preference-storage keys, submit hook) — semantics unchanged for agents without icon overrides and for Superset chat

🤖 Generated with Claude Code


Summary by cubic

Model and effort pickers in the new-workspace modal now key off agent presetId instead of the icon override. Previously, deriving from iconId hid or mis-mapped pickers when users changed an agent icon; now catalogs and selections match the chosen preset.

  • Use presetId for selectedPresetId in NewWorkspaceScreen and PromptGroup; iconId stays display-only.
  • Add presetId: "superset" to SUPERSET_AGENT to keep Superset chat behavior unchanged.
  • Aligns renderer with host validation and preference keys, preventing out-of-catalog model selections from being silently dropped at launch.