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
Follow-up from PR #5577 (#5567, whole-block draft matching). Two normal-review findings on its head 7037a70e83, deferred because the PR's review budget was spent. Both are in removeDraftBlock (src/common/utils/composerDraftText.ts).
Indentation counts as a block boundary.whitespaceRun skips the same-line indentation before it counts the blank line, so in alpha\n\n yes\n\nomega an indented code line yes matches a send yes. mergeWrite can then take that line out of a window's write as a stale copy, and observeSends marks it inUnsavedText. Before 🤖 fix: match a send's text in the draft merge only as a whole block #5577 the middle check (\n\n<block>\n\n) did not match it, but the end checks (removeSentText) did. Fix: only whitespace on separator lines may sit between the block and the blank line. Indentation or trailing spaces on the block's own line must prevent the match.
Per-occurrence scan cost. The loop visits every occurrence of the block. A near-limit draft (MAX_DRAFT_JSON_CHARS) of millions of a with a send a and no whole-block match runs the loop millions of times, for each pending send in mergeWrite, on the backend event loop. Fix: search only separator-delimited candidates (for example, look for \n + block and check the edges), so the work is bounded by line count.
Both need the send's text to equal a line of the user's draft (1) or a pathological draft (2). Neither was reported by a user.
Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $5.67
Follow-up from PR #5577 (#5567, whole-block draft matching). Two normal-review findings on its head
7037a70e83, deferred because the PR's review budget was spent. Both are inremoveDraftBlock(src/common/utils/composerDraftText.ts).whitespaceRunskips the same-line indentation before it counts the blank line, so inalpha\n\n yes\n\nomegaan indented code lineyesmatches a sendyes.mergeWritecan then take that line out of a window's write as a stale copy, andobserveSendsmarks itinUnsavedText. Before 🤖 fix: match a send's text in the draft merge only as a whole block #5577 the middle check (\n\n<block>\n\n) did not match it, but the end checks (removeSentText) did. Fix: only whitespace on separator lines may sit between the block and the blank line. Indentation or trailing spaces on the block's own line must prevent the match.MAX_DRAFT_JSON_CHARS) of millions ofawith a sendaand no whole-block match runs the loop millions of times, for each pending send inmergeWrite, on the backend event loop. Fix: search only separator-delimited candidates (for example, look for\n+ block and check the edges), so the work is bounded by line count.Both need the send's text to equal a line of the user's draft (1) or a pathological draft (2). Neither was reported by a user.
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$5.67