Remember code review panel's selected repo per pane group (#10598)#10599
Conversation
…#10598) Multi-repo Agent sessions previously forgot the user's manual repository pick in the Code Review panel as soon as they navigated to another session and back: `CodeReviewState.selected_repo_path` lived only in memory on the single shared `RightPanelView`, so when `set_active_pane_group` switched pane groups and `set_available_repos` ran on the new repo list, the carried-over selection was cleared and the auto-select-first-repo logic took over. Persist the selection per pane group on the existing `WorkingDirectoriesModel` (which already keys other right-panel state by `pane_group_id`): - New `selected_review_repo: HashMap<EntityId, PathBuf>` plus `get_/set_/clear_selected_review_repo` accessors and matching no-op shims for the non-`local_fs` build. Cleared in `remove_pane_group` when a tab is closed. - `RightPanelView::set_active_pane_group` reads the saved selection for the incoming pane group and assigns it before calling `set_available_repos`, so the existing keep-or-fallback logic does the right thing for both known and unknown repos. - The `SelectRepo` action handler writes back to the model. Only explicit `SelectRepo` actions (dropdown picks and contextual opens) are persisted, so the auto-selected default never overwrites an earlier manual choice. Adds three regression tests in `working_directories_tests.rs` covering per-pane-group isolation, cleanup on `remove_pane_group`, and scoped `clear_selected_review_repo`. Co-Authored-By: Warp <agent@warp.dev> Co-authored-by: Cursor <cursoragent@cursor.com>
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I reviewed this pull request and requested human review from: Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds per-pane-group storage for the code review panel's manually selected repository and restores that saved selection when returning to a pane group. It also clears the saved value when a pane group is removed and adds focused model-level regression coverage.
Concerns
- No blocking concerns found in the annotated diff.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
kevinchevalier
left a comment
There was a problem hiding this comment.
This works great. Thank you for the contribution.
…10599) ## Description Closes #10598. In a multi-repo Agent session, switching the Code Review panel's repo via the dropdown was forgotten as soon as the user navigated to a different Agent session and came back — the panel snapped back to the default repo. This PR persists the selection per pane group so it survives leaving and returning to a session. ### Why `CodeReviewState.selected_repo_path` lived only in memory on the single shared `RightPanelView`. When `set_active_pane_group` switched pane groups, `set_available_repos` would clear the carried-over selection (because the old repo wasn't in the new pane group's repo list) and the auto-select-first-repo fallback took over. There was no per-pane-group persistence, so returning to a session always reset to the default repo. ### How Added per-pane-group persistence on the existing `WorkingDirectoriesModel`, which already keys other right-panel state (cached `CodeReviewView`s, focused repo, file tree views, etc.) by `pane_group_id`. - `app/src/pane_group/working_directories.rs` - New field `selected_review_repo: HashMap<EntityId, PathBuf>` on the `local_fs` model. - New methods `get_selected_review_repo`, `set_selected_review_repo`, `clear_selected_review_repo`, plus matching no-op shims for the non-`local_fs` build. - Cleared in `remove_pane_group` so closing a tab discards the saved value. - `app/src/workspace/view/right_panel.rs` - `set_active_pane_group` now reads both the available repos *and* the saved selection for the new pane group, then assigns ` state.selected_repo_path = saved_selection` before calling `set_available_repos`. The existing keep-or-fallback logic in `set_available_repos` then either restores the saved repo (when it's still present) or falls back to auto-selecting the first repo. - The `SelectRepo` action handler writes back to the model. Persistence happens **only** for explicit `SelectRepo` actions (dropdown picks and contextual opens) so the auto-selected default never overwrites an earlier manual choice. ## Linked Issue - [x] The linked issue is labeled \`ready-to-spec\` or \`ready-to-implement\`. - [x] Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes). Closes #10598 (a triaged bug, implicitly \`ready-to-implement\`). ## Testing Three regression tests added in \`app/src/pane_group/working_directories_tests.rs\`: 1. \`selected_review_repo_is_remembered_per_pane_group\` — selections in different pane groups are independent and overwriting one doesn't touch the other. 2. \`selected_review_repo_is_cleared_when_pane_group_is_removed\` — closing a tab clears its saved selection. 3. \`clear_selected_review_repo_removes_only_the_targeted_pane_group_entry\` — explicit clear is scoped. Local checks: - \`cargo nextest run -p warp -E 'test(selected_review_repo) | test(refresh_working_directories)'\` — 5 passed (3 new + 2 existing). - \`cargo fmt -- --check\` — clean. - \`cargo clippy -p warp --all-targets --tests -- -D warnings\` — clean. - [ ] I have manually tested my changes locally with \`./script/run\` ### Screenshots / Videos <img width="1280" height="800" alt="image" src="https://github.com/user-attachments/assets/d216cc94-76c1-43d0-81de-32a04ab3433b" /> <img width="1280" height="800" alt="image" src="https://github.com/user-attachments/assets/04c94078-1580-4312-88ce-adc34f234642" /> <img width="1280" height="800" alt="image" src="https://github.com/user-attachments/assets/f64538c6-4794-4058-88dd-1c0f0d48a442" /> <img width="1280" height="800" alt="image" src="https://github.com/user-attachments/assets/f31a4b70-8124-4a2f-a5a5-54ca95c028d7" /> ## Agent Mode - [ ] Warp Agent Mode - This PR was created via Warp's AI Agent Mode CHANGELOG-BUG-FIX: Code Review panel now remembers the manually-selected Git repository when leaving and returning to an Agent session in a multi-repo workspace. Made with [Cursor](https://cursor.com) Co-authored-by: Warp <agent@warp.dev> Co-authored-by: Cursor <cursoragent@cursor.com>
…10599) ## Description Closes #10598. In a multi-repo Agent session, switching the Code Review panel's repo via the dropdown was forgotten as soon as the user navigated to a different Agent session and came back — the panel snapped back to the default repo. This PR persists the selection per pane group so it survives leaving and returning to a session. ### Why `CodeReviewState.selected_repo_path` lived only in memory on the single shared `RightPanelView`. When `set_active_pane_group` switched pane groups, `set_available_repos` would clear the carried-over selection (because the old repo wasn't in the new pane group's repo list) and the auto-select-first-repo fallback took over. There was no per-pane-group persistence, so returning to a session always reset to the default repo. ### How Added per-pane-group persistence on the existing `WorkingDirectoriesModel`, which already keys other right-panel state (cached `CodeReviewView`s, focused repo, file tree views, etc.) by `pane_group_id`. - `app/src/pane_group/working_directories.rs` - New field `selected_review_repo: HashMap<EntityId, PathBuf>` on the `local_fs` model. - New methods `get_selected_review_repo`, `set_selected_review_repo`, `clear_selected_review_repo`, plus matching no-op shims for the non-`local_fs` build. - Cleared in `remove_pane_group` so closing a tab discards the saved value. - `app/src/workspace/view/right_panel.rs` - `set_active_pane_group` now reads both the available repos *and* the saved selection for the new pane group, then assigns ` state.selected_repo_path = saved_selection` before calling `set_available_repos`. The existing keep-or-fallback logic in `set_available_repos` then either restores the saved repo (when it's still present) or falls back to auto-selecting the first repo. - The `SelectRepo` action handler writes back to the model. Persistence happens **only** for explicit `SelectRepo` actions (dropdown picks and contextual opens) so the auto-selected default never overwrites an earlier manual choice. ## Linked Issue - [x] The linked issue is labeled \`ready-to-spec\` or \`ready-to-implement\`. - [x] Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes). Closes #10598 (a triaged bug, implicitly \`ready-to-implement\`). ## Testing Three regression tests added in \`app/src/pane_group/working_directories_tests.rs\`: 1. \`selected_review_repo_is_remembered_per_pane_group\` — selections in different pane groups are independent and overwriting one doesn't touch the other. 2. \`selected_review_repo_is_cleared_when_pane_group_is_removed\` — closing a tab clears its saved selection. 3. \`clear_selected_review_repo_removes_only_the_targeted_pane_group_entry\` — explicit clear is scoped. Local checks: - \`cargo nextest run -p warp -E 'test(selected_review_repo) | test(refresh_working_directories)'\` — 5 passed (3 new + 2 existing). - \`cargo fmt -- --check\` — clean. - \`cargo clippy -p warp --all-targets --tests -- -D warnings\` — clean. - [ ] I have manually tested my changes locally with \`./script/run\` ### Screenshots / Videos <img width="1280" height="800" alt="image" src="https://github.com/user-attachments/assets/d216cc94-76c1-43d0-81de-32a04ab3433b" /> <img width="1280" height="800" alt="image" src="https://github.com/user-attachments/assets/04c94078-1580-4312-88ce-adc34f234642" /> <img width="1280" height="800" alt="image" src="https://github.com/user-attachments/assets/f64538c6-4794-4058-88dd-1c0f0d48a442" /> <img width="1280" height="800" alt="image" src="https://github.com/user-attachments/assets/f31a4b70-8124-4a2f-a5a5-54ca95c028d7" /> ## Agent Mode - [ ] Warp Agent Mode - This PR was created via Warp's AI Agent Mode CHANGELOG-BUG-FIX: Code Review panel now remembers the manually-selected Git repository when leaving and returning to an Agent session in a multi-repo workspace. Made with [Cursor](https://cursor.com) Co-authored-by: Warp <agent@warp.dev> Co-authored-by: Cursor <cursoragent@cursor.com>
Description
Closes #10598.
In a multi-repo Agent session, switching the Code Review panel's repo via the dropdown was forgotten as soon as the user navigated to a different Agent session and came back — the panel snapped back to the default repo. This PR persists the selection per pane group so it survives leaving and returning to a session.
Why
CodeReviewState.selected_repo_pathlived only in memory on the single sharedRightPanelView. Whenset_active_pane_groupswitched pane groups,set_available_reposwould clear the carried-over selection (because the old repo wasn't in the new pane group's repo list) and the auto-select-first-repo fallback took over. There was no per-pane-group persistence, so returning to a session always reset to the default repo.How
Added per-pane-group persistence on the existing
WorkingDirectoriesModel, which already keys other right-panel state (cachedCodeReviewViews, focused repo, file tree views, etc.) bypane_group_id.app/src/pane_group/working_directories.rsselected_review_repo: HashMap<EntityId, PathBuf>on thelocal_fsmodel.get_selected_review_repo,set_selected_review_repo,clear_selected_review_repo, plus matching no-op shims for the non-local_fsbuild.remove_pane_groupso closing a tab discards the saved value.app/src/workspace/view/right_panel.rsset_active_pane_groupnow reads both the available repos and the saved selection for the new pane group, then assignsstate.selected_repo_path = saved_selectionbefore callingset_available_repos. The existing keep-or-fallback logic inset_available_reposthen either restores the saved repo (when it's still present) or falls back to auto-selecting the first repo.SelectRepoaction handler writes back to the model. Persistence happens only for explicitSelectRepoactions (dropdown picks and contextual opens) so the auto-selected default never overwrites an earlier manual choice.Linked Issue
Closes #10598 (a triaged bug, implicitly `ready-to-implement`).
Testing
Three regression tests added in `app/src/pane_group/working_directories_tests.rs`:
Local checks:
`cargo nextest run -p warp -E 'test(selected_review_repo) | test(refresh_working_directories)'` — 5 passed (3 new + 2 existing).
`cargo fmt -- --check` — clean.
`cargo clippy -p warp --all-targets --tests -- -D warnings` — clean.
I have manually tested my changes locally with `./script/run`
Screenshots / Videos
Agent Mode
CHANGELOG-BUG-FIX: Code Review panel now remembers the manually-selected Git repository when leaving and returning to an Agent session in a multi-repo workspace.
Made with Cursor