Skip to content

fix(coding-agent): Herdr error replies and herdr:busy - #214

Merged
Kushalkhemka merged 3 commits into
pi-boltfrom
fix/herdr-reports
Oct 30, 2026
Merged

Kushalkhemka merged 3 commits into
pi-boltfrom
fix/herdr-reports

Conversation

@Kushalkhemka

Copy link
Copy Markdown
Member

Fixes #200, closes #201.

#200: Herdr errors counted as delivered reports

  • socketTransport read any data as success. It now buffers the reply until it has the complete line with the request's id: result is success, error (e.g. resume_not_accepted) or a malformed reply is failure, and lines for other ids are skipped. The issue's repro now returns false.
  • The reporter makes its second try after an error. Each try gets a fresh seq, because Herdr may have applied a try whose reply was lost and would refuse the same seq again.
  • When the newest report fails both tries, last is cleared, so the next publish() sends that state again even if it has not changed. There is no timer or loop, so a failure costs nothing until the next event.

#201: herdr:busy from pi-subagents

  • herdr:busy { active } is a level flag next to the subagents:* run ids. The pane shows working while either is set, so the same runs reported both ways count once, and it goes idle only when both say done. Blocked still takes precedence.
  • pi-subagents relabels by emitting { active: false } and then { active: true } synchronously. The publish is deferred to a microtask so the pane does not report idle in between.
  • Only the parent pane's state changes. Children get no Herdr entries.

Tests (packages/coding-agent/test/herdr-extension.test.ts, local Unix sockets only)

  • Transport: an error reply is false. Only the complete reply with the matching id counts, including replies split across chunks, an unrelated line first, a truncated reply, and a reply with no trailing newline. Also unit tests for herdrAnswer.
  • Reporter: a refused report is tried twice with increasing seqs and not retried on its own. It is sent again on the next publish, and not again after Herdr accepts it.
  • herdr:busy: shows working and survives a relabel with no idle report in between. Blocked takes precedence. Combined with subagents:*, the pane goes idle only after both report done.
  • npm run check is clean.

The socket transport took any data as success. It now reads the complete answer line with the request's id: a result is success, an error (such as resume_not_accepted) is not, so the second try runs. Each try gets its own seq.

When the newest report does not get through, the reporter forgets it as reported, so the next publish sends that state again. Nothing retries on a timer.
pi-subagents (nicobailon) emits herdr:busy { active: true, label } while its background runs go and { active: false } after. The parent pane now reports working while it is active, under herdr:blocked as before.

herdr:busy is a flag beside the subagents:* run ids, so the same runs reported both ways keep the pane working once and it goes idle when both say done. pi-subagents relabels by sending false then true at once; the report waits for the end of the tick so the pane does not show idle in between.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aab21d3dd9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T21:58:54.779749Z aab21d3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

A report whose first try failed after session_shutdown made its second try with a fresh seq above pane.release_agent's, so the stale report took the pane back. A try is now made only while the session is reporting.
@Kushalkhemka
Kushalkhemka merged commit 49a0b40 into pi-bolt Oct 30, 2026
18 checks passed
@Kushalkhemka
Kushalkhemka deleted the fix/herdr-reports branch October 30, 2026 22:28
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.

Support pi-subagents' herdr:busy signal in the built-in Herdr reporter Herdr socket errors count as successful state reports

2 participants