Repository navigation
fix(list): report an idle interactive agent as waiting - #95
Conversation
`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
left a comment
There was a problem hiding this comment.
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:
isSessionWaitingnow splits the runtime and Herdr statuses the same wayisSessionBlockingdoes, and wants at least one status with every one of them agreeing. That's the sensible reading, and a Herdr-only session gets itsstatustreated as Herdr's, same as over in the blocking check.- The #79 case is reproduced through
getAgentSessionsand not just poked at the predicate, so it'd catch the join going sideways too. The mixed-status, no-status and runtime-donecases are all pinned down. [done]still wins over[interactive, waiting], with a test for it.- The
--jsonkeys don't change, and the two behaviour shifts that tag along (runtime idle + Herdr working is no longer waiting; Herdrdoneis) are spelled out in the changeset, so nobody polling it gets a surprise. - README, the
listpage, the skill file and apatchnote all came with.ciandchangesetare green.
Just a couple little things, nothing to hold it up over:
- This and #94 both touch the same paragraph in
README.md(thelive/[done]sentences) and neighbouring bullets on thelistpage, 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 outwaitingunder both. - The test-count snapshot in
context/verify.mdwasn'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
left a comment
There was a problem hiding this comment.
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.mdand thelistpage, and both got settled the sensible way: #94's "or the process behind it is still running" wording is kept, and this PR'swaitingsentences 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, thelistpage andSKILL.mdfor the spot where the two fixes meet: a runtime-donesession whose process is still going gets weighed by its status like any other live one. That's the right reading ofisSessionWaitingas 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.mdgot 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:
- It's one commit behind
mainnow (#98, the worker URL). I trial-merged it into currentmainand alongside #97 and both come out clean. - 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!
Closes #79
What was wrong
isSessionWaiting(src/lib/agent.ts) returnedfalsefor every interactive session. Its comment said interactive entries carry no status, but they do. The agentsworktree branchstarts through Herdr are interactive, solist --agents --jsonreported 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
waitingno longer looks atkind. It reads the runtime and Herdr statuses with the same splitisSessionBlockinguses.idleorblockedidle,blockedordone, where Herdr'sdonemeans a finished turn nobody has looked at yet.state: "blocked"still counts as waiting.--jsonkeys are unchanged. Only whatwaitingreports changes.[interactive, waiting], and[done]still takes precedence.Two smaller changes follow from reading both sources:
idlewhile Herdr reportsworkingis no longerwaiting.donenow counts as waiting.isSessionBlocking,isSessionLive,findSessionForPathandcleanupare untouched.Docs and release note
docs/.../commands/list/page.mdx: the marker list and the--jsonagentrow. 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.mdAgent mode: whatwaitingmeans, and coordinator step 4 now says to poll it.skills/worktree/SKILL.md: the same two points..changeset/idle-agents-wait.md: apatchnote.Verification
pnpm check,pnpm typecheck,pnpm build,pnpm test(970 tests) andpnpm docs:test(68 tests) all exit 0.getAgentSessions: an interactive runtimeidlesession joined to a Herdridleagent now reportswaiting.reviewersubagent: 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.