You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(web): long preview annotation comments are no longer dropped from the message - #29834
On desktop, the preview annotation box ("Describe the change…") accepts a comment of any length. The message contract caps a preview annotation's comment at 8,000 characters. Web built the annotation's context record with the comment unchanged, so a long comment (for example, a pasted spec or log) made a record over the bound.
Message context records decode as a forward-compatible array, so an invalid record is not an error. It is silently dropped on encode and decode. The user's annotation (comment, picked elements, screenshot link) never reaches the agent. The prompt still holds a link to a context record that no longer exists.
Change
previewAnnotationContextRecord now runs the trimmed comment through the existing clampContextText helper with COMPOSER_CONTEXT_PREVIEW_COMMENT_MAX_CHARS, which is now exported from contracts. Review comments already clamp their text and diff this way. A long comment keeps its first 8,000 characters and ends with the existing … truncated … marker.
Scope and approval
Very small, focused fix for an obvious bug, so no prior issue: the contract bound and the clamp helper both exist, and the sibling review-comment record already uses them. 5 non-test lines.
Overlap search: local PR index and GitHub search for previewAnnotationContextRecord and long annotation comments. Closest is #29804 (open), which clamps terminal context text and makes clampContextText surrogate-safe. This PR does not touch those lines, and that guard covers this caller once it lands. Other annotation PRs (#24573, #29716, #29287) fix unrelated desktop behaviour.
The regression test is a new it rather than an extension of "clamps an oversized review selection so the record still encodes", because #29804 rewrites that case.
Verification
Red on main: composerContextRecords.test.ts > "clamps an oversized annotation comment so the record still decodes" fails with AssertionError: expected false to be true. A scratch test on main showed that encoding and decoding OrchestrationMessageContext with an 8,001-character comment both return 0 records and no error.
Green: vp test run src/lib/composerContextRecords.test.ts gives 15 passed.
vp run check:changed: format, lint, knip, typecheck (36 packages), test (3 files) and react compiler all pass.
Not checked: no real-client run. Mobile only forwards records that are already decoded, so it cannot produce an oversized annotation.
Reviewed with sol-loop: 1 round with GPT-6.1 Sol on high. Sol verdict: approved.
Created with Claude Opus 5.5 in Claude Code (T3 Code).
Macroscope's review found this PR approvable — Oversized preview annotation comments are now truncated with a visible marker to fit the existing 8,000-character limit, rather than being dropped from message context. Comments within the limit and the contract limit itself remain unchanged.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between 9a9e31a and 3396ffa.
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
No actionable comments were generated in the recent review.
Walkthrough
Preview annotation records now truncate trimmed comments to the shared 8,000-character limit. A test checks the truncation marker and verifies that the resulting record decodes.
The maximum comment length is exported and applied when creating preview annotation records. A test checks that an 8,001-character comment is truncated and the record decodes.
The change preserves oversized annotation comments without exceeding the record contract and is ready to merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the actual fix: long preview annotation comments were being dropped from the message, which matches the changeset. It uses a conventional commit prefix and plain language. At 81 charac…
Description check
The description follows the template well. It has Problem, Change, Scope and approval, and Verification sections. The problem and the change are explained clearly. The scope section explains why no pr…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the actual fix: long preview annotation comments were being dropped from the message, which matches the changeset. It uses a conventional commit prefix and plain language. At 81 characters it is slightly long but still clear and specific.
Full details: Description check
Explanation
The description follows the template well. It has Problem, Change, Scope and approval, and Verification sections. The problem and the change are explained clearly. The scope section explains why no prior issue exists and gives an overlap search. Verification gives the red/green test results, the check run, and what was not checked. The template asks for a linked triaged issue or explicit maintainer approval, or an explanation of why the fix qualifies without one. The author gives that explanation, so the section is complete. The template also asks for before/after screenshots for UI changes. This change is a logic fix with no visible UI change, so screenshots are not needed. The trailing agent-model line is present.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
CodeRabbit Verify
Run CodeRabbit Verify to test the changes in this pull request.
merged current main without rebasing at 3396ffa709. this includes main's fix for the failing Astro check:changed assertion. the annotation fix remains unchanged: 3 files, 12 additions, 2 deletions against main.
verified through blacksmith: vp run check:changed github/main passed formatting, lint, knip, affected typechecks and 24 tests; vp test run scripts/check-changed.test.ts passed all 15 tests, including the previously failing case. two independent source reviews found no blockers.
in chrome, seeded an oversized annotation in the composer and sent it through replay (dev). the websocket command and persisted message both retained the annotation with exactly 8,000 comment characters and the truncation marker. paid providers and native clients were not exercised.
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
size:XS0-9 changed lines (additions + deletions).vouch:trustedPR author is trusted by repo permissions or the VOUCHED list.
2 participants
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.
Problem
On desktop, the preview annotation box ("Describe the change…") accepts a comment of any length. The message contract caps a preview annotation's
commentat 8,000 characters. Web built the annotation's context record with the comment unchanged, so a long comment (for example, a pasted spec or log) made a record over the bound.Message context records decode as a forward-compatible array, so an invalid record is not an error. It is silently dropped on encode and decode. The user's annotation (comment, picked elements, screenshot link) never reaches the agent. The prompt still holds a link to a context record that no longer exists.
Change
previewAnnotationContextRecordnow runs the trimmed comment through the existingclampContextTexthelper withCOMPOSER_CONTEXT_PREVIEW_COMMENT_MAX_CHARS, which is now exported from contracts. Review comments already clamp their text and diff this way. A long comment keeps its first 8,000 characters and ends with the existing… truncated …marker.Scope and approval
Very small, focused fix for an obvious bug, so no prior issue: the contract bound and the clamp helper both exist, and the sibling review-comment record already uses them. 5 non-test lines.
Overlap search: local PR index and GitHub search for
previewAnnotationContextRecordand long annotation comments. Closest is #29804 (open), which clamps terminal context text and makesclampContextTextsurrogate-safe. This PR does not touch those lines, and that guard covers this caller once it lands. Other annotation PRs (#24573, #29716, #29287) fix unrelated desktop behaviour.The regression test is a new
itrather than an extension of "clamps an oversized review selection so the record still encodes", because #29804 rewrites that case.Verification
composerContextRecords.test.ts> "clamps an oversized annotation comment so the record still decodes" fails withAssertionError: expected false to be true. A scratch test on main showed that encoding and decodingOrchestrationMessageContextwith an 8,001-character comment both return 0 records and no error.vp test run src/lib/composerContextRecords.test.tsgives 15 passed.vp run check:changed: format, lint, knip, typecheck (36 packages), test (3 files) and react compiler all pass.Reviewed with sol-loop: 1 round with GPT-6.1 Sol on high. Sol verdict: approved.
Created with Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code