Same-status content changes produce no signal — how should consumers detect "screen changed but agent_status didn't"? #2831
waynewu411
started this conversation in
Ideas
Replies: 1 comment
|
Following up on the fork-side issue that led to this post — I've since found that this problem family already has substantial prior art here that my earlier search (issues only) missed:
My post's specific angle — the same-status blind spot ( |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
pane.agent_status_changed(andagent wait --until <state>) is edge-triggered on coarseAgentStatusvalue equality. Two consecutive same-status screens with genuinely different content produce zero events —blocked→blocked,working→working,done→done, etc.Motivating case: a pane is
blockedon approval dialog #1; the dialog is dismissed and immediately replaced by a different pending approval dialog (tool call #2 of a queued batch). No event fires, and a caller has no way to tell the pane moved on to a different question.Impact
Any consumer built on
pane.agent_status_changedoragent wait --until <state>silently misses every same-status transition whenever the underlying screen content changes without an intervening different status. Theblocked→blockedcase is the sharpest: a human or supervising agent believes the pane is still waiting on the original question when it has moved to an unrelated one.Not hypothetical for me: I orchestrate an agent team locally on top of these primitives. A public Herdr plugin (waynewu411/herdr-event-log) hooks
pane.agent_status_changedand persists each event to a durable, cursor-resumable log; an orchestrator (scripts/herdr-ewait.sh) tails that log and re-verifies every hit againstherdr agent get. The blind spot defeats both layers: no event means no log line, and the verification sweep seesagent_statusstay constant — so even theagent getre-check can't tell dialog #1 was replaced by a different question. Today the only reliable detection is diffing raw pane content by hand.Candidate directions
AgentInfo(implemented) — the screen detector already bumps a counter once per non-empty PTY read batch; expose it asAgentInfo.detection_content_seq: Option<u64>, parallel torevision. Pollers ofagent get/agent listcompare it across reads to detect "screen changed, status didn't". Minimal API surface; no event-semantics change. Fits the periodicagent getverification sweep in my consumer above (bounded latency up to the sweep interval), but it is invisible to purely event-driven consumers and doesn't restore event immediacy.pane.output_changed— the event kind already exists in the schema (EventData::PaneOutputChanged { pane_id, workspace_id, revision: u64 }) but is never emitted by any production code path; plugin manifests hooking it currently get a link-time warning. Wiring it to the detector's counter would give subscribers a real content-change event.agent read) for specifics. It could optionally carryagent_status(and other state metadata, mirroringpane.agent_status_changed) so consumers don't need a follow-upagent getfor status.pane.agent_status_changeditself re-fires on same-status content changes. Most faithful to today's contract, but touches the per-pane detection hot loop and ~40StateChangedcall sites.Orthogonal note: durability
Replacing the file-log pattern entirely is a separate question:
events.subscribeis live-only with no history, which is exactly why the plugin exists (the server invokes hooks for the session's life, giving durable, resume-from-any-offset history). A server-side event history/replay API would be an independent feature, orthogonal to the content-change signal above.Related prior art
pane.updated), different event kind.Full implementation, tests, and docs for option 1 are in waynewu411/herdr#2 (the fork-side issue waynewu411/herdr#1 has the detailed root-cause trace). I implemented option 1 as the minimal step, but as the author of the event-log consumer above my preference leans toward direction 2; happy to adapt.
All reactions