Repository navigation
fix(send): redraw when the agent finder answers, so Send asks without a key press - #175
Merged
Merged
Conversation
… a key press A review opened on its own inside Rex or Herdr showed "Copy 0 new (E)" until the next key, then switched to "Send 0 new ▸ choose agent (E)". The agent finder thread stored its answer in an atomic and nothing told the event loop: the document loop only redrew after a key or a poll that reported a change, and the code review's tick did not look at the finder. Reach now records when the first look answers. Both loops take that as a screen change (App::poll_background, Screen::tick). The code review's finder pokes the loop's wake channel, so the header updates at once; the document loop cannot be woken from another thread, so it waits 25 ms instead of 250 ms while the finder looks, as it already does for the background layout and file search, and goes back to 250 ms once it answers. The background layout merge now also reports a change, so its frame is drawn without waiting for a key. Pi notes and the "changed on disk" notice already reported theirs.
backnotprop
force-pushed
the
fix/send-label-redraw
branch
from
November 20, 2026 03:44
7fe81c4 to
a72e947
Compare
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a review is opened on its own in a Rex or Herdr pane (nothing names an agent), the Send button read "Copy 0 new (E)" until the next key press, then switched to "Send 0 new ▸ choose agent (E)".
Cause: the agent finder thread (
Reach::start_withinui/agent_picker.rs) stored its answer in an atomic and told no one. The document loop (cli.rsevent_loop) only redraws after a key or a poll that reports a change, and the code review'sScreen::ticknever checked the finder.Fix:
Reachrecords when the first look answers.Reach::pollreturns true once for that answer, andReach::lookingsays whether the look is still running.App::poll_backgroundcollects every background poll (layout, file search, disk, Pi, finder) and the loop redraws when any of them changed something. The loop cannot be woken from another thread, so while the finder looks it waits 25 ms instead of 250 ms, the same as it already does for background layout and file search. After the answer it goes back to 250 ms.Screen::tickincludesReach::poll, so the header updates right away.DocLayout::poll) also reports a change now. It was the only other background result whose change the loop ignored. Pi notes and the "changed on disk" notice already reported theirs.Tests: new Unix-only tests for document and code reviews, against the fake
rexandherdrscripts. A gate holds the first look open while the header reads "Copy 0 new"; the gate opens, the loop's poll (or wake) reports the change with no key, the header then reads "Send 0 new ▸ choose agent", and later polls are quiet. The layout poll also has a test.Checked in the real binary in tmux, using fake
rexandherdrand a scratch HOME and data folder. Header 0.5 s after opening, with no key pressed:Idle CPU after the fix: no CPU time used over 10 s, in both the document and the code review.