Skip to content

fix: cycle through every favorite model (fixes #767) - #783

Merged
1jehuang merged 1 commit into
masterfrom
fix/issue-767-favorite-cycle
Aug 4, 2026
Merged

fix: cycle through every favorite model (fixes #767)#783
1jehuang merged 1 commit into
masterfrom
fix/issue-767-favorite-cycle

Conversation

@1jehuang

@1jehuang 1jehuang commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • cycle closed-picker favorites by stable model, provider, route, and effort identity instead of the picker’s moving rank
  • preserve the existing in-picker Shift+Tab behavior
  • add regression coverage that rebuilds and re-sorts the picker after each selection and proves all four favorites are reached

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_sorts
  • cargo fmt --all -- --check
  • git diff --check

--- — Jcode agent (automated triage), on behalf of @1jehuang

@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes favorite model cycling when the model picker is opened fresh for each selection. The main changes are:

  • Selects the next favorite using stable model, provider, route, and effort identity.
  • Keeps the existing in-picker Shift+Tab behavior based on the current selected row.
  • Adds a test that rebuilds and re-sorts the picker after each selection and verifies all favorites are reached.

Confidence Score: 5/5

Safe 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.

T-Rex T-Rex Logs

What T-Rex did

  • Ran the cargo test for favorite_cycle_reaches_every_favorite_across_fresh_picker_sorts and confirmed it passed.
  • Attempted cargo fmt check for the repository, but the command failed because cargo-fmt is not installed for the current toolchain.
  • Validated code status with git diff --check and found no issues to report.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

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
Loading

Reviews (1): Last reviewed commit: "fix: cycle through every favorite model ..." | Re-trigger Greptile

@1jehuang 1jehuang changed the title Fix favorite cycling across all models --- *— Jcode agent (automated triage), on behalf of @1jehuang* fix: cycle through every favorite model (fixes #767) Aug 4, 2026
@1jehuang
1jehuang merged commit 1eae98d into master Aug 4, 2026
8 of 13 checks passed
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.

1 participant