Repository navigation
fix(rex): find the session from REX_BLOCK when REX_SESSION is unset - #213
Merged
Merged
Conversation
Rex server 0.1.0-preview.23 stopped setting REX_SESSION in new terminals. The review pane then had no session, built no send target, and Send fell back to the clipboard. A block's ID names its session anywhere Rex takes one, so fall back to REX_BLOCK. The agent picker compares the review's session with the session IDs in `rex ls`, and a block ID is never one of them. When the review's ID is not in that list, the picker reads its window list once. That list gives the real session ID, and the picker uses the same list for the session's agents, so the review's session shows once and first. Fixes plannotator#212
micmcg
force-pushed
the
fix/rex-session-from-block
branch
from
November 26, 2026 09:40
6f2097f to
dfb208c
Compare
…w list fails When the review's ID is not in `rex ls` and its window list cannot be read either, the picker returned no agents, even though `rex ls` named other sessions. List those, as for any unreadable session.
A Rex launcher names a block only when it found an agent there. When the review pane could not build that target, Send fell back to the clipboard without a word, which is how plannotator#212 went unseen. Such a pane now gets a target that says `claude · not found`, refuses with the reason, copies the feedback and keeps the notes pending. A gated review still hands its decision to the caller.
…ed ✓ Before a send in this session, the Send button read `Sent ✓` for notes that had only gone to the clipboard, and `Sent ✓ ▸ agent` once a target was found. It now reads the review's last delivery: copied notes say `Copied ✓`.
backnotprop
approved these changes
Nov 26, 2026
backnotprop
left a comment
Contributor
There was a problem hiding this comment.
Thanks @micmcg. You tracked this down to Rex's REX_BLOCK change and fixed it cleanly, and handling block IDs in the agent picker was a careful touch. I added a few small follow-ups on top: Send now says so when a Rex review can't reach its agent, and a reopened review whose notes were only copied says Copied ✓, not Sent ✓. Going out in 0.12.1.
This was referenced Nov 26, 2026
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.
Send in a Rex review reaches the agent again with Rex server 0.1.0-preview.23 and later. Before this fix, the feedback always went to the clipboard. Fixes #212.
Problem
From preview.23 on, Rex sets only
REX_BLOCKin a new terminal, notREX_SESSION. plannotator-tui read the session fromREX_SESSIONalone. The review pane that a launcher opens gets no--session, so it built no send target and fell back to the clipboard. The launcher, run from an agent's shell without--session, also stopped with "no Rex session".Change
session_frominsrc/rex/command.rsreadsREX_SESSIONand falls back toREX_BLOCK. Rex accepts a block ID wherever it takes a session, so everyrex … -scall works unchanged.Rex::from_lookupuses it. So does the agent picker (RexAgents::from_lookup), the list of agents thatPopens in a review.rex ls.rex lslists sessions by their session IDs, so a block ID is never in the list. When the review's ID is not in the list, the picker readsrex window ls -s <id> --jsononce. That reply names the real session ID and holds the session's windows, so the picker uses it for that session's blocks and does not read it again. Without this step, the review's session would show twice in the picker.rex window lsfinds a window list by any ID in it, with a fixed-string match, so a test can pass a block ID.docs/spec-pi-link.mdsays the picker works whenREX_BLOCKorREX_SESSIONis set.The picker change in
RexAgents::list(src/rex/agents.rs) is the part to review most closely. Ifrex lsfails and the window read also fails, the picker lists no agents, as it did before.plannotator-tui rex open --block <block>run outside Rex without--sessionstill stops with "no Rex session". The Rex Annotate actions always pass--session, so this PR leaves that case alone.Verification
cargo fmt --all --checkcargo clippy --workspace --all-targets: no warnings in the codecargo test --workspace --no-fail-fast: all pass exceptpi::tests::the_review_command_puts_pis_screen_back_and_ends_the_review_with_pi, which also fails onmain(bec83aa) on this Macrex lslists. With the sort removed, the test fails.plannotator-tui rex review --commit <sha>with no--sessionopened the review. A note sent withSarrived in Claude's prompt and was submitted. With 0.12.0, the same steps put the feedback on the clipboard.