Repository navigation
fix(chat): stop Up at the top line of a non-empty composer instead of recalling history - #31852
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks: on screen, the PR only shortens one settings hint, and the new hint matches the new behaviour. No control was added or moved, so there is nothing a screenshot would need to show. Notes
[UX-REVIEWED] 37aab77 Description read[DESCRIPTION-READ] d9575ca53bc7ad626fd9844b79ac379305d549c59e72c3a438b7a2fc6fb498c8 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: this is a reversible keyboard-rule change made at the one rule both composers share, and the description says it changes a deliberate behaviour. Notes
[DESIGN-REVIEWED] 37aab77 Description read[DESCRIPTION-READ] 34cb1e399342213e49f321001a1c9268012f02752fe98788c9aed0e919534530 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix is made where the rule lives, the one shared Notes
What this change shipsInventory (7 items) — 5 justifiedIntent: stop Up from replacing a multi-line draft with an old prompt when the user is only moving the caret. FIX (#31851).
[FIRST-PRINCIPLES-REVIEWED] 37aab77 Description read[DESCRIPTION-READ] 2f4b4f253d661ec2f947fbb2f9d877bc554520462b7d6e10a37debdcbe024cef That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
fa7496c to
b5b6606
Compare
b5b6606 to
2985703
Compare
2985703 to
f2bfa89
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Approving f2bfa89ee5. Sorry this waited a week for a review, @cruisercohen.
promptHistoryKeyEngagesnow recalls on ↑ only from an empty composer or while already browsing, so a draft with text or a paste chip is never replaced. Theevent.repeatspecial cases inLexicalComposerInput.tsxanddraftHistory.tsare no longer needed and are gone in both places, so the two composers stay in step.- The tests cover the empty, draft, paste-chip and browsing cases in both composers, and the frontend shards pass.
The only red is Coverage Gate, on src/kiro_crew/agent_ipc_client.py (75.7%). This PR does not touch that file; it is a main-side gap from when CI ran. I re-ran the failed jobs, and auto merge is on.
Up recalls a sent prompt only from an empty composer. With a draft (typed text or a paste chip), Up only moves the caret and stops at the top line, so pressing it past the first line no longer replaces the draft. The Recall Sent Messages with Arrow Keys hint no longer promises recall with the cursor at the start of a draft. Builds on #31488, whose paste-block restore path is kept unchanged. Fixes #31851
f2bfa89 to
37aab77
Compare
Problem / Motivation
Goal: when the composer holds any text or a paste chip, Up only moves the caret and stops at the top line. It never recalls history. An empty composer still recalls past messages.
With a draft typed, Up jumped to history once the caret reached the very start of the draft. On a multi-line draft that is one press too many from line 1: the user presses Up to reach the top line, overshoots, and the draft is swapped for an old prompt.
Builds on #31488 (bolichen97), which fixed the lost-paste half of #31851 by carrying paste blocks through recall and back to the draft. This PR keeps all of that code unchanged.
Why it matters
Anyone who writes multi-line prompts uses Up to move around them. One extra press replaces their work.
Not a goal
draftPastes/composerPastes) is untouched here.What changed (motivation → approach → change)
This is a UX change to an existing keyboard behavior, so it may need a maintainer's UX look.
Root cause:
promptHistoryKeyEngages(website/src/components/composerPromptHistory.ts), the one rule both composers (textarea and rich-text) use, let Up engage history outside browsing when the caret was at position 0 of a non-empty draft.Change: outside browsing, Up engages history only when the composer is empty. A paste chip counts as content, because its marker is part of the composer text. With a draft, Up returns without claiming the key, so the browser moves the caret and it stops on line 1.
The held-key guard (
e.repeatover a draft) indraftHistory.tsandLexicalComposerInput.tsxis removed: the rule above already refuses that case, so the lines could no longer run. The dashboard feature list now says recall works from an empty composer, and the Recall Sent Messages with Arrow Keys hint (#31409) drops "or with the cursor at its very start" in every locale; the settings registry and command-palette index are regenerated from it.Effect on #31488's draft restore path: the keyboard no longer reaches it with a non-empty draft. Browsing now starts only from an empty composer, so Down past the newest entry restores that empty draft. The restore code (
draftPastes,composerPastes,stepTo) stays as #31488 wrote it, and its behaviour is still covered by a directstepPromptHistorytest (below).IME composition, Shift/Alt/Meta/Ctrl+Up, open pickers and send-mode handling are checked before this rule in both composers and are unchanged.
Backwards compatibility
Compatible: nothing that is stored or sent changes; only which keypress recalls history.
Reader: website/src/components/chat-input/draftHistory.ts:usePromptHistory.recall -- chat -- textarea composer; empty-box recall and browsing unchanged (ChatInput.test.tsx prompt history suite)
Reader: website/src/components/LexicalComposerInput.tsx:navigateHistory -- chat -- rich-text composer; same rule (LexicalComposerInput.test.tsx history tests)
Tests
New or changed, all failing on main (16 cases) and passing here:
composerPromptHistory.test.ts:promptHistoryKeyEngagesrefuses Up over a draft (caret at start, on line 1, paste chip only) and keeps walking older on a recalled prompt's first line.ChatInput.test.tsx: Up never recalls over a typed draft (held or fresh); Up past line 1 of a multi-line draft stays; a chip-only draft is kept; an edited recall no longer recalls on Up, and recall works again once cleared.LexicalComposerInput.test.tsx: the same for the rich-text composer, including a real paste chip whose block survives Up.ChatInput.terminalMenus.test.tsx: a literal!command draft stays as typed on Up.ChatPane.pasteSidecar.test.tsx(fix: keep paste chip content when up/down recalls a prompt #31488's test): its "Down back to the draft restores its paste blocks" case pressed Up over a chip draft to enter history. It now checks that Up keeps the chip draft and that sending it still carries the pasted lines.Kept coverage of #31488's restore path:
composerPromptHistory.test.ts: new "hands the saved draft back with its paste blocks past the newest" callsstepPromptHistorydirectly. It passes on main too; it is there so the restore code stays tested.Tests that started browsing from a typed draft now start from an empty composer and expect Down past the newest entry to return to it.
Run locally on this branch: the five files above, 243 tests pass; on main's source with these tests, 16 fail.
tsc -p tsconfig.app.jsonand eslint on the touched files pass.Manual verification
Not run in a browser. Suggested check: type two lines, press Up three times from the end of line 2; the draft stays. Clear the box, press Up; the last prompt comes back.
Screenshots / video
Why no screenshot: Only which keypress recalls history changes; nothing renders differently.
Related Issues
Fixes #31851
Sibling sweep
Swept: git grep -n "promptHistoryKeyEngages|stepPromptHistory" -- website/src
Sibling: website/src/components/chat-input/draftHistory.ts -- changed here
Sibling: website/src/components/LexicalComposerInput.tsx -- changed here
Pattern harvest
Not generalizable: one shared keyboard rule had a single extra case; it is fixed at that rule.
Checklist
Contribution License Agreement
Contributed under the project's Apache-2.0 license.