Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,13 @@ func (s *UserSettings) Apply(req UpdateRequest) {
s.EnableTools = *req.EnableTools
}
if req.Preferences != nil {
s.Preferences = req.Preferences
// Merge preferences instead of replacing them
if s.Preferences == nil {
s.Preferences = DefaultPreferences()
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initializing with DefaultPreferences() when s.Preferences is nil may not be necessary here, since ensureDefaultPreferences() in the Service layer already handles merging defaults. Consider using an empty map instead (make(map[string]interface{})) to keep the Apply method focused solely on merging the request values without adding default initialization logic.

Suggested change
s.Preferences = DefaultPreferences()
s.Preferences = make(map[string]interface{})

Copilot uses AI. Check for mistakes.
}
for key, value := range req.Preferences {
s.Preferences[key] = value
}
}
Comment on lines 162 to 170
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces inconsistent behavior in the Apply method. All other fields (MemoryConfig, ProfileSettings, AdvancedSettings) use full replacement semantics when non-nil, but Preferences now uses merge semantics. This inconsistency could be confusing for API consumers. Consider documenting this behavior difference in the method's comment or making the behavior consistent across all fields.

Copilot uses AI. Check for mistakes.
}

Expand Down
Loading