Repository navigation
fix(planreview): stop comments dirtying the plan, and gate decisions on saving - #115
Merged
Merged
Conversation
…on saving Three follow-ups from reviewing the first release on expbkt3. Commenting re-sent the entire plan as a reviewer edit. Plate serializes a commented leaf as an MDX JSX element, and `mdast-util-to-markdown` throws on it inside a table cell — so on any plan containing a table, serialization failed, the editor's change handler read "cannot serialize" as a reviewer edit, and the panel shipped the whole Plate-normalized document under `<plan_edit mode="full">`. Nobody had edited anything. `stripPlanReviewCommentMarks` now removes comment properties and re-merges the leaves `split: true` fragmented, so the plan is always serialized as if it carried no comments. A test pins the underlying serializer failure too, so the strip cannot be quietly dropped later. Deciding on a plan with unsaved hand edits was ambiguous — neither side could say afterwards which text was approved. Unsaved edits now replace the decision row with a single **Save the plan**. Approving with open comments told the agent to implement "exactly as written" and then handed it a list of changes. It now says to start implementing and apply the comments as amendments, without returning to planning. 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.
Three follow-ups from the first release on expbkt3.
1. Commenting re-sent the whole plan as a reviewer edit
Reported: sending annotations attached a
<plan_edit mode="full">block containing the entire document, even though nothing had been edited. The attached copy was Plate-normalized (***,\hard breaks,*bullets), which was the clue.Root cause, reproduced before changing anything: Plate serializes a commented leaf as an MDX JSX element, and
mdast-util-to-markdownthrows on it inside a table cell —handleChangetreats a failed serialize as a reviewer edit ("Treat an editor tree that cannot be serialized as changed"), soisDirtyflipped, the client senteditedMarkdown, the server cut a version, and the diff against the agent baseline was non-empty — producing the full-plan resend. Any plan containing a table hit this the moment you commented on it.The earlier trap test missed it because its fixture had no table.
Fix:
stripPlanReviewCommentMarksremoves comment properties and re-merges the leavessplit: truefragmented;getMarkdown()and the change comparison both serialize through it. Comments are review state and can no longer influence what the agent is told changed. A second test asserts the raw serializer still throws, so the strip cannot be quietly deleted later on the assumption Plate handles it now.2. Unsaved hand edits did not gate the decision
Deciding on a plan whose edits are not yet a version leaves it ambiguous which text was approved. Unsaved edits now replace the decision row with a single Save the plan, with a one-line explanation beneath.
3. Approving with open comments contradicted itself
The prompt said "implement the plan you proposed above, exactly as written" and then attached a list of requested changes. It now says to start implementing and treat the comments as amendments to apply along the way, explicitly not to return to planning. The button reads Approve with comments in that state.
Verification
151 tests passedacross 10 scoped files.tsgo --noEmitclean forapps/web,packages/sharedandapps/server; lint andcheck-fork-markers.tspass.One existing server test asserted the old approval wording for exactly this case and was updated to assert the new intent, including
not.toContain("exactly as written").Reviewer check on expbkt3: comment on a plan containing a table and send — the prompt should carry only the
<review_comment>blocks and no<plan_edit>.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.