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
AI code review — automated review for reference, author can ignore or act on any point.
Clean fix for the queue-starvation problem — the single-flight loop with last-write-wins coalescing is the right shape, and it's covered by a focused concurrency test. Two small things:
Highlight now clears even if the queued write fails — packages/tui/src/app.tsx:579-581 calls copySelection(text) (fire-and-forget) and then renderer.clearSelection() synchronously, whereas the old code awaited the write before clearing. A failed clipboard write therefore leaves the user with no highlight, no retry affordance, and only an async toast. Consider clearing inside the drain's completion path (or keeping the old ordering when there's no contention).
Superseded-write errors are silently dropped — in packages/tui/src/util/selection.ts:38 the continue skips both the success and error toast for any write that got overtaken. That's presumably intended ("only the newest matters"), but a persistent environment failure (e.g. clipboard service down) will surface exactly one error per burst instead of per attempt; a brief comment stating the intent would prevent someone "fixing" it later. Also consider guarding the toast.* calls so an unexpected throw can't escape drain() as an unhandled rejection from the void drain() at line 51.
Minor: the new test exercises only the success path (packages/tui/test/selection.test.ts) — a case where the final write rejects (asserting toast.error fires once) would pin down branch at line 39.
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
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.
Summary
Testing
bun test test/selection.test.ts test/clipboard.test.tsbun typecheckValidation needed
Filip will validate the original rapid mouse-selection freeze on Windows/PowerShell.
Requested by: @neriousy (Filip via Slack)