[bug] Settings POST endpoint silently drops keys not in DEFAULT_SETTINGS — non-default prefs lost on save #921
Labels
No labels
area:chat
area:core
area:llm
area:routes
area:tools
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sleepy/odysseus#921
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
When the Settings UI saves via
POST /api/auth/settings, the handler atroutes/settings_routes.py:60-69only writes back keys that exist inDEFAULT_SETTINGS:Keys that were added to
settings.jsonby other code paths (tool manager, email routes, skill routes, etc.) but are NOT inDEFAULT_SETTINGSget silently dropped on every save cycle. This includes:disabled_toolsemail_auto_summarize,email_auto_reply,email_auto_tag,email_auto_spam,email_auto_calendaremail_writing_styleDEFAULT_SETTINGSMeanwhile,
load_settings()does{**DEFAULT_SETTINGS, **saved}which DOES preserve extras in the file. The bug only triggers when the Settings UI does a save — it rewrites the file with onlyDEFAULT_SETTINGSkeys, nuking everything else.Root Cause
The
set_settingsPOST handler iterates overDEFAULT_SETTINGSkeys instead of merging the body into the current settings. It should write back ALL existing keys plus any new ones from the body.Fix
This lets the frontend send partial updates (only changed fields) while preserving all existing keys. Should also validate that unknown keys are allowed (or at least log a warning).
Reproduction
email_writing_stylevia chat tool (manage_settings set email_writing_style=...)email_writing_styleis gone fromdata/settings.jsonImpact
This is the likely cause of reported symptoms: teacher model settings, default chat model, and other non-DEFAULT_SETTINGS keys not surviving across restarts — they survive the restart itself (load_settings merges fine), but get wiped the next time the Settings panel saves.
Fixed in PR #928 — merged to dev via --no-ff. Root cause: PUT /settings iterated over DEFAULT_SETTINGS keys instead of body keys, so any setting not in the defaults was silently dropped. Fix: iterate body keys, guard with
if key in currentto prevent arbitrary key injection.