Repository navigation
fix(planreview): anchor comments reliably and highlight what they point at - #114
Merged
Merged
Conversation
…nt at Anchored plan feedback reached the agent as raw `<review_comment>` XML. Three links, each verified: `locateQuotedLineRange` compared the reviewer's quote — captured from rendered Plate output, so already stripped of markdown — against raw source with `String.includes`, so any bold or code-spanned line missed; `formatPlanReviewComment` then omitted the range; and the transcript parser required that range, rejected the block, and fell back to printing it verbatim. Comments on formatted lines are the common case, not an edge case. Fix all three. `planReviewAnchorText` projects both sides onto the text a reader would select before comparing, the parser treats the range as optional in web and mobile alike, and a plan comment now renders as its own card — plan title and a blockquote, not a workspace-relative path and a monospace code block. Separately, `CommentLeaf` existed but nothing ever applied a mark, so a comment was real on the server and invisible in the document. Selecting now highlights immediately, saving turns that into a persistent amber anchor, and reopening the panel restores highlights by re-locating the stored quote. Comment marks are proven not to reach the serialized markdown, so commenting never dirties the draft. Rounds out the review surface with the UX worth taking from Plannotator: an inline comment popover beside the selection, one-click 👍/remove labels, two-way rail-to-document linking, and a width-gated Contents outline carrying per-section comment counts. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Anchored plan feedback reached the agent as raw
<review_comment>XML instead of a card:Three links, each reproduced end to end against the real functions before changing anything:
locateQuotedLineRangecompared the reviewer's quote against raw markdown withString.includes. The quote comes fromwindow.getSelection().toString()over rendered Plate output, so**and backticks are already gone —'1. **Outbound email context**'.includes('1. Outbound email context')isfalse. Comments on formatted lines are the common case, not an edge case.formatPlanReviewCommentomittedstartIndex/endIndex.parseReviewCommentContextrequired both indices, returnednull, and the transcript fell back to printing the block verbatim — so the XML rendered as prose and the```markdownfence became a monospace code block.apps/mobilehad the identical gate.Separately,
CommentLeafwas registered but nothing ever applied a comment mark — a comment was real on the server and invisible in the document.What changed
The prompt path
planReviewAnchorTextprojects both sides onto the text a reader would select (strips block syntax, emphasis, code spans, links/images) before comparing. Only the comparison changes;quotedTextstill travels verbatim.authorattribute.The review surface
⌘/Ctrl+Enter,Esc), replacing the box at the foot of the panel.Contentsoutline with per-section comment counts, via container query — noResizeObserver.Send feedbackonly claims the primary slot once there is feedback to send.Verification
123 tests passedacross 8 scoped files;tsgo --noEmitclean forapps/webandpackages/shared;apps/mobileis byte-identical to its pre-existing 76-error navigation baseline; lint andcheck-fork-markers.tspass.Two traps are pinned by tests against a real Plate editor, because either would make commenting look like a reviewer edit and send the agent a spurious edited-plan document:
Reviewer check on
bkt3-dev: open a plan, select a bold list item, comment — the text should highlight and the transcript card should show the plan title and a quotation, with no<review_comment>text and no monospace block.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.