Skip to content

[Bug]: worktree ps --json agent rows carry no agentWait — only terminal show does, forcing a second call per lane to detect a human-wait #23921

Closed

Description

@Nitewriter

Operating system

macOS

Orca version

1.4.216 (the 1.4.217 release notes list no change here)

Details

orca worktree ps --json is the one-call fleet sweep: every lane, every agent, in one response.
Its agent rows carry a state enum (working, blocked, waiting, etc.) but not agentWait —
the richer wait-reason signal that orca terminal show --terminal <handle> --json returns for
the same agent. A watcher that wants to tell "this lane is genuinely parked on a human" from
"this lane is just between turns" has to fall back to state alone on the sweep call, then make
one more terminal show call per terminal to get agentWait, defeating the point of a single
fleet-wide ps call.

Reproduction

orca worktree ps --json
# agent row keys: agentType, displayName, interrupted, lastAssistantMessage, paneKey,
# parentPaneKey, prompt, state, stateStartedAt, taskTitle, toolInput, toolName, updatedAt
# -> no agentWait

orca terminal show --terminal <handle-from-that-row> --json
# -> includes "agentWait": null (or a populated wait descriptor when the agent is actually
#    waiting on a human)

Expected

Either add agentWait to the agent objects in worktree ps --json (and worktree show), or
document that a fleet sweep needs a terminal show follow-up call per terminal to see it. Today
a caller has no way to know the richer field exists unless they already know to look at
terminal show.

Activity

  1. added
    os:macos
    on Sep 29, 2026
  2. added theissue type on Sep 29, 2026
  3. ggbdpq commented on Sep 30, 2026

    @ggbdpq
    Contributor

    Confirmed on upstream/main — the asymmetry is structural, not drift. terminal show fills agentWait in orca-runtime-resolve-terminal-pane.ts via getTerminalInteractiveWait(), while worktree ps rows are assembled in attachRuntimeWorktreeAgentRows() (src/main/runtime/runtime-worktree-agent-rows.ts) from RuntimeWorktreeAgentSources that never carry the field, so the JSON projection can't expose what its source rows don't have.

    The ps path already holds what the wait lookup needs: collectRuntimeWorktreeAgentSources() rejoins each status row to the PTY handle it was observed under, and getTerminalInteractiveWait()'s prompt-text and title branches are pure state reads — only the hook branch issues a probe, which is already deduped once per PTY and bounded by TERMINAL_INTERACTIVE_WAIT_PROBE_TIMEOUT_MS. Plan: thread an async wait lookup through the getWorktreePs assembly, attach agentWait to each row conditionally (...(agentWait !== undefined ? { agentWait } : {})), and keep it absent for structured workers, matching the existing absent-vs-null contract documented in worker-observation.ts. Tests against the row builder in the existing runtime-worktree-agent-rows-*.test.ts style: populated wait, explicit null on "looked, nothing waiting", absent when no handle resolves. I'll take this one.

  4. ggbdpq commented on Sep 30, 2026

    @ggbdpq
    Contributor

    Implemented in #24142. The ps assembly now resolves getTerminalInteractiveWait() for every row source that names its terminal handle and threads the result onto the row; structured workers keep the field absent per the absent-vs-null contract in worker-observation.ts.

  5. added a commit that references this issue on Oct 28, 2026
    01ec475
  6. added a commit that references this issue on Oct 28, 2026
    ea6c69b
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

    os:macos

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions