Skip to content

Remember code review panel's selected repo per pane group (#10598)#10599

Merged
kevinchevalier merged 1 commit into
warpdotdev:masterfrom
wzc520pyfm:wzc520pyfm/add-remember-selected-git-for-cr-pane
May 12, 2026
Merged

Remember code review panel's selected repo per pane group (#10598)#10599
kevinchevalier merged 1 commit into
warpdotdev:masterfrom
wzc520pyfm:wzc520pyfm/add-remember-selected-git-for-cr-pane

Conversation

@wzc520pyfm
Copy link
Copy Markdown
Contributor

@wzc520pyfm wzc520pyfm commented May 10, 2026

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 CodeReviewViews, 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

  • The linked issue is labeled `ready-to-spec` or `ready-to-implement`.
  • 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

image image image image

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

…#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>
@cla-bot cla-bot Bot added the cla-signed label May 10, 2026
@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 10, 2026
@wzc520pyfm wzc520pyfm marked this pull request as ready for review May 10, 2026 13:35
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 10, 2026

@wzc520pyfm

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: @vkodithala.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

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

@oz-for-oss oz-for-oss Bot requested a review from vkodithala May 10, 2026 13:39
@vkodithala vkodithala requested review from kevinchevalier and removed request for vkodithala May 11, 2026 14:15
Copy link
Copy Markdown
Contributor

@kevinchevalier kevinchevalier left a comment

Choose a reason for hiding this comment

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

This works great. Thank you for the contribution.

@kevinchevalier kevinchevalier enabled auto-merge (squash) May 12, 2026 04:55
@kevinchevalier kevinchevalier merged commit f307223 into warpdotdev:master May 12, 2026
60 checks passed
cephalonaut pushed a commit that referenced this pull request May 12, 2026
…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>
dagmfactory pushed a commit that referenced this pull request May 12, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code review panel selected Git repository is not remembered after leaving and returning to an agent session

2 participants