You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Finite peek --wait marker returns only after the session exits #206
Johannes's assistant (Compounding Manager) reports this from fleet feedback FB-4996.
Observed:pty peek --wait "END 004" returned only after the retained session exited, when the marker had already scrolled out of view. A 600 s bounded input window expired before the wait returned.
Expected: a marker printed while the wait is active satisfies the wait at once, without process exit. A missed marker is reported differently from a marker that never appeared. The existing time bound stays.
I reproduced this at main. peek --wait doesn't watch output. Every 200 ms it takes a snapshot of the visible screen and looks for the marker there (crates/pty-client/src/peek.rs, peek_wait). If the marker is printed and then scrolled off the screen between two snapshots, no snapshot ever contains it. The wait then runs until the timeout, or, with no time limit, until the session exits and its saved lastLines happen to include the marker. That is the report's "returned only after the session exited".
The repro: a session that waits 1 s, prints END 004, and then prints 200 more lines at once. The wait is pty peek --plain --wait 'END 004' -t 6.
Case
Result
Marker scrolled off within one poll
exit 1 after 6.0 s, "Timed out after 6s waiting for "END 004"". pty peek --full shows the marker in scrollback.
Control: marker stays on screen
exit 0 after 1.2 s
The fix I'm making:
Watch the stream.peek --wait keeps one read-only peek connection open for the whole wait. It matches against the screen snapshot that connection starts with, and then against each output chunk as it arrives, with ANSI stripped. A tail is kept across chunks, so a marker split between two chunks still matches. A marker printed while the wait is active therefore matches as soon as its bytes arrive, whether or not it is still on screen.
Nothing that matches today stops matching. The visible-screen check stays, so output drawn by cursor movement is still found on screen.
Missed is reported apart from never. On timeout, or when the session exits without a match, the wait also checks the full scrollback.
If the marker is there, it can only have been printed before the wait began, so the error says that on a second line.
If it isn't there, the error says it never appeared.
The existing first line and exit code 1 stay the same.
The time bound stays.-t keeps its meaning.
None of this touches tier-1 files. I'll link the PR here.
The fix is in #208. With it, the repro above returns at 1.0 s with exit 0 for the scrolled marker, the same as for a marker that stays on screen. A marker from before the wait now times out with a second line: "It is in the scrollback from before the wait began, no longer on screen." A pattern that never appeared keeps the single line it had.
Fixed by #208, merged as d618d49. peek --wait now also watches the output while it waits. A marker that is printed and scrolled away during the wait ends the wait at once. On a timeout, a marker that is in the scrollback from before the wait gets a second line, so it reads differently from one that never appeared. The -t bound holds even under output that never pauses.
Activity
myobie commentedon Nov 3, 2026
I reproduced this at main.
peek --waitdoesn't watch output. Every 200 ms it takes a snapshot of the visible screen and looks for the marker there (crates/pty-client/src/peek.rs,peek_wait). If the marker is printed and then scrolled off the screen between two snapshots, no snapshot ever contains it. The wait then runs until the timeout, or, with no time limit, until the session exits and its savedlastLineshappen to include the marker. That is the report's "returned only after the session exited".The repro: a session that waits 1 s, prints
END 004, and then prints 200 more lines at once. The wait ispty peek --plain --wait 'END 004' -t 6.pty peek --fullshows the marker in scrollback.The fix I'm making:
peek --waitkeeps one read-only peek connection open for the whole wait. It matches against the screen snapshot that connection starts with, and then against each output chunk as it arrives, with ANSI stripped. A tail is kept across chunks, so a marker split between two chunks still matches. A marker printed while the wait is active therefore matches as soon as its bytes arrive, whether or not it is still on screen.-tkeeps its meaning.None of this touches tier-1 files. I'll link the PR here.
myobie commentedon Nov 3, 2026
The fix is in #208. With it, the repro above returns at 1.0 s with exit 0 for the scrolled marker, the same as for a marker that stays on screen. A marker from before the wait now times out with a second line: "It is in the scrollback from before the wait began, no longer on screen." A pattern that never appeared keeps the single line it had.
Merge pull request #208 from compoundingtech/agent/peek-wait-watches-…
myobie commentedon Nov 3, 2026
Fixed by #208, merged as d618d49.
peek --waitnow also watches the output while it waits. A marker that is printed and scrolled away during the wait ends the wait at once. On a timeout, a marker that is in the scrollback from before the wait gets a second line, so it reads differently from one that never appeared. The-tbound holds even under output that never pauses.