Conversation
LoadConfig wraps parse/read errors with the exact config.json path and flags the returned fallback as Degraded; SaveConfig refuses to persist a degraded config so runtime toggles can no longer replace the user's hand-edited file with defaults.
A config.json that fails to load now shows 'config error: <path>: <cause>' in the status bar at startup instead of vanishing into stderr.
The 'No models configured' empty state hardcoded ~/.config/late, which is wrong on macOS; the path now comes from pathutil.LateConfigDir().
Closed
5 tasks
Owner
|
@Emasoft One change needed: From reading the code the warning is presumably instantly replaced by the runBootstrap message likely causing some kind of flicker. Please make sure users have a chance to read it. Will be merged afterwards. |
The two silent _ = config.SaveConfig(...) calls — the theme picker's enter path and the /themes <name> inline path — swallowed the degraded-refusal error: when config.json existed but could not be read or parsed, LoadConfig marks the fallback config Degraded and SaveConfig refuses to overwrite the user's hand-edited file, so the chosen theme silently failed to survive a restart. Surface it: when SaveConfig returns an error the focused agent's status line shows "settings changed but won't persist: <err>"; the theme still applies for the session (its toast is unchanged), and healthy configs persist exactly as before with no status text. The model picker's save site already reported failures through m.Err and is untouched. Tests: a degraded config constructed via config.LoadConfig over a malformed config.json (and one flagged Degraded directly) drives both sites and asserts the warning, SaveConfig's refusal reason, and that the broken file survives; a non-degraded config asserts no warning and that the theme really persisted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update
Theme-persistence
SaveConfigrefusals are no longer silently swallowed (45417ca): both_ = config.SaveConfig(...)sites now surface the refusal on the focused agent's status line assettings changed but won't persist: <reason>. Previously, a degraded config (aconfig.jsonthat exists but cannot be read or parsed, soLoadConfigreturns flagged defaults andSaveConfigrefuses to overwrite the hand-edited file) made the chosen theme silently fail to survive a restart. The theme still applies for the session, and healthy configs persist exactly as before, with no status text. Tests added: a degraded config drives both sites and asserts the warning, the refusal reason, and that the broken file survives; a non-degraded config asserts no warning and that the theme really persisted (internal/tui/config_persist_feedback_test.go).Honest scope correction: this branch has no
/infobaror/timestamps(those live in other PRs) — the two persistence sites here are the theme picker and/themes.Any config.json parse error silently swapped the user's config for the defaults — and a later runtime toggle (theme, model pick, anything that persists) would then write those defaults straight over the hand-edited file. This makes the failure visible and the file safe.
LoadConfigwraps every read/parse error with the exact config path and sets aDegradedflag on the returned defaults, so "fresh install" is distinguishable from "your config is broken".SaveConfigrefuses to persist a degraded config — defaults can never overwrite the hand-edited file.config error: <path>: <cause>.~/Library/Application Support/lateon macOS) instead of a hardcoded Unix path.Small and self-contained: no behavior change for valid configs.
Split out of #133 so each change can be evaluated separately (per review).
Testing
exit 0 — all 18 packages green (15 ok, 3 without test files).
gofmt -lon the touched files: no output (clean)go vet ./cmd/late ./internal/config ./internal/tui: cleaninternal/config/config_test.go), bootstrapconfig error:warning (cmd/late/bootstrap_test.go), model-picker real path (internal/tui/model_picker_test.go)