operator: flag idle sessions + byte-bounded PTY-screen previews in ambient tick#371
Merged
Conversation
…ent tick Closes the fleet-observation blind spot: interactive claude/codex/shell sessions never emit AwaitingInput (only their headless paths do) and the daemon doesn't infer idle from PTY quiescence, so the operator couldn't tell a finished/waiting session from a busy one. The ambient snapshot now flags "running but quiet >=10m" (from last_pty_at_ms) as idle/waiting/stuck. It also attaches a compact, ANSI-free preview (last few transcript messages) for the few most notable sessions (errored, then idle, then long-awaiting; capped at PREVIEW_SESSIONS), so the operator has concrete content to judge -- selective to keep input context bounded on a large fleet. Adds client.transcript_tail for the bounded fetch. Pure snapshot builder is unit-tested; spec 0021 updated. Verified live: "5 running (4 idle >=10m) ..." with per-session previews.
…ssions Refines the ambient-tick previews per review: - Per-session byte budget (PREVIEW_BYTES, default 800, env-tunable); when the recent content exceeds it, the OLDER part is truncated (keep most recent). - Preview cap raised to 10 (PREVIEW_SESSIONS, env-tunable). - Recently-active running sessions are now included in the preview selection (after needs-attention), so the operator sees live activity too. - Each preview is headed by the full session id, and the observation tells the operator it can call agentd_get_transcript/get_output/get_diff (or list_sessions) to peek deeper. Preview source switched from transcript messages to the rendered PTY screen (vt100 over a bounded pty.log tail): interactive claude/codex transcripts are all Pty markers near the tail, so message previews were empty for them. Headless / no-PTY sessions fall back to transcript messages. Adds client.pty_replay_tail (bounded) and a vt100 dep. Verified live: idle sessions show their waiting prompt; one session was caught stuck on a "trust this folder?" prompt; an active session showed its latest PR-update summary -- all byte-truncated.
edwin-zvs
force-pushed
the
operator-idle-and-preview
branch
from
June 6, 2026 16:25
9083495 to
17c5afd
Compare
This was referenced Jun 6, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #369. Closes the fleet-observation blind spot and gives the operator selective per-session previews.
The blind spot
Interactive
claude/codex/shellsessions never emitAwaitingInput(only their headless paths do), and the daemon doesn't infer idle from PTY quiescence. So an interactive session idle at its prompt looks identical to a busy one (bothRunning), and the operator couldn't surface "this session finished and is waiting" — the most useful signal for those harnesses.Changes
Idle detection. The ambient snapshot flags running but quiet ≥10m sessions (from
last_pty_at_ms) as idle/waiting/stuck. Headless sessions (no PTY) are unaffected.Selective, byte-bounded previews. For the most relevant sessions — errored → idle → long-awaiting → recently-active — the tick attaches a compact preview:
pty.logtail run throughvt100). Interactive claude/codex transcripts are nearly allPtyevents near the tail, so a transcript-message preview was empty for them; the rendered screen shows what they're actually displaying. Headless/no-PTY sessions fall back to recent transcript messages.PREVIEW_BYTES, default 800, env-tunable): when content exceeds it, the older part is truncated, keeping the most recent.PREVIEW_SESSIONS(default 10, env-tunable) sessions previewed.agentd_get_transcript/agentd_get_output/agentd_get_diff(oragentd_list_sessions) to peek deeper.Adds a bounded
client.pty_replay_tailand avt100dep on the adapter.Verification
truncate_keep_tailkeeps the recent tail.interactivetests pass.Spec
0021updated. Code inagentd-adapter-zarvis+ smallagentd-clienthelpers.