feat(tui): add Ctrl+R force-refresh to the model picker#3564
Merged
Conversation
Pressing Ctrl+R in the model picker bypasses the models.dev cache TTL, re-fetches the catalog, and reopens the picker with updated choices. Assisted-By: docker/docker-agent
Prevent picker stacking on ctrl+r, preserve the search query across refreshes, and avoid holding the store mutex during network I/O. Coalesce refreshes with a dedicated refreshMu, improve error handling for in-memory and not-modified edge cases, and add covering tests. Assisted-By: Claude (Anthropic)
aheritier
approved these changes
Jul 10, 2026
trungutt
approved these changes
Jul 10, 2026
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.
The
/modelpicker sources its list from models.dev, but that data is cached with a TTL — so newly added or changed models don't show up until the cache expires. There was no way for a user to force a fresh fetch without restarting the agent.Pressing
Ctrl+Rin the model picker now bypasses the cache, re-fetches the models.dev catalog (and any in-memory model data), and reopens the picker with the updated choices. The current search query is preserved across the refresh so the user lands back in a filtered view rather than a blank one. Refreshes are serialized via a dedicated mutex so that rapidCtrl+Rpresses don't stack concurrent fetches, and the store's read lock is never held during network I/O. Errors (including HTTP 304 not-modified and cache-still-valid cases) are handled gracefully and surfaced to the user rather than silently swallowed.Tests cover cache bypass, 304/not-modified and error paths, concurrent refresh coalescing, query preservation, and the
Ctrl+Rkey binding in the picker component.