Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Jan 3, 2026

Summary

Fixes several issues in the Settings → Models UI:

  1. Custom model persistence bug - Adding a custom model would "flash" then disappear. Root cause: updateModelsOptimistically returned stale data because it computed the new models array inside a React state updater (async) but returned immediately. Fixed by using a synchronous configRef to compute and return values reliably.

  2. Model dropdown scrolling - Replaced cmdk-based implementation with custom command component for reliable scrolling behavior in model selectors.

  3. Popover overflow - Fixed popover overflow issues preventing proper scrolling in dropdowns.

Changes

  • src/browser/hooks/useProvidersConfig.ts: Added configRef for synchronous access to config state; prevents stale returns from optimistic update helpers
  • src/browser/components/ui/command.tsx: Custom command implementation replacing cmdk
  • src/browser/components/ui/popover.tsx: Added modal prop, fixed overflow styles
  • tests/ui/customModels.integration.test.ts: Integration test reproducing the custom model persistence bug

Testing

  • Added integration test that validates updateModelsOptimistically returns correct data for immediate persistence
  • Manual testing of custom model add/remove in Settings → Models

Generated with mux • Model: anthropic:claude-opus-4-5 • Thinking: medium • Cost: $37.78

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05c1031a7c

ℹ️ 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".

@ammar-agent ammar-agent force-pushed the model-settings-zzqp branch 12 times, most recently from 733d9a5 to 27f51cc Compare January 10, 2026 02:45
Add a Model Defaults section with searchable dropdowns for:
- Default Model: model used for new workspaces
- Compaction Model: model used for /compact (falls back to workspace model)

Show a subtle 'configure' link during compaction (when no custom model is set)
that opens Settings → Models.

Add story to capture the configure hint state.
…down

- Move model row tooltip trigger from entire row to dedicated Info icon
- Replace custom SearchableModelSelect with cmdk-based combobox for proper
  keyboard navigation (arrow keys, type-to-filter, scrolling)
- Restyle Model Defaults section to match table aesthetic with header row
  and horizontal label/dropdown layout
- Restyle Add Model form with consistent header styling and backgrounds
- Add overflow-visible to PopoverContent to prevent clipping
- Use flex layout with max-h on Command container
- Make Command.List flex-1 with overflow-y-auto for scrolling
cmdk's scrolling behavior was unreliable. Replace with a custom
implementation that:
- Uses native div with overflow-y-auto for reliable scrolling
- Implements arrow key navigation with highlighted index tracking
- Auto-scrolls highlighted items into view
- Supports type-to-filter with search input
- Tracks mouse hover for highlight updates
The overflow-hidden constraint was preventing child elements from
scrolling. Removed it along with max-h constraint from base styles
so individual popovers can control their own overflow behavior.
- Added modal prop to Popover for proper focus trapping in dialog context
- Added explicit max-h to PopoverContent as backup constraint
Add a version counter to useProvidersConfig that tracks fetch requests.
When an optimistic update occurs, the counter is incremented to invalidate
any in-flight fetches. This prevents race conditions where a slow initial
fetch response would overwrite an optimistic update with stale data.

Also adds a UI test for the custom model addition flow (though it has
known limitations with Radix Dialog portals in happy-dom).
@ammar-agent ammar-agent changed the title 🤖 feat: compaction fallback models and model info in Settings 🤖 fix: model settings improvements and custom model persistence Jan 11, 2026
@ammario ammario merged commit 831fa78 into main Jan 11, 2026
21 checks passed
@ammario ammario deleted the model-settings-zzqp branch January 11, 2026 01:31
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.

2 participants