Opus finding
formatPRComment truncation can cut a multi-byte character / leave dangling whitespace mid-word
lowbugmedium
- apps/web/lib/pr-comment.ts:60-63
truncate slices on UTF-16 code units. If a finding's reasoning contains a surrogate-pair character (emoji, some CJK, math symbols) exactly at position n-1, the slice will produce a lone surrogate and the resulting Markdown will contain an invalid Unicode character. This is a minor robustness issue rather than a correctness break, but it affects user-facing review comments that may quote source code with non-BMP characters.
Recommendation
Use Array.from(s) or Intl.Segmenter to count graphemes/code points, or guard with isHighSurrogate before slicing.