fix(setup): drain residual events and filter key kind in onboard prompts (#937)#949
Conversation
…pts (nearai#937) On Windows, single keypresses during `ironclaw onboard` are registered twice, causing channel/tool selection to skip or toggle incorrectly. Two root causes: 1. select_many() had no residual event drain, so Enter from a prior prompt was immediately consumed on entry, skipping the selection. 2. Neither select_many() nor read_secret_line() filtered on KeyEventKind::Press, so Windows Key Release/Repeat events caused every keypress to fire twice (Space toggles cancel out, Enter triggers double-advance, arrows jump two positions). Extract a shared drain_pending_events() helper (replacing the inline drain in read_secret_line from nearai#849), add it to select_many() entry, and filter both event loops to only handle KeyEventKind::Press. Fixes nearai#937 [skip-regression-check]
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a crucial fix for input handling within interactive setup prompts, particularly on Windows. By ensuring that residual events are cleared and only valid key press events are processed, it resolves issues where user input was misinterpreted or double-counted, significantly improving the reliability and user experience of the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
616a71b to
e362d9c
Compare
zmanian
left a comment
There was a problem hiding this comment.
Review: fix(setup): drain residual events and filter key kind in onboard prompts (#937)
Verdict: APPROVE
Clean, small fix. Only touches src/setup/prompts.rs.
Correctness
- Extracts the existing inline drain from
read_secret_line()into a shareddrain_pending_events()helper -- DRY - Adds the same drain to
select_many()entry, which was missing it - Adds
KeyEventKind::Pressfiltering to bothselect_many()andread_secret_line()-- this is the canonical crossterm pattern for Windows where Release and Repeat events are a well-known footgun - The fix correctly prevents double-firing that caused channel/tool selection to skip or toggle incorrectly
Note
Author only checked cargo fmt in the validation checklist, not clippy or tests. The change is straightforward but please confirm CI is green before merging.
No code issues found.
|
I see it's already approved — is this good to merge? |
…pts (nearai#937) (nearai#949) On Windows, single keypresses during `ironclaw onboard` are registered twice, causing channel/tool selection to skip or toggle incorrectly. Two root causes: 1. select_many() had no residual event drain, so Enter from a prior prompt was immediately consumed on entry, skipping the selection. 2. Neither select_many() nor read_secret_line() filtered on KeyEventKind::Press, so Windows Key Release/Repeat events caused every keypress to fire twice (Space toggles cancel out, Enter triggers double-advance, arrows jump two positions). Extract a shared drain_pending_events() helper (replacing the inline drain in read_secret_line from nearai#849), add it to select_many() entry, and filter both event loops to only handle KeyEventKind::Press. Fixes nearai#937 [skip-regression-check]
…pts (nearai#937) (nearai#949) On Windows, single keypresses during `ironclaw onboard` are registered twice, causing channel/tool selection to skip or toggle incorrectly. Two root causes: 1. select_many() had no residual event drain, so Enter from a prior prompt was immediately consumed on entry, skipping the selection. 2. Neither select_many() nor read_secret_line() filtered on KeyEventKind::Press, so Windows Key Release/Repeat events caused every keypress to fire twice (Space toggles cancel out, Enter triggers double-advance, arrows jump two positions). Extract a shared drain_pending_events() helper (replacing the inline drain in read_secret_line from nearai#849), add it to select_many() entry, and filter both event loops to only handle KeyEventKind::Press. Fixes nearai#937 [skip-regression-check]
Summary
On Windows, single keypresses during
ironclaw onboardare registeredtwice, causing channel/tool selection to skip or toggle incorrectly.
Two root causes:
select_many() had no residual event drain, so Enter from a prior prompt was immediately consumed on entry, skipping the selection.
Neither select_many() nor read_secret_line() filtered on KeyEventKind::Press, so Windows Key Release/Repeat events caused every keypress to fire twice (Space toggles cancel out, Enter triggers double-advance, arrows jump two positions).
Extract a shared drain_pending_events() helper (replacing the inline
drain in read_secret_line from #849), add it to select_many() entry,
and filter both event loops to only handle KeyEventKind::Press.
Change Type
Linked Issue
Fixes #937
Validation
cargo fmtcargo clippy --all --benches --tests --examples --all-featuresSecurity Impact
None
Database Impact
None
Blast Radius
Rollback Plan
Review track: