Skip to content

fix(web): select pull request on review surface#1857

Merged
zeval merged 6 commits into
mainfrom
feature/review-surface-multi-rv1
Jul 22, 2026
Merged

fix(web): select pull request on review surface#1857
zeval merged 6 commits into
mainfrom
feature/review-surface-multi-rv1

Conversation

@zeval

@zeval zeval commented Jul 22, 2026

Copy link
Copy Markdown
Member

Multi-PR tasks could silently open the first associated pull request in Review, hiding sibling changes. Review now carries an exact task-scoped PR selection across desktop, docked, and mobile surfaces with stale-request protection.

Important Changes

  • Add a shared PR selector that defaults to the primary PR and falls back safely when associations change.
  • Preserve exact PR and worktree identity through Review, inline Changes, dockview, phone, and tablet routing.
  • Add loading, retry, stale-response, responsive, and same-path multi-PR regression coverage.

Validation

  • make fmt
  • make typecheck
  • TMPDIR=/tmp/kdv-pr-verify.XXXXXX make test
  • make lint
  • Desktop, phone, and tablet focused Playwright multi-PR Review specs

Checklist

  • I have performed a self-review of my code.
  • I have manually tested my changes and they work as expected.
  • My changes have tests that cover the new functionality and edge cases.
  • If my change touches UI files (apps/web/), I have added or updated Playwright e2e tests in apps/web/e2e/ and verified them with make test-e2e.
  • I checked whether this affects public docs in docs/public/** and updated them or noted why no docs change is needed.

Screenshots

Desktop Review with the sibling PR selector open:

Desktop multi-PR Review

Mobile Review with the contained touch selector:

Mobile multi-PR Review

Copilot AI review requested due to automatic review settings July 22, 2026 02:11
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds task-scoped multi-PR selection, stable PR-key propagation through review and diff panels, repository identity resolution, responsive review dialog mounting, and desktop/mobile/tablet tests and documentation.

Changes

Multi-PR review experience

Layer / File(s) Summary
Selection, identity, and keyed diff foundation
apps/web/components/github/*, apps/web/hooks/domains/github/*, apps/web/lib/state/*
Adds persistent per-task PR selection, stable PR keys, repository identity resolution, keyed PR diff state, and state initialization/merging.
PR-aware review dialog surface
apps/web/components/review/*, apps/web/hooks/use-review-sidebar-resize.ts, apps/web/hooks/domains/session/use-review-sources.ts
Adds PR selection controls, transient-state reset behavior, loading/error/retry handling, responsive dialog layout, and PR-aware review tests.
Selected PR changes and diff routing
apps/web/components/task/*, apps/web/lib/state/dockview-*
Propagates prKey through change rows, visible-file filtering, dockview previews, mobile sheets, review progress, and selected-PR source loading.
Review mounts and end-to-end verification
apps/web/components/task/*layout.tsx, apps/web/e2e/*, docs/*
Centralizes review dialog mounting and adds seeded desktop, mobile, and tablet coverage plus updated multi-PR review documentation.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

  • kdlbs/kandev#908: Adds related PR-specific file routing and filtering support consumed by the selected-PR changes flow.

Suggested reviewers: copilot

Poem

A rabbit hops through PRs with flair,
Keys keep every diff just there.
Select a branch, the panels glow,
Stale files vanish as they go.
Review bounds neatly fill the screen—
Clean diffs leap where they have been!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.41% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately summarizes the main change: selecting the correct pull request on the review surface.
Description check ✅ Passed The description matches the template well: it has a concise summary, important changes, validation steps, and preserves the checklist.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/review-surface-multi-rv1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds exact pull-request selection throughout the Review experience. The main changes are:

  • Shared task-scoped PR selection with safe fallback behavior.
  • PR and worktree identity propagation across desktop, docked, phone, and tablet views.
  • Loading, retry, and stale-response handling when switching PRs.
  • Unit and browser tests for multi-PR review flows.

Confidence Score: 5/5

This looks safe to merge.

  • The branch-slug collision fix now prefers exact branch and repository-position matches.
  • No separate blocking issue remained after the existing PR-file scoping case was excluded from this follow-up.

Important Files Changed

Filename Overview
apps/web/components/review/review-repository-identity.ts Resolves the selected PR to an exact branch, repository position, or unique branch slug.
apps/web/components/task/task-changes-panel-state.ts Propagates PR-scoped file identity through visible diff and file-selection state.
apps/web/hooks/domains/github/use-review-pr-selection.ts Provides shared task-scoped PR selection and fallback behavior.
apps/web/components/review/review-dialog-pr-state.tsx Adds PR-keyed transient state and loading, retry, and auto-close handling.

Reviews (7): Last reviewed commit: "test(web): cover PR review boundary bran..." | Re-trigger Greptile

Comment thread apps/web/components/review/review-repository-identity.ts Outdated
Comment thread apps/web/components/task/task-changes-panel-state.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes multi-PR task review behavior in apps/web by introducing a task-scoped pull request (PR) selection, ensuring Review/Changes surfaces render the intended PR revision (instead of implicitly using the first linked PR) across desktop, docked panels, and mobile/tablet layouts, with stale-response protection and regression coverage.

Changes:

  • Add a shared, task-scoped PR selection state (default primary PR; override per task; safe fallback when PR associations change).
  • Thread exact PR identity (prKey) through Review/Changes rendering and routing (dockview + mobile diff sheet) and harden PR file fetching against stale responses.
  • Add unit + Playwright E2E coverage and update spec/public docs to describe multi-PR Review behavior.

Reviewed changes

Copilot reviewed 65 out of 65 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/specs/tasks/multi-branch/spec.md Spec update describing one-PR-at-a-time Review selection semantics and constraints.
docs/public/sessions-and-review.md Public docs update explaining the PR selector and precedence rules.
docs/plans/multi-pr-review-selector/plan.md Implementation plan record for the selector work.
docs/plans/multi-pr-review-selector/task-01-selection-foundation.md Plan task record: state/keying foundation for selection.
docs/plans/multi-pr-review-selector/task-02-review-selector-ui.md Plan task record: selector UI + responsive behavior.
docs/plans/multi-pr-review-selector/task-03-inline-review-routing.md Plan task record: PR-qualified routing and inline review identity.
docs/plans/multi-pr-review-selector/task-04-e2e-verification.md Plan task record: E2E proof across viewports.
apps/web/lib/state/store.ts Adds reviewPRSelection + setReviewPRSelection to app state shape.
apps/web/lib/state/store.test.ts Tests new default state + per-task override persistence.
apps/web/lib/state/store-overrides.ts Wires reviewPRSelection into default override builder.
apps/web/lib/state/slices/ui/ui-slice.ts Adds default reviewPRSelection and setter action implementation.
apps/web/lib/state/slices/ui/types.ts Defines ReviewPRSelectionState and action signature.
apps/web/lib/state/dockview-store.ts Adds optional prKey to dockview diff panel params.
apps/web/lib/state/dockview-panel-actions.ts Scopes diff preview/pinned identity by prKey to avoid cross-PR reuse.
apps/web/lib/state/dockview-panel-actions.test.ts Verifies same-path diffs from different PRs don’t reuse pinned panels.
apps/web/lib/state/default-state.ts Adds reviewPRSelection to default/merge behavior for initial state.
apps/web/hooks/use-review-sidebar-resize.ts Reattaches resize observer when Review container is re-keyed by PR/session.
apps/web/hooks/use-review-sidebar-resize.test.ts Tests ResizeObserver lifecycle on keyed container replacement.
apps/web/hooks/domains/session/use-review-sources.ts Adds selected PR plumbing, explicit PR key support, and PR diff error/refresh surface.
apps/web/hooks/domains/github/use-review-pr-selection.ts New hook + helpers for resolving task-scoped selected PR with fallback.
apps/web/hooks/domains/github/use-review-pr-selection.test.ts Unit tests for selection default/override/fallback and store usage.
apps/web/hooks/domains/github/use-pr-review-repository-identity.ts New hook resolving PR repository identity from task/worktree/session metadata.
apps/web/hooks/domains/github/use-pr-review-repository-identity.test.tsx Tests identity resolution for boot vs live worktree metadata.
apps/web/hooks/domains/github/use-pr-diff.ts Adds sourceKey masking to prevent stale PR files flashing during selection changes.
apps/web/hooks/domains/github/use-pr-diff.test.ts Tests stale-request masking and late-resolution handling.
apps/web/e2e/tests/review/review-multi-pr.spec.ts New desktop E2E ensuring PR switching doesn’t show stale diff content.
apps/web/e2e/tests/review/mobile-review-multi-pr.spec.ts New mobile/tablet E2E verifying touch targets, containment, and PR switching.
apps/web/e2e/pages/session-page.ts Adds selectors/helpers for the new Review PR selector and diff text extraction.
apps/web/e2e/helpers/multi-pr-review.ts Seeds a multi-PR task with distinct PR markers for E2E validation.
apps/web/e2e/helpers/api-client.ts Adds helper to associate GitHub task PRs via API for E2E seeding.
apps/web/components/task/use-review-dialog.ts Switches Review dialog data flow to selected PR + PR diff loading/error/retry.
apps/web/components/task/task-changes-panel.tsx Threads explicit PR key into file-mode diff rendering and adds PR diff boundary states.
apps/web/components/task/task-changes-panel.test.ts Moves/extends tests for new helper module and PR-related deferral/auto-close logic.
apps/web/components/task/task-changes-panel-state.ts New extracted helpers for PR deferral, file filtering, and auto-close semantics.
apps/web/components/task/mobile/session-tablet-layout.tsx Mounts shared Review dialog on tablet layout via TaskReviewDialogMount.
apps/web/components/task/mobile/session-mobile-layout.tsx Replaces mobile-local Review mount with shared TaskReviewDialogMount.
apps/web/components/task/mobile/mobile-diff-sheet.tsx Adds prKey propagation into TaskChangesPanel file-mode.
apps/web/components/task/mobile/mobile-changes-panel.tsx Preserves prKey when opening PR file diffs from mobile changes panel.
apps/web/components/task/dockview-shared.tsx Threads prKey through dockview shared diff-view routing.
apps/web/components/task/dockview-session-tabs.ts Imports prTaskKey from shared utils for stable PR identity.
apps/web/components/task/dockview-review-dialog.tsx Refactors to TaskReviewDialogMount (shared across desktop/mobile/tablet).
apps/web/components/task/dockview-panel-content.tsx Threads prKey through dockview diff-view routing.
apps/web/components/task/dockview-panel-content.diff.test.tsx Adds coverage ensuring prKey/PR source survives dockview rendering paths.
apps/web/components/task/dockview-desktop-layout.tsx Uses TaskReviewDialogMount instead of duplicating Review mount + overlay wiring.
apps/web/components/task/dockview-add-panel-items.tsx Consolidates PR identity imports onto pr-utils.
apps/web/components/task/changes-top-bar.tsx Adds Review PR selector to the Changes top bar when multiple PRs exist.
apps/web/components/task/changes-panel-timeline.tsx Adds optional prKey to PR timeline file row shape.
apps/web/components/task/changes-panel-pr-files.tsx Stamps data-pr-key and propagates prKey into diff open options.
apps/web/components/task/changes-panel-pr-files.test.tsx Ensures prKey is passed through when opening PR diffs.
apps/web/components/task/changes-panel-helpers.ts Stamps PR file rows with the stable prKey.
apps/web/components/task/changes-panel-helpers.test.ts Tests that PR rows are stamped with the exact PR key.
apps/web/components/task/changes-panel-data.tsx Builds PR groups/labels while preserving stable PR identity and selected-PR progress source.
apps/web/components/task/changes-diff-target.ts Extends diff routing types to carry optional prKey.
apps/web/components/review/review-top-bar.tsx Adds Review PR selector to the Review toolbar with responsive wrapping.
apps/web/components/review/review-repository-identity.ts New pure helper for deriving review repository identity for PRs (worktree-aware).
apps/web/components/review/review-repository-identity.test.ts Tests primary vs sibling identity resolution behavior.
apps/web/components/review/review-pr-selector.tsx New shared PR selector component (desktop + mobile + tablet affordances).
apps/web/components/review/review-dialog.tsx Refactors Review dialog into surface + PR-keyed transient state and boundary behaviors.
apps/web/components/review/review-dialog.build-files.test.ts Adds tests for PR transitions, transient state reset, and selection setter correctness.
apps/web/components/review/review-dialog-surface.tsx New extracted Review dialog surface with PR boundary + sidebar resize re-keying.
apps/web/components/review/review-dialog-pr-state.tsx New helpers for auto-close rules, transient state, and PR diff loading/error boundary.
apps/web/components/review/review-dialog-pr-state.test.tsx Tests PR diff boundary behavior (no stale children; retry; local-only ignore).
apps/web/components/github/pr-utils.ts Moves/centralizes prTaskKey into shared PR utilities.
apps/web/components/github/pr-topbar-button.tsx Updates import path to shared prTaskKey.
apps/web/components/github/pr-detail-panel.tsx Removes local prTaskKey definition; imports from shared utils.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/web/components/review/review-dialog-pr-state.tsx
Comment thread apps/web/components/task/task-changes-panel.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

const pr = (params?.prKey ? prs.find((p) => prTaskKey(p) === params.prKey) : null) ?? activePR;

P2 Badge Preserve keyed PR panels when the PR is missing

When a dockview panel was opened with a prKey but that PR is not in prs anymore (for example a restored pr-detail|owner/repo/2 tab after the PR association was removed), this expression falls back to the active primary PR and the keyed tab can display/act on the wrong pull request. Only use activePR for legacy panels with no params.prKey; for keyed panels, render the missing-PR placeholder until the exact key is present.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/web/components/task/task-changes-panel.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/hooks/domains/github/use-pr-review-repository-identity.ts`:
- Around line 17-41: Update normalizeReviewWorktrees so live-only entries from
liveWorktrees are converted to ReviewWorktreeIdentity objects before insertion,
explicitly mapping id, repositoryId, branch, and path while leaving branchSlug
and position unset. Preserve the existing seen check and append the normalized
identity instead of the raw Worktree.

In `@apps/web/lib/state/store.test.ts`:
- Around line 32-48: Extend the store tests around createAppStore and
reviewPRSelection to cover initialization with caller-supplied
selectedKeyByTaskId. Create the store with an initial reviewPRSelection
containing a task-to-PR mapping, then assert the mapping survives in
store.getState().reviewPRSelection after initialization.

In `@docs/plans/multi-pr-review-selector/task-01-selection-foundation.md`:
- Around line 16-40: Update Task 01’s plan to include
use-pr-review-repository-identity.ts and its corresponding test in the Files
list. Extend the focused Verification command to run that test alongside the
existing selection and store tests, keeping the scope limited to the
repository-identity foundation behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f25e04d6-ae61-4d95-a6c3-0942fd947b99

📥 Commits

Reviewing files that changed from the base of the PR and between 6d5fc47 and 092116b.

📒 Files selected for processing (65)
  • apps/web/components/github/pr-detail-panel.tsx
  • apps/web/components/github/pr-topbar-button.tsx
  • apps/web/components/github/pr-utils.ts
  • apps/web/components/review/review-dialog-pr-state.test.tsx
  • apps/web/components/review/review-dialog-pr-state.tsx
  • apps/web/components/review/review-dialog-surface.tsx
  • apps/web/components/review/review-dialog.build-files.test.ts
  • apps/web/components/review/review-dialog.tsx
  • apps/web/components/review/review-pr-selector.tsx
  • apps/web/components/review/review-repository-identity.test.ts
  • apps/web/components/review/review-repository-identity.ts
  • apps/web/components/review/review-top-bar.tsx
  • apps/web/components/task/changes-diff-target.ts
  • apps/web/components/task/changes-panel-data.tsx
  • apps/web/components/task/changes-panel-helpers.test.ts
  • apps/web/components/task/changes-panel-helpers.ts
  • apps/web/components/task/changes-panel-pr-files.test.tsx
  • apps/web/components/task/changes-panel-pr-files.tsx
  • apps/web/components/task/changes-panel-timeline.tsx
  • apps/web/components/task/changes-top-bar.tsx
  • apps/web/components/task/dockview-add-panel-items.tsx
  • apps/web/components/task/dockview-desktop-layout.tsx
  • apps/web/components/task/dockview-panel-content.diff.test.tsx
  • apps/web/components/task/dockview-panel-content.tsx
  • apps/web/components/task/dockview-review-dialog.tsx
  • apps/web/components/task/dockview-session-tabs.ts
  • apps/web/components/task/dockview-shared.tsx
  • apps/web/components/task/mobile/mobile-changes-panel.tsx
  • apps/web/components/task/mobile/mobile-diff-sheet.tsx
  • apps/web/components/task/mobile/session-mobile-layout.tsx
  • apps/web/components/task/mobile/session-tablet-layout.tsx
  • apps/web/components/task/task-changes-panel-state.ts
  • apps/web/components/task/task-changes-panel.test.ts
  • apps/web/components/task/task-changes-panel.tsx
  • apps/web/components/task/use-review-dialog.ts
  • apps/web/e2e/helpers/api-client.ts
  • apps/web/e2e/helpers/multi-pr-review.ts
  • apps/web/e2e/pages/session-page.ts
  • apps/web/e2e/tests/review/mobile-review-multi-pr.spec.ts
  • apps/web/e2e/tests/review/review-multi-pr.spec.ts
  • apps/web/hooks/domains/github/use-pr-diff.test.ts
  • apps/web/hooks/domains/github/use-pr-diff.ts
  • apps/web/hooks/domains/github/use-pr-review-repository-identity.test.tsx
  • apps/web/hooks/domains/github/use-pr-review-repository-identity.ts
  • apps/web/hooks/domains/github/use-review-pr-selection.test.ts
  • apps/web/hooks/domains/github/use-review-pr-selection.ts
  • apps/web/hooks/domains/session/use-review-sources.ts
  • apps/web/hooks/use-review-sidebar-resize.test.ts
  • apps/web/hooks/use-review-sidebar-resize.ts
  • apps/web/lib/state/default-state.ts
  • apps/web/lib/state/dockview-panel-actions.test.ts
  • apps/web/lib/state/dockview-panel-actions.ts
  • apps/web/lib/state/dockview-store.ts
  • apps/web/lib/state/slices/ui/types.ts
  • apps/web/lib/state/slices/ui/ui-slice.ts
  • apps/web/lib/state/store-overrides.ts
  • apps/web/lib/state/store.test.ts
  • apps/web/lib/state/store.ts
  • docs/plans/multi-pr-review-selector/plan.md
  • docs/plans/multi-pr-review-selector/task-01-selection-foundation.md
  • docs/plans/multi-pr-review-selector/task-02-review-selector-ui.md
  • docs/plans/multi-pr-review-selector/task-03-inline-review-routing.md
  • docs/plans/multi-pr-review-selector/task-04-e2e-verification.md
  • docs/public/sessions-and-review.md
  • docs/specs/tasks/multi-branch/spec.md

Comment thread apps/web/hooks/domains/github/use-pr-review-repository-identity.ts
Comment thread apps/web/lib/state/store.test.ts
Comment thread docs/plans/multi-pr-review-selector/task-01-selection-foundation.md Outdated
…e-multi-rv1

# Conflicts:
#	apps/web/components/task/dockview-session-tabs.ts
#	apps/web/components/task/mobile/session-mobile-layout.tsx
Copilot AI review requested due to automatic review settings July 22, 2026 02:33
@claude

claude Bot commented Jul 22, 2026

Copy link
Copy Markdown

Claude finished @zeval's task in 6m 51s —— View job


Claude's code review

  • Load review skill and gather context
  • Read key changed files (65 files reviewed)
  • Analyze correctness, security, and architecture issues
  • Post inline comments for specific findings
  • Post findings summary

Review posted. See full findings report below.

1 blocker — the selectedFileKey computation in task-changes-panel.tsx:341 drops fileRepositoryName when prKey && sourceFilter === "pr", which breaks file highlighting/selection in the dockview diff panel for multi-repo PR files — exactly the scenario this PR targets. The fix is a one-liner (remove the conditional). 3 additional suggestions posted as inline comments.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Cloudflare Pages docs preview

Open the docs preview

Built from docs commit 160126f.

Stable PR alias: https://docs-pr-1857.landing-87j.pages.dev/docs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 65 out of 65 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

apps/web/components/review/review-dialog-pr-state.tsx:74

  • useReviewDialogTransientState calls setState during render when sourceKey changes. This pattern can trigger React warnings (and is especially brittle under StrictMode double-invocation), and it adds a render-phase side effect that’s easy to regress into an infinite rerender if the condition ever changes.

Move the state synchronization into an effect keyed on sourceKey, and keep resolvedState as a pure derived value for the current render.

export function useReviewDialogTransientState(sourceKey: string) {
  const [state, setState] = useState<ReviewTransientState>(() => ({
    sourceKey,
    selectedFile: null,
    filter: "",
  }));
  const resolvedState = resolveReviewTransientState(state, sourceKey);
  if (resolvedState !== state) setState(resolvedState);

Comment thread apps/web/components/task/task-changes-panel.tsx Outdated
Comment thread apps/web/components/review/review-dialog-pr-state.tsx Outdated
Comment thread apps/web/hooks/domains/github/use-pr-review-repository-identity.ts Outdated
Comment thread apps/web/components/task/task-changes-panel.tsx
@claude

claude Bot commented Jul 22, 2026

Copy link
Copy Markdown

Findings

Blocker (must fix before merge)

  1. selectedFileKey drops repository name in multi-repo PR file-modeapps/web/components/task/task-changes-panel.tsx:337-341
    • Issue: When prKey && sourceFilter === "pr", fileRepositoryName is passed as undefined to useSelectedFileKey. In multi-repo tasks, PR diff files carry repository_name, producing composite keys like "widgets\x00src/foo.ts". The selectedFileKey is just "src/foo.ts" — no match in ReviewDiffList, so the dockview diff panel never highlights the file, never auto-scrolls to it, and forceLoad doesn't trigger.
    • Why: This is a regression that affects every multi-repo PR file open (source = "pr", non-empty repositoryName). The null-repo intent is to disable repository filtering in filterVisibleFiles, but that is already handled there; selectedFileKey is unrelated and shouldn't participate.
    • Fix: Remove the conditional — always pass fileRepositoryName to useSelectedFileKey. The filtering logic in filterVisibleFiles/useVisibleDiffState is already correct and handles the "show all PR files for this path" case independently. See inline comment.

Suggestion (recommended, doesn't block)

  1. Render-time setState in useReviewDialogTransientStateapps/web/components/review/review-dialog-pr-state.tsx:73

    • Issue: if (resolvedState !== state) setState(resolvedState) called during render. This is the React-recommended pattern for "reset derived state when a prop changes," but it causes an extra render pass (React discards the current render and re-runs immediately). No infinite loop risk since the update is idempotent, but linters and code reviewers may flag it as unexpected.
    • Fix: Add a comment explaining the intent (React docs explicitly endorse this pattern as preferable to useEffect for avoiding stale-state flashes). See inline suggestion.
  2. Live-only Worktree objects pushed to ReviewWorktreeIdentity[] without branchSlug/positionapps/web/hooks/domains/github/use-pr-review-repository-identity.ts:36-38

    • Issue: normalized.push(worktree) where worktree: Worktree has no branchSlug or position. The two fallback checks in findPRWorktree (branchSlug equality and position equality) silently fail for these entries. Only exact branch matching works. During the brief pre-hydration window when sessionWorktrees is empty, this can cause the wrong (or no) repository identity to resolve.
    • Fix: Explicitly map to ReviewWorktreeIdentity shape before pushing, leaving branchSlug and position unset but intentional. See inline suggestion.
  3. ReviewPRDiffBoundary blocks local files in the all source viewapps/web/components/task/task-changes-panel.tsx:377-398

    • Issue: usesPRDiff is true for sourceFilter === "all". When a PR is loading, the boundary shows a spinner and drops all children — including uncommitted/committed local files that are already in visible.visibleFiles and ready to show. A task with local changes + a linked PR will block the entire panel on open.
    • Fix: Only pass selectedPR/error to the boundary when sourceFilter === "pr", so the all view can render local files immediately while the PR fetch is in-flight.

Summary

Severity Count
Blocker 1
Suggestion 3

Verdict: Blocked — fix blocker (#1) before merge. The selectedFileKey regression will break the core multi-repo PR file diff flow this PR is specifically targeting.

Reviewed commit 092116b on branch feature/review-surface-multi-rv1.

View job run

Copilot AI review requested due to automatic review settings July 22, 2026 03:13
@claude

claude Bot commented Jul 22, 2026

Copy link
Copy Markdown

Claude Code is working…

  • Load review skill and gather context
  • Read key changed files (65 files reviewed, focusing on post-feedback commit 6fe6d8d)
  • Analyze correctness, security, and architecture issues
  • Post inline comments for specific findings
  • Post findings summary

View job run

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/web/components/task/task-changes-panel.test.ts (1)

196-217: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the new helper fallback branches.

The tests do not exercise the "all" + PR-only branch of shouldBlockChangesForPR (Line 22), nor the non-PR fallback of resolveSelectedFileRepositoryName (Line 31). Add assertions for both to prevent regressions in the newly introduced branching.

As per coding guidelines, every code change must include tests for new or changed logic.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/components/task/task-changes-panel.test.ts` around lines 196 - 217,
Extend the existing shouldBlockChangesForPR tests to assert the "all" view
blocks when only PR files are present, and extend
resolveSelectedFileRepositoryName tests to cover the non-PR fallback path. Use
representative inputs matching each branch and assert the expected fallback
results.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/web/components/task/task-changes-panel.test.ts`:
- Around line 196-217: Extend the existing shouldBlockChangesForPR tests to
assert the "all" view blocks when only PR files are present, and extend
resolveSelectedFileRepositoryName tests to cover the non-PR fallback path. Use
representative inputs matching each branch and assert the expected fallback
results.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: af4f45af-912f-42f0-bf0c-76808f12112a

📥 Commits

Reviewing files that changed from the base of the PR and between 26acf71 and 6fe6d8d.

📒 Files selected for processing (10)
  • apps/web/components/review/review-dialog-pr-state.test.tsx
  • apps/web/components/review/review-dialog-pr-state.tsx
  • apps/web/components/review/review-repository-identity.test.ts
  • apps/web/components/review/review-repository-identity.ts
  • apps/web/components/task/task-changes-panel-state.ts
  • apps/web/components/task/task-changes-panel.test.ts
  • apps/web/components/task/task-changes-panel.tsx
  • apps/web/hooks/domains/github/use-pr-review-repository-identity.ts
  • apps/web/lib/state/store.test.ts
  • docs/plans/multi-pr-review-selector/task-01-selection-foundation.md
🚧 Files skipped from review as they are similar to previous changes (6)
  • apps/web/lib/state/store.test.ts
  • docs/plans/multi-pr-review-selector/task-01-selection-foundation.md
  • apps/web/components/review/review-repository-identity.ts
  • apps/web/components/review/review-dialog-pr-state.tsx
  • apps/web/hooks/domains/github/use-pr-review-repository-identity.ts
  • apps/web/components/task/task-changes-panel.tsx

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 65 out of 65 changed files in this pull request and generated 2 comments.

Comment thread apps/web/components/review/review-dialog-surface.tsx
Comment thread apps/web/components/review/review-pr-selector.tsx
@claude

claude Bot commented Jul 22, 2026

Copy link
Copy Markdown

Re-review in progress

  • Load review skill and gather context
  • Read fix commits (6fe6d8d, 25fbe2d) — verify previously reported issues are resolved
  • Inspect new inline comments from Copilot (review-dialog-surface, review-pr-selector mobile)
  • Check CodeRabbit nitpick on helper fallback coverage
  • Post inline findings and summary

View job run

@claude

claude Bot commented Jul 22, 2026

Copy link
Copy Markdown

Claude finished @zeval's task in 4m 21s —— View job


Claude finished @josé Almeida's task


  • Load review skill and gather context
  • Read fix commits (6fe6d8d, 4181170) — all four previously reported issues resolved
  • Check remaining open findings (CodeRabbit nitpick on helper fallback coverage, Copilot mobile max-height / Review surface blocker)
  • Post inline findings and summary

3 blockers — each is a missing test branch for a new pure-logic function, all ≤3-line additions to existing describe blocks (inline suggestions attached). All previous blockers and suggestions are confirmed resolved.

Comment thread apps/web/components/task/task-changes-panel.test.ts
Comment thread apps/web/components/review/review-dialog-pr-state.test.tsx
Comment thread apps/web/components/task/task-changes-panel.test.ts
@claude

claude Bot commented Jul 22, 2026

Copy link
Copy Markdown

Findings

Head under review: 4181170 (branch feature/review-surface-multi-rv1). Previous blocker and all three Copilot/CodeRabbit suggestions confirmed resolved. Three test-coverage gaps remain.

Blocker (must fix before merge)

  1. shouldBlockChangesForPR("all", PR-only files) true-branch untestedapps/web/components/task/task-changes-panel.test.ts:196-203

    • Issue: The "all" + all-files-are-PR branch of shouldBlockChangesForPR (line 22 of task-changes-panel-state.ts) has no test. Only the false path (local file present) is covered; the true path (task has only PR-sourced files) is not.
    • Why: This is the core scenario the boundary fix targets — a task with a selected PR and no local changes. Without a test, a future simplification of the function could silently regress it.
    • Fix: Add expect(shouldBlockChangesForPR("all", [file("pr.ts", "pr")])).toBe(true) (see inline suggestion).
  2. shouldBlockReviewForPR true-branch untestedapps/web/components/review/review-dialog-pr-state.test.tsx:17-31

    • Issue: Same gap in the expanded-Review helper: only the false path (local file present) is tested.
    • Why: The true case — block when all files are PR-sourced — is the guard that prevents ReviewDialogSurface from blocking local diffs. Without coverage, either direction of a bug here would go undetected.
    • Fix: Add a test with a source: "pr" file array asserting true (see inline suggestion).
  3. resolveSelectedFileRepositoryName non-PR fallback untestedapps/web/components/task/task-changes-panel.test.ts:206-217

    • Issue: Only the prKey && sourceFilter === "pr" path is asserted. The else branch (returns fileRepositoryName) has no test.
    • Why: This else branch covers every view other than a PR-file-mode diff, so a regression there would break file highlighting for uncommitted/committed sources.
    • Fix: Add a non-PR call and assert it returns fileRepositoryName (see inline suggestion).

Summary

Severity Count
Blocker 3

Verdict: Blocked — three new pure-logic functions each have one untested branch. All three are ≤3-line additions to the existing describe blocks (suggestions attached inline). Previous blocker (selectedFileKey dropping repository scope) and all Copilot/CodeRabbit/prior-round suggestions are confirmed resolved in 6fe6d8d/4181170.

Reviewed commit 4181170 on branch feature/review-surface-multi-rv1.

View job run

@claude

claude Bot commented Jul 22, 2026

Copy link
Copy Markdown

Claude finished @zeval's task in 1m 36s —— View job


Re-review in progress

  • Load review skill and gather context
  • Read fix commit (160126f) — verify previously reported test-branch blockers are resolved
  • Check for any new issues in latest changes
  • Post inline findings and summary

@zeval

zeval commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

@greptile-apps

@zeval
zeval merged commit d5da5d0 into main Jul 22, 2026
66 checks passed
@zeval
zeval deleted the feature/review-surface-multi-rv1 branch July 22, 2026 16:53
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.

2 participants