← Back to PRs

#14550: fix(ui): save button dead after model change on single-agent setups (#13338)

by yinghaosang open 2026-02-12 08:42 View on GitHub →
app: web-ui stale size: S
## Summary Save button doesn't enable when you change the model or fallbacks on the Dashboard's Agents → Overview page. The handler bails early if the agent isn't in `agents.list`, which is the default for single-agent setups. Added `ensureAgentListEntry()` that auto-creates a minimal `{ id: agentId }` entry in `agents.list` before the model update runs, so `updateConfigFormValue` succeeds and the form gets marked dirty. Closes #13338 lobster-biscuit ## Repro Steps 1. Fresh install with default config (no `agents.list` in config) 2. Open Dashboard → Agents → main → Overview 3. Change Primary model dropdown to any other model 4. Save button stays disabled — no save call is made ## Root Cause `onModelChange` in `ui/src/ui/app-render.ts` reads `configValue.agents?.list` from the config form. Single-agent setups don't populate that array (model lives in `agents.defaults.model`), so `Array.isArray(list)` returns false and the handler returns early. `configFormDirty` never flips, Save stays disabled. Same pattern in `onModelFallbacksChange`. ## Changes - Before: changing model/fallbacks for agents not in `agents.list` does nothing; Save button stays disabled - After: `ensureAgentListEntry()` creates the list entry on demand, `updateConfigFormValue` goes through, Save enables ## Note on env vars (also mentioned in #13338) The original issue also mentions env vars can't be edited via Dashboard. I checked the code — env vars editing goes through the generic config form path (`onFormPatch` → `updateConfigFormValue` on the `env` key), not through the `agents.list` lookup. So it's a different code path and not affected by this fix. That part may need a separate investigation or may already be resolved in a newer version. ## Tests - `ui/src/ui/app-render.ensure-agent-list.node.test.ts` — 5 tests covering null config, missing agents.list, missing agent entry, existing entry, and agents object without list array - `pnpm build` and `pnpm check` pass - All UI node tests (4 files, 40 tests) pass

Most Similar PRs