Skip to content

(triggers): report a dialog when a wait ends on a blocked session (#379) - #420

Merged
devsuitup merged 1 commit into
mainfrom
fix/379-blocked-session-reason
Oct 2, 2026
Merged

devsuitup merged 1 commit into
mainfrom
fix/379-blocked-session-reason

Conversation

@devsuitup

Copy link
Copy Markdown
Owner

Second half of #379: a blocked session tells its driver.

#414 made a chain step's readiness wait report a dialog (descriptor waiting) with REASON_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) that waitForCliIdleAfter also uses.

  • Single trigger wait: "idle" and a chain's initial wait: reason is REASON_DIALOG_OPEN when waiting was sampled in the last settle window of a timed-out wait; otherwise the old reasons.
  • Chain busy-fall timeout (step already written): error stays chain timeout, and reason is "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.
  • Nothing written into the PTY changes. waitForIdle reads 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).
  • Without a usable descriptor results are as before.

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, waitForIdle result without waitingSeen, probe sampling the wrong status, waitForBusyFall result without waitingSeen.

Not covered: the submit-verify timeout (submitWithVerify) still reports a bare chain 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.

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
@devsuitup

Copy link
Copy Markdown
Owner Author

Reviewing ff2c98c (adversarial review in progress).

@devsuitup devsuitup left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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.

@devsuitup
devsuitup merged commit adbb4c8 into main Oct 2, 2026
11 checks passed
@devsuitup
devsuitup deleted the fix/379-blocked-session-reason branch October 2, 2026 16:56
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.

(triggers): typing into a session is blind to CLI dialogs, and a blocked session tells its driver nothing

1 participant