Skip to content

Support child repositories in code review panel#10249

Open
easoll wants to merge 1 commit intowarpdotdev:masterfrom
easoll:support-child-repos-code-review
Open

Support child repositories in code review panel#10249
easoll wants to merge 1 commit intowarpdotdev:masterfrom
easoll:support-child-repos-code-review

Conversation

@easoll
Copy link
Copy Markdown

@easoll easoll commented May 6, 2026

Summary

  • Detect direct child git repositories when a terminal CWD is not itself inside a repository.
  • Include detected child repositories in the pane group repository list so the Code Review panel can select them from a non-repo parent directory.
  • Fall back to the selected or first known repository when opening Code Review from a non-repo terminal CWD.
  • Keep repository selection and review terminal routing deterministic when parent directories contain multiple child repositories.
  • Omit deleted child repositories from cached Code Review repository lists.

Visual evidence

The active terminal CWD is ~/workspace/tmp, which is not itself a git repository. The Code Review panel opens from that parent directory, the repository selector lists detected child repositories, and selecting warp-git-repo-1 renders its uncommitted diff.

Code Review panel listing child repositories from a non-repo parent directory

Tests

  • cargo fmt --all -- --check
  • git diff --check
  • PATH="/tmp/warp-fake-bin:$PATH" cargo test -p repo_metadata repositories::tests --features local_fs
  • PATH="/tmp/warp-fake-bin:$PATH" cargo test -p warp refresh_working_directories --features local_fs
  • PATH="/tmp/warp-fake-bin:$PATH" cargo test -p warp workspace::view::right_panel::tests --features local_fs

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 6, 2026

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: xiongyiming.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 6, 2026

@easoll

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

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

Powered by Oz

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 6, 2026
@easoll easoll force-pushed the support-child-repos-code-review branch from 1a21c6a to bdf1844 Compare May 6, 2026 08:57
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 6, 2026

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @easoll on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment @cla-bot check to trigger another check.

oz-for-oss[bot]
oz-for-oss Bot previously requested changes May 6, 2026
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 detection of direct child git repositories from non-repo terminal directories and wires those detected repos into the Code Review panel repository list and open-panel fallback path.

Concerns

  • Parent directories are permanently marked as scanned before the async child scan has succeeded or any children were found, so repositories created later under that same workspace are never discovered from the parent CWD.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

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

Powered by Oz

let local_path_for_search = path.to_local_path();
let should_detect_child_repos =
matches!(source, RepoDetectionSource::TerminalNavigation)
&& self.child_repo_scan_roots.insert(path.clone());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] Caching the parent before the async scan completes makes this a one-shot scan. If Warp starts in an empty workspace or a git clone creates a child repo after the first metadata update, later RepoChanged events still call detect_possible_git_repo for the same path but insert returns false, so the new child repo is never discovered from the parent CWD. Only mark the path after a successful scan that found children, or add an invalidation/rescan path for terminal navigation.

@easoll
Copy link
Copy Markdown
Author

easoll commented May 6, 2026

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label May 6, 2026
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 6, 2026

The cla-bot has been summoned, and re-checked this pull request!

@easoll easoll force-pushed the support-child-repos-code-review branch from bdf1844 to 7f57108 Compare May 6, 2026 09:12
@easoll
Copy link
Copy Markdown
Author

easoll commented May 6, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 6, 2026

@easoll

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

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[bot]
oz-for-oss Bot previously requested changes May 6, 2026
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 detection of direct child repositories below a non-repository terminal CWD and falls back to known repository state when opening Code Review from that parent directory.

Concerns

  • The new terminal-to-repository mapping can associate multiple child repositories with the same focused terminal, but the existing focused-repository derivation picks from that map by iteration order. This can make the selected/focused repository nondeterministic when a parent directory contains more than one repository.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

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

Powered by Oz


if self.get_repo_root_for_path(&root_path, ctx).is_none() {
for repo_root in self.get_descendant_repo_roots_for_path(&root_path, ctx) {
new_root_to_terminal.insert(repo_root, *terminal_id);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] Adding every child repo to new_root_to_terminal with the same focused terminal makes the later focused-terminal pass treat all child repos as focused; because this map is a HashMap, focused_repo becomes whichever child repo iterates last. Derive the focused repo from the actual CWD/selected repo, or keep these fallback mappings out of focused repo selection, so the Code Review selector does not jump nondeterministically when the parent contains multiple repos.

@easoll easoll force-pushed the support-child-repos-code-review branch from 7f57108 to 1f06244 Compare May 6, 2026 09:26
@easoll
Copy link
Copy Markdown
Author

easoll commented May 6, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 6, 2026

@easoll

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

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[bot]
oz-for-oss Bot previously requested changes May 6, 2026
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 direct child repository detection for non-repo terminal directories and wires those detected repositories into the Code Review panel selection flow.

Concerns

  • The new fallback terminal mapping is not honored by the existing review terminal availability check, so opening Code Review from a non-repo parent can still leave review submission unavailable for the selected child repo.
  • For faster review, please upload screenshots or a video of the Code Review panel working end to end from a non-repo parent directory.

Verdict

Found: 0 critical, 1 important, 1 suggestions

Request changes

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

Powered by Oz


if self.get_repo_root_for_path(&root_path, ctx).is_none() {
for repo_root in self.get_descendant_repo_roots_for_path(&root_path, ctx) {
new_root_to_terminal.insert(repo_root, *terminal_id);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] This maps a child repo to the terminal whose CWD is the non-repo parent, but RightPanelView::review_terminal_status still requires the terminal CWD to be inside repo_path, so the mapped fallback terminal is rejected and review submission remains unavailable from the parent directory.

@easoll easoll force-pushed the support-child-repos-code-review branch from 1f06244 to 5ebfe71 Compare May 6, 2026 09:41
@easoll
Copy link
Copy Markdown
Author

easoll commented May 6, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 6, 2026

@easoll

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

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

Powered by Oz

@easoll
Copy link
Copy Markdown
Author

easoll commented May 6, 2026

Addressed the latest Oz concern about review terminal availability.

The selected repo -> terminal mapping is now honored when computing review terminal status: a repo-mapped terminal can be rooted at a non-repo parent directory, while unmapped terminals still have to be inside the selected repo. This keeps the fallback terminal route working for child repos discovered from a parent CWD without loosening availability for unrelated terminals.

Added tests:

  • workspace::view::right_panel::tests::review_path_allows_mapped_terminal_outside_selected_repo
  • workspace::view::right_panel::tests::review_path_rejects_unmapped_terminal_outside_selected_repo

Also reran the existing targeted coverage:

  • cargo test -p warp workspace::view::right_panel::tests --features local_fs
  • cargo test -p warp refresh_working_directories --features local_fs
  • cargo test -p repo_metadata repositories::tests --features local_fs

oz-for-oss[bot]
oz-for-oss Bot previously requested changes May 6, 2026
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 detection of child repositories under a non-repo terminal CWD and wires those repositories into Code Review panel fallback selection and terminal routing.

Concerns

  • The descendant fallback terminal mapping can overwrite an existing mapping for a terminal that is actually inside the selected repo, so Code Review may prefer the non-repo parent terminal even when a repo-local terminal is available.
  • For faster review, please upload screenshots or a video of the feature working end to end.

Verdict

Found: 0 critical, 2 important, 0 suggestions

Request changes

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

Powered by Oz


if self.get_repo_root_for_path(&root_path, ctx).is_none() {
for repo_root in self.get_descendant_repo_roots_for_path(&root_path, ctx) {
new_root_to_terminal.insert(repo_root, *terminal_id);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] This fallback mapping can overwrite a terminal that is actually inside repo_root when the parent terminal is processed later, causing Code Review to route comments to the non-repo parent instead of the repo terminal; keep existing repo mappings when inserting descendant fallbacks.

Suggested change
new_root_to_terminal.insert(repo_root, *terminal_id);
new_root_to_terminal.entry(repo_root).or_insert(*terminal_id);

@easoll easoll force-pushed the support-child-repos-code-review branch from 5ebfe71 to f24fc74 Compare May 6, 2026 10:03
@easoll
Copy link
Copy Markdown
Author

easoll commented May 6, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 6, 2026

@easoll

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

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

Powered by Oz

@easoll
Copy link
Copy Markdown
Author

easoll commented May 6, 2026

Addressed the latest Oz concern about descendant fallback mappings overwriting repo-local terminals.

The fallback insertion now preserves any existing repo mapping:

This means a terminal whose CWD is actually inside the selected repo remains preferred, while the non-repo parent terminal is only used as a fallback when no repo-local terminal mapping exists.

Added regression coverage:

  • pane_group::working_directories::tests::refresh_working_directories_keeps_repo_terminal_mapping_over_parent_fallback

Reran targeted coverage:

  • cargo fmt --all -- --check
  • git diff --check
  • cargo test -p warp refresh_working_directories --features local_fs
  • cargo test -p warp workspace::view::right_panel::tests --features local_fs
  • cargo test -p repo_metadata repositories::tests --features local_fs

@easoll
Copy link
Copy Markdown
Author

easoll commented May 6, 2026

Addressed the latest Oz concern about descendant fallback mappings overwriting repo-local terminals.

The fallback insertion now preserves any existing repo mapping:

new_root_to_terminal
    .entry(repo_root)
    .or_insert(*terminal_id);

This means a terminal whose CWD is actually inside the selected repo remains preferred, while the non-repo parent terminal is only used as a fallback when no repo-local terminal mapping exists.

Added regression coverage:

  • pane_group::working_directories::tests::refresh_working_directories_keeps_repo_terminal_mapping_over_parent_fallback

Reran targeted coverage:

  • cargo fmt --all -- --check
  • git diff --check
  • cargo test -p warp refresh_working_directories --features local_fs
  • cargo test -p warp workspace::view::right_panel::tests --features local_fs
  • cargo test -p repo_metadata repositories::tests --features local_fs

oz-for-oss[bot]
oz-for-oss Bot previously requested changes May 6, 2026
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 direct child repository detection for non-repo terminal directories and routes the Code Review panel to detected or selected repositories when the active terminal CWD is outside a repo.

Concerns

  • For faster review, please upload screenshots or a video of the Code Review panel working end to end from a non-repo parent directory, including selecting a detected child repository. The repository guidance requires visual evidence for user-visible behavior changes.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

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

Powered by Oz

@easoll easoll force-pushed the support-child-repos-code-review branch from f24fc74 to 8908555 Compare May 6, 2026 11:16
@easoll
Copy link
Copy Markdown
Author

easoll commented May 6, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 6, 2026

@easoll

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

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

Powered by Oz

@easoll
Copy link
Copy Markdown
Author

easoll commented May 6, 2026

Addressed a stale repository dropdown issue found during manual validation: deleted child repositories could remain visible in the Code Review repo selector because detected descendant repo roots and RightPanel repo state were cached.

Changes:

  • DetectedRepositories::get_descendant_roots_for_path now omits cached descendant roots whose paths no longer exist.
  • WorkingDirectoriesModel::most_recent_repositories_for_pane_group filters unavailable repo paths before exposing them to the UI.
  • CodeReviewState::set_available_repos filters unavailable repo paths before updating the dropdown state.
  • RightPanelView::selected_repo_path ignores a selected repo path once it no longer exists.

Added regression coverage:

  • repositories::tests::test_get_descendant_roots_for_path_omits_deleted_repos
  • pane_group::working_directories::tests::refresh_working_directories_omits_deleted_repos_under_non_repo_parent

Reran targeted coverage:

  • cargo fmt --all -- --check
  • git diff --check
  • cargo test -p repo_metadata repositories::tests --features local_fs
  • cargo test -p warp refresh_working_directories --features local_fs
  • cargo test -p warp workspace::view::right_panel::tests --features local_fs

@easoll
Copy link
Copy Markdown
Author

easoll commented May 6, 2026

Visual evidence for the Code Review panel flow from a non-repo parent directory:

  • Active terminal CWD is ~/workspace/tmp, which is not itself a git repository.
  • Code Review is open from that parent directory.
  • The repository selector lists detected child repositories: warp-git-repo-1 and warp-git-repo-2.
  • warp-git-repo-1 is selected and its uncommitted diff is rendered in the Code Review panel.

codex-clipboard-tsx0Mg.png

@easoll
Copy link
Copy Markdown
Author

easoll commented May 6, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 6, 2026

@easoll

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

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[bot]
oz-for-oss Bot previously requested changes May 6, 2026
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 detection of direct child Git repositories from a non-repo terminal CWD and wires those repositories into the Code Review panel fallback/terminal-selection path.

Concerns

  • The change affects user-visible Code Review panel behavior, but the PR description does not include screenshots or a video showing the selection and review-routing flow from a non-repo parent directory. For faster review, please upload screenshots or a video of the feature working end to end.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

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[bot]
oz-for-oss Bot previously requested changes May 6, 2026
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 expands Code Review repository discovery and routing so a non-repo parent directory can surface detected child repositories and use a mapped terminal when sending review comments.

Concerns

  • This changes user-visible Code Review panel behavior, but the PR description does not include screenshots or a video demonstrating repository selection and review-comment routing from a non-repo parent directory. For faster review, please upload screenshots or a video of the feature working end to end.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

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

Powered by Oz

@easoll
Copy link
Copy Markdown
Author

easoll commented May 6, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 6, 2026

@easoll

I'm re-reviewing this pull request in response to a review 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

@oz-for-oss oz-for-oss Bot dismissed stale reviews from themself May 6, 2026 11:38

Oz no longer requests changes for this pull request after the latest automated review.

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 direct child repository detection for non-repo working directories, includes those child repositories in pane-group Code Review repository selection, and routes review terminals deterministically while filtering deleted cached repositories.

Concerns

  • No blocking correctness or security concerns found in the changed lines.

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 6, 2026 11:38
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.

1 participant