Skip to content

fix(list): report an idle interactive agent as waiting - #95

Merged
baldurpan merged 4 commits into
mainfrom
79-list-agents-reports-an-idle-interactive-agent-as
Oct 3, 2026
Merged

baldurpan merged 4 commits into
mainfrom
79-list-agents-reports-an-idle-interactive-agent-as

Conversation

@baldurpan

Copy link
Copy Markdown
Contributor

Closes #79

What was wrong

isSessionWaiting (src/lib/agent.ts) returned false for every interactive session. Its comment said interactive entries carry no status, but they do. The agents worktree branch starts through Herdr are interactive, so list --agents --json reported a worker that had finished its turn exactly like one still working (live:true, interactive:true, waiting:false). A coordinator polling it per the README's handshake saw no change.

The fix

  • waiting no longer looks at kind. It reads the runtime and Herdr statuses with the same split isSessionBlocking uses.
  • It is true only when at least one status is present and every present one is a waiting status:
    • runtime: idle or blocked
    • Herdr: idle, blocked or done, where Herdr's done means a finished turn nobody has looked at yet.
  • A runtime state: "blocked" still counts as waiting.
  • The --json keys are unchanged. Only what waiting reports changes.
  • The text list shows an interactive session that is waiting as [interactive, waiting], and [done] still takes precedence.

Two smaller changes follow from reading both sources:

  • A joined session the runtime calls idle while Herdr reports working is no longer waiting.
  • A Herdr done now counts as waiting.

isSessionBlocking, isSessionLive, findSessionForPath and cleanup are untouched.

Docs and release note

  • docs/.../commands/list/page.mdx: the marker list and the --json agent row. The [interactive] bullet used to say it never covers an agent this tool dispatched, which stopped being true once Herdr agents arrived. It is reworded.
  • README.md Agent mode: what waiting means, and coordinator step 4 now says to poll it.
  • skills/worktree/SKILL.md: the same two points.
  • .changeset/idle-agents-wait.md: a patch note.

Verification

  • pnpm check, pnpm typecheck, pnpm build, pnpm test (970 tests) and pnpm docs:test (68 tests) all exit 0.
  • New tests cover a reproduction of list --agents reports an idle interactive agent as waiting: false, the same as a working one #79 through getAgentSessions: an interactive runtime idle session joined to a Herdr idle agent now reports waiting.
  • They also cover the mixed-status cases and the combined text marker.
  • Reviewed by the reviewer subagent: the first pass was PASS WITH NOTES, with nothing blocking. Its notes were folded in, and the re-check of that change came back PASS.

`isSessionWaiting` returned false for every interactive session, on the
premise that interactive entries carry no status. They do, and the agents
`worktree branch` starts through Herdr are interactive, so a coordinator
polling `list --agents --json` could not tell a worker that had finished
its turn from one still working.

`waiting` no longer looks at `kind`. It reads the runtime and Herdr
statuses with the same split `isSessionBlocking` uses, and is true only
when at least one is present and every present one is a waiting status:
runtime `idle`/`blocked`, Herdr `idle`/`blocked`/`done`. The text list
shows such a session as `[interactive, waiting]`. The JSON keys are
unchanged.

Documented on the list page, in the README's Agent mode section and in the
bundled skill, with a patch release note.

Closes #79
craig-o-curtis
craig-o-curtis previously approved these changes Oct 2, 2026

@craig-o-curtis craig-o-curtis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ope, there it was the whole time: interactive sessions do carry a status. Nice catch, and this looks real good to me.

Went through the whole diff:

  • isSessionWaiting now splits the runtime and Herdr statuses the same way isSessionBlocking does, and wants at least one status with every one of them agreeing. That's the sensible reading, and a Herdr-only session gets its status treated as Herdr's, same as over in the blocking check.
  • The #79 case is reproduced through getAgentSessions and not just poked at the predicate, so it'd catch the join going sideways too. The mixed-status, no-status and runtime-done cases are all pinned down.
  • [done] still wins over [interactive, waiting], with a test for it.
  • The --json keys don't change, and the two behaviour shifts that tag along (runtime idle + Herdr working is no longer waiting; Herdr done is) are spelled out in the changeset, so nobody polling it gets a surprise.
  • README, the list page, the skill file and a patch note all came with. ci and changeset are green.

Just a couple little things, nothing to hold it up over:

  1. This and #94 both touch the same paragraph in README.md (the live / [done] sentences) and neighbouring bullets on the list page, so whichever one lands second will likely want a rebase. The behaviour fits together fine: a done-but-still-running session that's idle comes out waiting under both.
  2. The test-count snapshot in context/verify.md wasn't bumped here. That file says to fix it in passing, and #94 does, so it'll sort itself out.

I went by the diff and the green CI on this head; didn't run the suite myself.

That'll do just fine. Thanks much!

…ve-agent-as

Brings in #94 (#73): a runtime `done` session whose pid is still running
counts as live. Combined with this branch's waiting rule, such a session
is weighed by its status: idle is waiting and does not block, blocked is
waiting and blocks, busy or no status blocks and is not waiting, and one
whose process is gone stays done.

Conflicts in README.md and the list docs page are resolved to keep both
changes and describe the combination; the skill's `list --agents` comment
says the same. Adds a test pinning the non-idle side of the combination,
and corrects verify.md's test-count snapshot in passing.
…ve-agent-as

No conflicts and no overlap with this branch. Corrects verify.md's test-count snapshot in passing.

@craig-o-curtis craig-o-curtis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh for sure, back for another look since the merges with main bumped my last approval off. Still looks real good.

What changed since I was here last (753818e → b32505f), checked merge by merge:

  • Merge of #94 had two honest conflicts, in README.md and the list page, and both got settled the sensible way: #94's "or the process behind it is still running" wording is kept, and this PR's waiting sentences sit right alongside it. Nothing from either side got lost in the shuffle.
  • That merge also brought along one new test (is waiting only on an idle or blocked status when the pid is running) plus a line each in the README, the list page and SKILL.md for the spot where the two fixes meet: a runtime-done session whose process is still going gets weighed by its status like any other live one. That's the right reading of isSessionWaiting as written, and it's nice to have it pinned down instead of left to chance.
  • Merge of #96 was clean; just the test-count snapshot in context/verify.md got nudged.

So both of my little notes from last time are squared away: the rebase over #94 is done, and verify.md is bumped.

The code itself in src/lib/agent.ts and src/lib/utils.ts is the same as what I went through before: waiting no longer looks at kind, wants at least one status with every one agreeing, state: "blocked" still short-circuits to waiting, and isSessionBlocking / isSessionLive / findSessionForPath are left alone, so cleanup doesn't budge.

Couple things to know, neither worth holding it up over:

  1. It's one commit behind main now (#98, the worker URL). I trial-merged it into current main and alongside #97 and both come out clean.
  2. The "970 tests" in the description is from before the merges, so it's a bit behind verify.md. No big deal.

ci and changeset are green on this head. I went by the diff, the merge resolutions and CI; I didn't run the suite on my own machine.

You betcha, good to go. Thanks much!

@baldurpan
baldurpan merged commit 4d63b22 into main Oct 3, 2026
2 checks passed
@baldurpan
baldurpan deleted the 79-list-agents-reports-an-idle-interactive-agent-as branch October 3, 2026 10:44
@baldurpan baldurpan mentioned this pull request Oct 4, 2026
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.

list --agents reports an idle interactive agent as waiting: false, the same as a working one

2 participants