Skip to content

Profiles: Stop saving model defaults from untouched settings - #939

Closed
tobocop2 wants to merge 5 commits into
mainfrom
fix/settings-tab-model-defaults
Closed

tobocop2 wants to merge 5 commits into
mainfrom
fix/settings-tab-model-defaults

Conversation

@tobocop2

@tobocop2 tobocop2 commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Problem

The Generation settings tab shows the chat model's own defaults, such as a temperature of 0.7. Moving focus out of a field compared the shown text with the stored config value, which is empty for a setting that defers to the model. The two never matched, so tabbing through the tab wrote every model default into config.toml as if the user had set it.

Solution

A field now saves on blur only when its text differs from what it showed when the tab was drawn. That snapshot refreshes when a setting is reset or saved. The same rule now covers list fields, which rewrote their value on every blur, and dropdowns. Typing a new value and leaving the field still saves it.

A test tabs through the Generation tab without typing and asserts that config.toml is unchanged. It fails on main.

@tobocop2
tobocop2 added this pull request to stack #942 September 27, 2026 06:18
@tobocop2
tobocop2 marked this pull request as ready for review September 27, 2026 14:38
@tobocop2 tobocop2 changed the title Stop saving model defaults from untouched settings Profiles: Stop saving model defaults from untouched settings Sep 27, 2026
Blur compared the input text to cfg's stored value, which is None
for a field deferring to the chat model's own default. The default's
text (temperature's "0.7") never equals "None", so tabbing past an
untouched field wrote it into config.toml as a user value.

Track what each Input and multi-line editor showed when the row was
built (or last reset), and blur saves only when the text differs
from that instead of from cfg.
No writable multi-line setting is nullable with a model default
today, so make_multiline_editor's new marker strip has nothing live
to drive it red or green through the UI. Call it directly instead.
Set the mount-display baseline only after a persist succeeds, not
before attempting it, so an invalid value never poisons the
baseline; a second identical invalid blur still notifies.

Extract the " (model default)" marker into one constant with a
strip helper, used by the producer and both strippers.

List-typed and Select-backed settings now go through the same
mount-baseline compare-before-save rule as scalar editors: a list's
baseline comes from its cfg value at construction, and a Select's
baseline from the matching choice rather than the widget's value
reactive, which is not populated from the constructor argument
until the widget mounts. Reading it earlier saw the pre-mount
default and made every Select-backed setting look edited on its
first render.

Checkbox saves stay unconditional; Checkbox.Changed only fires on a
user toggle.
Restore already loads the default text and persists it; add a test
that blurring the field right after, unedited, does not persist
again. It first edits the field so its baseline diverges from the
default, so a restore that forgot to refresh the baseline would
still show as a change on the next blur.
The test pressed Tab once for each of the 68 focusable widgets on the
Generation tab, and every settled focus change rebuilds the footer and
restyles the settings screen. That took 22 to 29 seconds on macOS and
more than 60 on the Windows runner, where pytest-timeout ends the xdist
worker with os._exit, which xdist reports as a crashed node.

Only an Input or a ListTextArea saves on blur, so the test now moves
focus through those editors alone, in one batch, and lets it settle
once on a reset button. It still fails when the input blur handler
compares against the stored config value instead of the shown text.
@tobocop2

tobocop2 commented Oct 3, 2026

Copy link
Copy Markdown
Owner Author

This change is now part of #1003, which collects every Profiles pull request on one branch. Review and merge happen there. The branch stays in place.

@tobocop2 tobocop2 closed this Oct 3, 2026
@tobocop2
tobocop2 deleted the fix/settings-tab-model-defaults branch November 1, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant