Skip to content

[RFC] Plan review annotations#2865

Open
ricglz wants to merge 2 commits into
pingdotgg:mainfrom
ricglz:plan-review-annotations
Open

[RFC] Plan review annotations#2865
ricglz wants to merge 2 commits into
pingdotgg:mainfrom
ricglz:plan-review-annotations

Conversation

@ricglz
Copy link
Copy Markdown

@ricglz ricglz commented May 29, 2026

What Changed

  • Added a dedicated proposed-plan review view in the existing right panel/sheet flow.
  • Added plan review entry points from proposed plan cards and the plan sidebar.
  • Added text-selection comments for proposed plans, including visual annotation cards with edit/delete support.
  • Added “Done” review flow that appends annotations into the composer as quote/comment markdown for plan refinement.
  • Kept review annotations client-side only and scoped to the mounted thread/session.
  • Added pure formatting helpers and tests for quote/comment markdown generation.

Sorry if too disruptive, I guess that with the new guidelines it would probably be too much. Just keeping it open as a RFC and food for thought

Why

Original prompt to Claude:

I'm not happy by how the plan's review experience is like. I believe that we should make this better in the following ways:

  1. Option to show the proposed plan in its own view
  2. That within that render it's possible to select text and "comment" about it. What this will do is that it will create a visual annotation like if you were making inline comments on any code review platform or similar
  3. When the user is done reviewing, we will "inline" those values so that we follow the quotation -> comment format. Eg
> quotation

comment

Additional context

Right now my main issue when going through the plan is that I think of edit as an editorial process in which you read what's there and you just want to inline on it or check some of the other details. The problem as of now is that it continues to feel like a simple text chat experience instead of an improvement of a review process which the planning phase should also be

UI Changes

Screen.Recording.2026-05-29.at.3.38.36.PM.mov

Note

Low Risk
Client-only UI and composer draft formatting; no server persistence or auth changes.

Overview
Adds an inline plan review flow in the existing plan right panel (desktop sidebar and mobile sheet): users open review from proposed-plan cards, the plan sidebar, or timeline cards, select plan text, attach comments, then Done merges feedback into the composer as blockquoted excerpts plus comments for plan refinement.

Introduces PlanReviewPanel with selection-based commenting, a comments list (edit/delete), and proposedPlanReview helpers to normalize selections and format/append that markdown. Review state and annotations stay client-side and reset when the thread changes; sidebar open/close is preserved when entering and leaving review.

Reviewed by Cursor Bugbot for commit 52f5740. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add plan review annotations flow to proposed plan cards

  • Adds a PlanReviewPanel component that renders plan markdown with text-selection-driven comment creation, allowing users to quote sections and attach comments as annotations.
  • Adds a 'Review' button to ProposedPlanCard and PlanSidebar that opens the review panel in place of the plan sidebar in ChatView.
  • When the user clicks 'Done', formatted quote/comment blocks are appended to the composer draft and the composer is focused.
  • Adds proposedPlanReview.ts with utilities for normalizing selection text, formatting quoted comments, and appending feedback to an existing draft.
  • The 'Done' button is disabled until at least one annotation exists; selections are capped at 8,000 characters with a warning toast.
📊 Macroscope summarized 52f5740. 8 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f7fc8fc2-54e6-44cb-9cd1-a159ae832e5a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels May 29, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 52f5740. Configure here.

planReviewAnnotationsByPlanId,
reviewingProposedPlan,
setComposerDraftPrompt,
]);
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.

Annotations not cleared after finishing plan review

Medium Severity

finishPlanReview appends annotation feedback to the composer draft but never clears the annotations from planReviewAnnotationsByPlanId for the finished plan. If the user re-opens the review for the same plan, the old annotations are still present and clicking "Done" again will duplicate the feedback in the composer.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 52f5740. Configure here.

export interface PlanReviewAnnotationDraft {
quote: string;
comment: string;
}
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.

Exported interface PlanReviewAnnotationDraft is never used

Low Severity

PlanReviewAnnotationDraft is exported but never imported or referenced anywhere in the codebase. It appears to be leftover dead code that adds unnecessary noise to the module's public API.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 52f5740. Configure here.

>
{commentEditorPanel}
</div>
) : null}
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.

Fixed-position popups misaligned inside sheet mode

Medium Severity

The selection action button and floating comment editor use position: fixed with viewport-relative coordinates from getBoundingClientRect / window.innerWidth. When PlanReviewPanel renders inside the RightPanelSheet path, the SheetPrimitive.Popup ancestor has will-change-transform, which per CSS spec creates a new containing block for fixed-positioned descendants. This causes both floating elements to be offset by the sheet's own viewport position, making them appear in the wrong location on narrow screens.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 52f5740. Configure here.

Comment on lines +174 to +181
useEffect(() => {
if (!commentEditor) {
return;
}
window.requestAnimationFrame(() => {
commentTextareaRef.current?.focus();
});
}, [commentEditor?.annotationId, commentEditor?.mode]);
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.

🟢 Low components/PlanReviewPanel.tsx:174

When a user opens the comment editor, selects different text, and clicks Comment again, the useEffect at line 174-181 does not re-run because both commentEditor?.annotationId (still undefined) and commentEditor?.mode (still "create") are unchanged. The textarea fails to auto-focus even though the editor now contains a new quote. Consider adding commentEditor?.quote to the dependency array so the effect triggers whenever the quote changes.

  useEffect(() => {
    if (!commentEditor) {
      return;
    }
    window.requestAnimationFrame(() => {
      commentTextareaRef.current?.focus();
    });
-  }, [commentEditor?.annotationId, commentEditor?.mode]);
+  }, [commentEditor?.annotationId, commentEditor?.mode, commentEditor?.quote]);
🤖 Copy this AI Prompt to have your agent fix this:
In file apps/web/src/components/PlanReviewPanel.tsx around lines 174-181:

When a user opens the comment editor, selects different text, and clicks Comment again, the `useEffect` at line 174-181 does not re-run because both `commentEditor?.annotationId` (still `undefined`) and `commentEditor?.mode` (still `"create"`) are unchanged. The textarea fails to auto-focus even though the editor now contains a new quote. Consider adding `commentEditor?.quote` to the dependency array so the effect triggers whenever the quote changes.

Evidence trail:
apps/web/src/components/PlanReviewPanel.tsx lines 29-38 (CommentEditorState interface: mode, quote, annotationId?, comment, position?), lines 160-172 (handleStartComment: sets commentEditor with mode='create', no annotationId), lines 174-181 (useEffect with deps [commentEditor?.annotationId, commentEditor?.mode] — both remain [undefined, 'create'] on re-open), line 179 (only .focus() call for commentTextareaRef), lines 240-256 (Textarea has no autoFocus prop, ref={commentTextareaRef}).

@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 29, 2026

Approvability

Verdict: Needs human review

This PR introduces a new plan review annotations feature with new UI components and workflows. New features introducing user-facing behavior warrant human review. Additionally, there are unresolved medium-severity bugs (annotations not cleared after review, popup positioning issues) that should be addressed.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant