Repository navigation
fix(ui): select dropdowns show stale value on page load - #52948
xiaoquanidea wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b8fc364fd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Greptile SummaryThis PR fixes a well-documented Lit rendering timing issue where the
Confidence Score: 5/5
Reviews (1): Last reviewed commit: "fix(ui): agent model dropdown shows stal..." | Re-trigger Greptile |
|
Addressed in b3923ed: added an optional |
The `<select>` element in the agent overview panel uses Lit's `.value` property binding to set the active model. On initial render the binding fires before the child `<option>` elements are in the DOM, so the browser falls back to the first option (whichever model appears first in the catalog) instead of the configured primary model. Add `?selected` attribute binding to each `<option>` inside `buildModelOptions` so the correct option is marked at render time, independent of `.value` timing. Closes openclaw#40352 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Apply the same `?selected` attribute fix to the generic config form
`renderSelect` helper. The `<select>` in config-form.node.ts uses
Lit's `.value` property binding which can fire before child `<option>`
elements are in the DOM, causing the browser to fall back to the first
option ("Select...") instead of the configured value.
This affects all schema-driven enum selects in the config editor,
including the Model Provider API Adapter dropdown.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The previous commit marked the effectivePrimary option as selected in buildModelOptions, but for non-default agents the <select> binds to entryPrimary (empty when inheriting). This caused inherited agents to appear as if they had an explicit model override on page load. Add an optional `selected` parameter to buildModelOptions so the caller can pass the actual <select> value. For non-default agents without an override, no model option is preselected, preserving the "Inherit default" behaviour. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
ProjectClownfish pushed a narrow repair to this branch so the original contributor path can stay canonical. Source PR: #52948 |
b3923ed to
6a9b00a
Compare
|
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Keep this PR open. Current main still lacks the selected-option repair for both affected Control UI paths: the Agents primary model select still renders model options without selected state and the schema-driven config enum select still renders unset/enum options without selected state. The PR remains an active implementation candidate, with maintainer branch work and focused UI/test/changelog changes, while the related merged reload-state fix does not cover this page-load selected-option path. Best possible solution: Keep this PR open for maintainer review and landing, or land an equivalent patch on current main. The final fix should mark matching option elements selected for both the Agents primary model select and schema-driven enum selects, preserve inherited non-default agents on the inherit-default option, keep selectedOptions/value regression coverage, and then use the merged result to resolve the remaining #40352 page-load selected-option path if maintainers agree it covers it. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against a820a307dfeb. |




Summary
<select>dropdowns showing stale/wrong values on page load across the Control UI, caused by Lit's.valueproperty binding firing before child<option>elements are in the DOM.Affected Components
Agent model dropdown (
agents-utils.ts→buildModelOptions): The Primary model select in Agents → Overview always showed the first model in the catalog instead of the configured model after page refresh.Config form enum selects (
config-form.node.ts→renderSelect): All schema-driven enum dropdowns (e.g., Model Provider API Adapter) showed "Select..." instead of the configured value after page refresh.Root Cause
Both components use Lit's
.valueproperty binding on<select>elements. On initial render,.valuefires before the child<option>elements are in the DOM. The browser cannot find a matching option, so it falls back to the first option — regardless of what the actual configured value is.Fix
Add
?selectedattribute binding to each<option>so the correct option is marked directly in the HTML at render time, independent of.valueproperty timing.agents-utils.ts — Before:
After:
config-form.node.ts — Before:
After:
Testing
vitest run ui/src/ui/views/agents-utils.test.ts— 11/11 tests passAI Disclosure
🤖 This PR was AI-assisted (Claude Code). I understand the changes and have verified them locally.
Closes #40352