(triggers): report a dialog when a wait ends on a blocked session (#379) - #420
Conversation
A trigger that gave up waiting said only "timeout waiting for idle" even when the CLI descriptor read waiting, a dialog nobody answered. The single-trigger wait, a chain's first wait and a chain step's busy-fall now use the same dialog probe as the readiness wait and put the dialog reason in the result. Nothing written into the PTY changes. Closes #379
|
Reviewing |
devsuitup
left a comment
There was a problem hiding this comment.
Adversarial review at ff2c98c: 0 blocking. Moving waitForCliIdleAfter onto createDialogProbe causes no drift: the #414 mutations still go red (ready past the deadline, vanished descriptor, post-compact anchor). The reasons are accurate: REASON_DIALOG_OPEN appears only where nothing was written, and ..._AFTER_WRITE only on the busy-fall timeout. The extra descriptor reads do not feed any decision. Non-blocking: (1) waitForIdle samples only while _cliBusy is true, so a dialog shown while _cliBusy reads false is neither held back nor reported. That is the open half of #379 (single triggers, sendInput), which is why this PR says Refs. (2) No test covers a busy-fall dialog that closed before the deadline, or a later chain step.
Second half of #379: a blocked session tells its driver.
#414 made a chain step's readiness wait report a dialog (descriptor
waiting) withREASON_DIALOG_OPEN. The other waits that can end a trigger on its deadline still said only "timeout waiting for idle". They now report it too, through one shared probe (createDialogProbe) thatwaitForCliIdleAfteralso uses.wait: "idle"and a chain's initial wait:reasonisREASON_DIALOG_OPENwhenwaitingwas sampled in the last settle window of a timed-out wait; otherwise the old reasons.errorstayschain timeout, andreasonis "the CLI reports a dialog open (waiting) while the turn was awaited; the step had been written" when a dialog was seen. No reason is added otherwise.waitForIdlereads the descriptor only while the session reads busy, so an idle session costs no extra read (an existing readiness test counts reads; it caught my first version).Docs:
docs/automation.md(result fields),.ai/contexts/trigger-watcher.md, CHANGELOG.Tests:
test/trigger-blocked-session.test.js, 9 cases (dialog / busy / no descriptor / dialog closed long before, for single, chain initial wait, busy-fall). Before the change 3 fail (the three dialog cases), 6 pass; after, all pass. Mutations, each turning at least one test red: window ignored, single reason dropped, chain-initial reason dropped, busy-fall reason dropped,waitForIdleresult withoutwaitingSeen, probe sampling the wrong status,waitForBusyFallresult withoutwaitingSeen.Not covered: the submit-verify timeout (
submitWithVerify) still reports a barechain timeout. Not verified against a real CLI.task check: lint 0 errors, 2955 pass; one flake (real git: a file whose name contains "..") that passes when rerun alone.This does not close #379. Single triggers and typed input (
sendInput) are still not held back while the CLI shows a dialog: #414 covers chain steps only.