warp icon indicating copy to clipboard operation
warp copied to clipboard

Open in code review button remains after a PR comment is added to the code review panel

Open captainsafia opened this issue 7 months ago • 4 comments

Summary

The PR comments view continues to show the per-comment “Open in code review” button after that comment has already been added to the code review panel.

Problem

After a PR comment is added to the code review panel, the source comment in the PR comments view still appears actionable via “Open in code review.” This makes it look like the comment has not been added yet and may invite users to repeat the action.

Expected behavior

Once a PR comment has been added to the code review panel, the corresponding “Open in code review” button should no longer appear as an available action for that comment. It should be hidden, disabled, or replaced with an already-added state so the user can tell the comment is already in the review panel.

Actual behavior

The “Open in code review” button remains visible in the PR comments view even after the comment has been added to the code review panel.

Reproduction steps or desired workflow

  1. Open a PR comments view that contains at least one comment with an “Open in code review” button.
  2. Click “Open in code review” for a comment.
  3. Confirm that the comment appears in the code review panel.
  4. Return to or observe the PR comments view for the same comment.
  5. Notice that the “Open in code review” button is still shown for the already-added comment.

Artifacts

None attached.

Warp version

v0.2026.04.25.08.29.dev_00

Operating system

macOS 26.4 (build 25E246)

Possible source references

  • app/src/ai/blocklist/block.rs:557: creates the per-comment ActionButton::new("Open in code review", SecondaryTheme) that dispatches AIBlockAction::OpenImportedCommentInCodeReview.
  • app/src/ai/blocklist/block/view_impl/imported_comments.rs:12: renders each imported comment card’s open_in_code_review_button in the PR/imported-comments UI.
  • app/src/ai/blocklist/block.rs:5284: contains update_imported_comments_disabled_state, the existing disabled-state path for imported-comments code review buttons.

captainsafia avatar Apr 30 '26 16:04 captainsafia

@captainsafia

Here's what I found while triaging this issue:

The report appears actionable from the current UI flow: the source PR-comment card does not reflect that the comment has already been added to the code review panel, so the action remains available.

Maintainer details

I concluded that the imported PR comment source card remains actionable after the comment is opened in the code review panel because the source-card button is rendered unconditionally and no already-added state is tracked back to the AI block..

Triage summary

This looks like an actionable code review UI bug. Imported PR comments can be opened into the code review panel, but the originating imported-comment card does not record or render an already-added state, so the same per-comment action remains visible.

Reproducibility

High. The issue provides clear reproduction steps, and the code path aligns with the behavior: ImportedCommentElementState::new creates the per-comment Open in code review button, render_imported_comments always includes that button in the card header, and the click handler only emits an event to open/upsert the comment in the code review panel.

Likely implementation area

  • app/src/ai/blocklist/block.rs: owns imported comment card state, creates the per-comment button, handles OpenImportedCommentInCodeReview, and currently only updates disabled state for repository/CWD mismatch.
  • app/src/ai/blocklist/block/view_impl/imported_comments.rs: unconditionally renders the per-comment button.
  • app/src/terminal/view.rs and app/src/workspace/view.rs: route the open-comment event into the code review panel and upsert the selected comment.
  • app/src/code_review/comments/batch.rs: upserts imported comments by ID, so repeated clicks should update/navigate rather than create distinct duplicates, but this does not change the source card affordance.

Suggested fix direction

Track whether each imported comment has already been opened/imported into the code review panel and use that state to hide, disable, or replace the source-card action. The existing disabled-state helper is only tied to repo/CWD validity, so the already-added state likely needs a separate state field or button update path.

Duplicate check

No likely duplicate found among the provided recent/open issues or an open-issue search for the exact button text.

Likely owners

app/src/ai/blocklist/ maps to @zachbai, and app/src/code_review/ maps to @kevinchevalier in .github/STAKEHOLDERS.

This is my automated analysis and may be incorrect. A maintainer will verify the details.

Powered by Oz

warp-for-oss[bot] avatar Apr 30 '26 16:04 warp-for-oss[bot]

This issue has been labeled ready-to-implement and is open for contributions involving code changes. If you'd like to tackle it, feel free to open a pull request against this issue. You can also comment @oz-agent on this issue to have the bot draft an implementation PR automatically.

warp-for-oss[bot] avatar Apr 30 '26 17:04 warp-for-oss[bot]

I opened a PR for this: https://github.com/warpdotdev/warp/pull/9648

The fix tracks when an imported PR comment has already been opened in the code review panel and updates the source card action to a disabled “Added to code review” state, while keeping the existing repo/CWD disabled logic separate.

dhruvac29 avatar Apr 30 '26 19:04 dhruvac29

Hi @MaggieShan and @kevinchevalier, I'd like to help finish this one if it's still open to an outside contribution.

#9648 got very close: Kevin said it looked great and asked for one small change (return a named, module-private struct instead of a tuple in block.rs) before it would merge, but it was closed in June before that landed. I'd pick up from that approach, credit @dhruvac29's original work, and make the requested change.

I'd keep the same design #9648 used, the disabled "Added to code review" state, and add a short tooltip so it's clear the comment is already in the panel. I'd make sure the bulk "Open all" path marks cards too, and include before/after screenshots and a short recording in the PR.

Happy to leave it if you're already on it. Thanks!

mrprosdocimi-YES avatar Nov 17 '26 18:11 mrprosdocimi-YES