Skip to content

fix(pi): report blocked to herdr while a revdiff review is open - #410

Merged
umputun merged 2 commits into
masterfrom
pi-herdr-blocked
Oct 24, 2026
Merged

umputun merged 2 commits into
masterfrom
pi-herdr-blocked

Conversation

@umputun

@umputun umputun commented Oct 24, 2026

Copy link
Copy Markdown
Owner

revdiff_review ran revdiff through spawnSync, which froze pi's event loop for the whole review. The herdr pi integration sends its state over a socket on a later loop turn, so herdr showed the agent as working until revdiff exited.

The review now runs through an async spawn, the way pi runs its own external editor, and with HERDR_ENV=1 the tool emits herdr:blocked around it. The tool is marked executionMode: "sequential" because the frozen loop was what kept parallel tool calls off the terminal. A process exit hook sends SIGTERM to revdiff if pi shuts down mid-review, and a spawn error thrown synchronously (ENOEXEC for a binary the OS cannot run) takes the same launch-error path as the async ones.

The delivery test uses a real unix socket: the fake revdiff waits for the blocked payload to arrive, so it fails if the review blocks the loop again.

Follows the timing discussion in #319.

Fixed #318

revdiff_review ran revdiff through spawnSync, which froze pi's event loop for
the whole review. The herdr pi integration sends its state over a socket on a
later loop turn, so a blocked report could never reach herdr while the review
was open, and herdr showed the agent as working until revdiff exited.

The review now runs through an async spawn, the way pi runs its own external
editor, and with HERDR_ENV=1 the tool emits herdr:blocked around it. The tool
is marked sequential because the frozen loop was what kept parallel tool calls
off the terminal during a review. A process exit hook sends SIGTERM to revdiff,
so a pi shutdown in the middle of a review does not leave it running.

Fixed #318
spawn reports only EACCES, EAGAIN, EMFILE, ENFILE and ENOENT as an error event
and throws the rest. A revdiff binary the OS cannot run, such as a
wrong-architecture build, failed with ENOEXEC after tui.stop(), so pi stayed
unresponsive and the tool surfaced a raw exception. The throw now resolves as
the same launch error the event path reports.

Related to #318
Copilot AI balanced review requested due to automatic review settings October 24, 2026 17:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@umputun
umputun merged commit 038cd92 into master Oct 24, 2026
7 checks passed
@umputun
umputun deleted the pi-herdr-blocked branch October 24, 2026 18:02
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.

pi extension: herdr never shows the agent as blocked while a revdiff review is open

2 participants