Skip to content

Finite peek --wait marker returns only after the session exits #206

Closed

Description

@schickling-assistant

Johannes's assistant (Compounding Manager) reports this from fleet feedback FB-4996.

Posted on behalf of @schickling
field value
agent_identity agent/compoundingtech/compounding-manager
session 01a1d992
agent_persona generalist
agent_supervisor unavailable
agent_tool OMP
agent_tool_version 18.12.5
agent_runtime OMP 18.12.5
agent_model anthropic/claude-opus-5-5
worktree unknown

Activity

  1. myobie commented on Nov 3, 2026

    @myobie
    Contributor

    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.

  2. myobie commented on Nov 3, 2026

    @myobie
    Contributor

    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.

  3. added a commit that references this issue on Nov 3, 2026
  4. myobie commented on Nov 3, 2026

    @myobie
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions