backnotprop / backnotprop/plannotator

[Feature Request] Render and continue GitHub PR review-thread comments inline on the diff

Open
#754 0 comments 4 reactions 0 assignees View on GitHub
accepted
Dominant language
TypeScript
Stars
8.7k
Forks
649
Avg merge
11h 12m
Merged PRs (30d)
109

Description

## Summary

The `PR Comments` panel already shows GitHub's review threads in a sidebar tab, but the same threads are not rendered as overlay highlights on the corresponding diff lines, and there is no way to reply to a thread from within plannotator. When re-opening a PR in `plannotator review`, prior inline review comments appear only in the tab — not anchored visually to the line — and any continuation of the discussion has to happen on GitHub itself.

This request covers two paired capabilities:

1. **Render** historical GitHub PR review-thread comments as overlay annotations on the diff lines, the way GitHub's own diff view does.
2. **Continue** those threads — reply to existing comments and resolve threads — without leaving plannotator.

## Motivation

- **Continuing a multi-pass review** — re-opening a PR with existing inline comments and being able to see, at a glance, which lines already have unresolved discussion.
- **Reviewing a teammate's PR** — quickly spotting which lines already have feedback from other reviewers without leaving the diff and scanning the PR Comments tab.
- **Replying without leaving the tool** — today, once a thread exists on GitHub, the only way to push the discussion forward is on github.com. Forces a context switch every time, and breaks the "review entirely in plannotator" flow that the existing Post Review action sets up.
- **Visual continuity with GitHub** — GitHub's PR diff page anchors every review-thread comment to its line and lets you reply inline. Today plannotator's diff view feels "fresh" each time, with no acknowledgement of prior discussion or a way to engage with it.

## Current State

- Data is already fetched: `PRReviewThread` (with `line`/`position` anchoring), `PRReview`, and `PRComment` flow through to `packages/review-editor/components/PRCommentsTab.tsx` and render in the side panel.
- The annotation overlay system (`web-highlighter`) is session-scoped — only the reviewer's current annotations render as colored highlights on the diff. There is no path for historical GitHub threads to enter the same overlay layer.
- Different rendering pipelines: `PRCommentsTab` uses a markdown timeline component; the diff overlays use `web-highlighter`. No shared layer takes the same thread data and pins it to the diff.
- Submit-side: `submitPRReview` in `packages/shared/pr-github.ts` POSTs to `/repos///pulls//reviews`, which always creates a **new** review. There is no path for replying to an existing review thread (which requires `POST /repos///pulls//comments` with `in_reply_to`) or for resolving a thread (GraphQL `resolveReviewThread`).

## Proposed Behavior

### View (overlay)

A toggle (per session or per setting) — "Show GitHub threads on diff" — that:

1. Reads the `PRReviewThread` data already on `PRContext`.
2. For each thread with `line`/`startLine` + `path`, renders a read-only marker overlay on the corresponding diff line.
3. Clicking the marker opens the thread (could pop the same component used in `PRCommentsTab` in a side popover, or navigate the `PR Comments` panel to that thread).
4. Visually distinct from session annotations (different color/icon) so reviewers can tell their new work from historical context at a glance.

Resolved threads could be hidden by default with a second toggle.

### Continue (reply / resolve)

From the thread popover (or the `PR Comments` panel entry):

1. **Reply** — textarea + Send button that POSTs to `/repos///pulls//comments` with `in_reply_to: `. On success, the new comment appears at the bottom of the thread without re-fetching the whole PR context.
2. **Resolve / Unresolve thread** — button that calls the GraphQL `resolveReviewThread` / `unresolveReviewThread` mutation on `thread.id`. Updates the local thread state so the marker hides (when "hide resolved" is on) or restyles.
3. Same `gh api` runtime used by `submitPRReview` — no new auth surface.

## Related

- #348 — closed umbrella for Code Review Enhancements & GitHub PR Integration; "PR comments — conversation thread from GitHub" was shipped as the side panel. This issue is the natural follow-up for surfacing those threads on the diff itself and making them interactive.
- #611 — Allow AI agents to review code and show their suggestion in plannotator (same rendering need on the receiving side: non-session-author markers anchored to diff lines).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.