← Back to PRs

#11806: fix(ui): agent model dropdown not reflecting actual primary model

by arturhoo open 2026-02-08 10:37 View on GitHub →
app: web-ui stale
## Summary - Fix Lit rendering race condition where `<select .value=...>` fires before dynamically generated `<option>` children are in the DOM, causing the model dropdown to always show the first option instead of the configured primary model - Use `?selected` on individual `<option>` elements instead, matching the pattern already used in `sessions.ts` and `usage.ts` - Add test coverage for the agents model dropdown (`agents.test.ts`) ## Test plan - [x] All 4 new tests in `agents.test.ts` pass (configured primary selected, agent-specific override, inherit-default fallback, unlisted model shown as "Current") - [x] Full UI test suite passes (167/168 — 1 pre-existing failure in `navigation.browser.test.ts` unrelated to this change) - [x] Manual: open Agents page, confirm dropdown reflects actual primary model, not first option https://github.com/user-attachments/assets/24a4ed86-f239-4a07-bb22-95cf22c63807 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates the Agents “Primary model” dropdown rendering to avoid a Lit timing issue where setting `<select .value=…>` can run before dynamically generated `<option>` elements exist. It does this by moving selection logic onto each `<option>` via `?selected`, and adds a new `agents.test.ts` file with coverage for selecting the configured default, agent overrides, inheritance behavior, and handling an unlisted “current” model. The change is localized to the Agents view (`ui/src/ui/views/agents.ts`) and its new view-level tests (`ui/src/ui/views/agents.test.ts`). <h3>Confidence Score: 3/5</h3> - This PR is likely safe to merge after fixing a correctness issue in the “Inherit default” selection logic. - The core fix (moving selection to `?selected` on `<option>`) aligns with existing patterns and should address the reported Lit rendering race. However, the new logic makes the empty-value “Inherit default” option effectively unselectable/never-selected because `effectivePrimary` is always populated when a default exists, which changes UX semantics for non-default agents. Tests also appear a bit brittle in how they locate the dropdown. - ui/src/ui/views/agents.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs