Skip to content

Push agent status changes via per-pane event subscriptions - #20

Merged
powerfooI merged 1 commit into
mainfrom
fix/agent-status-push
Aug 20, 2026
Merged

Push agent status changes via per-pane event subscriptions#20
powerfooI merged 1 commit into
mainfrom
fix/agent-status-push

Conversation

@powerfooI

Copy link
Copy Markdown
Owner

Follow-up to the multi-connection support in #18.

Problem

Agent running-status transitions (working/idle/done) had no push channel. Herdr emits pane.agent_status_changed only through per-pane parameterized subscriptions, which the bridge never made, so status sync relied solely on the 1s pane.list poll. Browsers throttle timers in hidden tabs, so an agent could stay showing a stale status (e.g. idle after starting work) until the tab regained focus.

Changes

  • Bridge: new per-connection subscription loop (server/src/connections/agent-status-subscription.ts) that tracks panes with a detected agent. The pane set is seeded from pane.list and rebuilt on pane_agent_detected/pane_closed/tab_closed/workspace_closed with a debounced wake plus a fallback poll; membership changes requested mid-RPC are never lost, and transient subscribe failures retry without killing the loop.
  • Bridge: HerdrClient.subscribe accepts parameterized subscriptions (e.g. { type, pane_id }).
  • Web: accept dot-named events whose wire data has no type field (previously dropped by validation).
  • Web: refresh metadata immediately when the page becomes visible, the window regains focus, or the network comes back online.

Verification

  • bun run format, bun run lint, bun run typecheck (web + server)
  • bun run test: 558 pass, including 10 new subscription-loop cases (rebuild races, retry, stop) and event-validation coverage
  • Live end-to-end against herdr 0.8.0: status transitions reach the UI in ~0.1-0.5s instead of waiting for the next poll

Agent status transitions had no push channel: herdr emits
pane.agent_status_changed only through per-pane parameterized
subscriptions, so sync relied on the 1s pane.list poll and stalled in
background tabs.

- bridge: maintain a per-connection subscription that tracks panes with
  a detected agent, rebuilt on membership events with a fallback poll
- web: accept dot-named events without data.type and refresh on
  visibility/focus/online
@powerfooI
powerfooI merged commit 0ef3461 into main Aug 20, 2026
1 check passed
@powerfooI
powerfooI deleted the fix/agent-status-push branch August 20, 2026 06:18
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