Skip to content

feat(send): agent picker lists Rex agents; an agent at a dialog gets no clipboard copy - #165

Merged
backnotprop merged 3 commits into
mainfrom
feat/rex-agent-picker
Nov 20, 2026
Merged

backnotprop merged 3 commits into
mainfrom
feat/rex-agent-picker

Conversation

@backnotprop

Copy link
Copy Markdown
Contributor

What it does

Inside Rex, the agent picker (P, and Send when nothing names a target) now lists every agent Rex runs, in every session and window, so a review opened from one agent can go to another.

  • Launched from an agent (rex open, rex last, rex review, including rex review <PR>), Send still goes to that agent with no question. P switches.
  • Started on its own in a Rex pane, the first Send asks which agent.
  • Works in document reviews, code reviews and PR reviews.

Captured in an 80-column split opened by plannotator-tui rex open --block <claude>, after P:

╭ send to which agent? ────────────────────────────────────────────────────────╮
│ claude · Fix login redi…  .         idle     work › api · 9ba798             │
│ codex                     ./src     working  work › api · 31496a             │
│ claude · Migrate styles   …ork/web  blocked  work › web · 63239c             │
│ claude · release          …k/notes  idle     side › Window 122adf3e · fd82e9 │
│ pi · π - notes            …k/notes  idle     work › web · eda7cc             │
╰ ↑↓ move · enter send here · esc close ───────────────────────────────────────╯

Each row shows:

  • the agent, with the pane's label if someone set one, else the title the agent set (spinner removed, cut to 28 characters);
  • its folder;
  • its state from Rex's program status. An agent that has not reported a state reads no state, and Send refuses it as the Rex launcher already does;
  • session › window · pane.

Agents in the review's own window come first, then agents in the review's folder, then by name. The review's own pane is never listed. A Pi session in a Rex pane is one row, sent over the Pi link and placed where Rex has it.

How Rex is read

Rex has no agent list, so the list is built from read-only calls:

  1. rex ls --json: sessions
  2. rex window ls -s <session> --json: windows, layers and blocks
  3. For each terminal block, rex do com.superlogical.terminal.process, …program_status and (agents only) …title, with -b <block> -s <session>. Up to 16 blocks are read at once.

A pick sends the same way a Rex launcher's target does: it checks the agent's process still runs in the block and is not blocked, pastes with block.event, and presses Enter.

Also in this PR

  • An agent at a dialog no longer gets a clipboard copy. Choosing an agent that is blocked at a dialog used to copy the feedback to the clipboard while keeping the notes pending. Now nothing is sent or copied, the notes stay pending, and the screen says the agent is at a dialog; E retries. This applies to every agent target (Herdr, Rex, herdr-core, a delivery command's exit 75) in document and code reviews. A missing agent still copies. Decision 13 in docs/decisions.md is amended, and the README and Herdr spec are updated.
  • In tests, Clipboard records instead of writing OSC 52, so no test touches a terminal clipboard.
  • Narrow panes keep the place column. Picker rows wider than the pane shorten the folder from the left, then the name from the right, so the state and the place stay on screen.

Testing

  • cargo fmt --check, cargo clippy --locked --workspace --all-targets -- -D warnings and cargo test --locked --workspace pass on macOS. A check-only cargo clippy --target x86_64-pc-windows-msvc --workspace --all-targets -- -D warnings, with a stub C compiler, passes too.
  • Fixture tests use Rex replies recorded from Rex 0.1.0-preview.22, with stand-in agents and paths rewritten. They go through a fake rex and cover:
    • parsing and ordering;
    • the own block and own window;
    • titles, labels and states;
    • only reads while listing;
    • P from a document review, a code review and a PR review launched from an agent;
    • Send asking when nothing names a target;
    • no state;
    • a blocked agent, for both Herdr and Rex in both review kinds: no paste, no copy, the note still pending;
    • rex review 7 --block passing the block's agent to the split.
  • End to end, against an isolated Rex server (its own socket, home, state and data folders) with stand-in claude, codex and pi programs that report state and set a title:
    • a review started in a shell pane: Send opened the picker and delivered to the Claude;
    • rex open from a Claude: P → Codex received the note and the Claude got nothing;
    • rex review (local changes): P → a Claude in another Rex session received the code feedback;
    • picking the blocked Claude pasted nothing.
  • Not tested end to end:
    • real Claude Code, Codex or pi in Rex: their real titles and state reports;
    • rex review <PR> in a live Rex (fixture and binary level only);
    • the no-copy behavior for a blocked agent in a live terminal (unit tests only);
    • the Rex app's own tab names. Default window labels like Window 122adf3e are shown as Rex's server reports them.

Inside Rex (REX_SESSION set), the agent picker lists every block with an
agent, built from Rex reads only: rex ls, rex window ls per session, and
each terminal block's process, program_status and title methods. Rows show
the agent with the block's label or the title the agent set, its folder,
its state, and session › window · block. The review's own block is left
out, the agents in its window come first, and a Pi the Pi link already
lists is shown once. A Rex pick sends as a launcher's target does.

A review launched from an agent still sends there without asking; P
switches to another agent, in document and code reviews alike. Rows wider
than the pane shorten the folder, then the name, so the state and place
stay in view.

Tests read recorded Rex replies (tests/fixtures/rex-agents) through a fake
rex.
Choosing or targeting an agent that is blocked at a dialog no longer copies
the feedback to the clipboard: nothing is sent, the notes stay pending, and
the screen says the agent is at a dialog. A missing agent still copies.
Applies to Herdr, Rex, herdr-core and delivery commands, in document and code
reviews (decision 13, amended). In tests the clipboard only records what it
would copy.

Rex rows for an agent that has not reported its state now say "no state",
and a Pi session running in a Rex pane shows the pane's place.
… agent target

A PR review opened beside a Rex agent lists the other Rex agents under P and
sends the PR feedback to the one picked. rex review 7 --block passes the
block's agent to the split as its Send target. Adds the Rex finder to the
PR review's Herdr picker test.
@backnotprop
backnotprop added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit e245d8e Nov 20, 2026
3 checks passed
@backnotprop
backnotprop deleted the feat/rex-agent-picker branch November 20, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant