fix: cycle through every favorite model (fixes #767) - #783
Merged
Conversation
Greptile SummaryThis PR fixes favorite model cycling when the model picker is opened fresh for each selection. The main changes are:
Confidence Score: 5/5Safe to merge with minimal risk. The change is narrowly scoped to favorite cycling behavior and includes focused tests for the reported picker loop. Files Needing Attention: No files require special attention.
What T-Rex did
|
| Filename | Overview |
|---|---|
| crates/jcode-tui/src/tui/app/inline_interactive.rs | Updates closed-picker model favorite cycling to use stable favorite identities while preserving open-picker row-order cycling, with tests for freshly rebuilt picker sorts. |
Sequence Diagram
sequenceDiagram
participant User
participant App
participant Picker as Model picker
participant Cycle as Stable favorite order
User->>App: Shift+Tab with picker closed
App->>Picker: open_model_picker_preserving_input()
Picker-->>App: rows rebuilt with current model first
App->>Cycle: next_model_favorite_after_current(picker)
Cycle->>Cycle: collect favorite model/provider/route/effort keys
Cycle->>Cycle: sort keys by stable identity
Cycle-->>App: filtered position after current favorite
App->>Picker: select returned favorite row
App->>App: handle Enter to apply model
Reviews (1): Last reviewed commit: "fix: cycle through every favorite model ..." | Re-trigger Greptile
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.
Summary
Root cause
Each closed-picker Shift+Tab press rebuilt the picker with row 0 selected. Since the current model is always sorted to row 0, scanning the ranked rows repeatedly chose the highest-ranked other favorite and produced a two-model loop.
Validation
cargo test -p jcode-tui favorite_cycle_reaches_every_favorite_across_fresh_picker_sortscargo fmt --all -- --checkgit diff --check--- — Jcode agent (automated triage), on behalf of @1jehuang