Repository navigation
fix(cli): agent wait returns when agent already matches --until - #504
Open
codeaholicguy wants to merge 2 commits into
Open
codeaholicguy wants to merge 2 commits into
codeaholicguy wants to merge 2 commits into
Conversation
…until Check the current agent list right after the baseline read. If any watched agent already satisfies --until, return triggered with the same JSON shape instead of waiting only for transitions.
Check current state only for filtered waits. Every watched agent must already match --until for an immediate return; unfiltered waits stay transition-only. Update web docs and agent-orchestration skill. Co-authored-by: Hoang Nguyen <codeaholicguy@users.noreply.github.com>
This branch has not been deployed
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.
Problem
ai-devkit agent wait --untilonly noticed status changes after a baseline snapshot. If a worker was alreadywaiting, a filtered wait (with--id) could sit until timeout unless you ranagent list --jsonfirst. Unfiltered waits in recipes like the channel ping loop should stay transition-only so you do not get duplicate pings on startup.Root cause
waitForAgentChangesinpackages/cli/src/services/agent/agent-wait.service.tstook one baselinelist()and then useddiffAgentChanges, which ignores agents that are already in a target status. That is correct for ongoing polls, but lead/worker loops that pass--idneed a one-shot check on the current state.Wait behavior lives in the CLI service. I did not change
packages/agent-managerordevkitd.Fix (option C, Hoang)
watchis set (--idor--group), after subscribe and the baseline list, if every watched agent already matches--until, return immediately withreason: "triggered"and the same JSON shape as a transition (fromandtoare the current status).--untilyet, block for transitions as onmain.watchis omitted (unfiltered wait), no initial-state shortcut. Behavior matchesmain(transition-only).Test plan
Regression tests:
waitingreturnstriggeredon the first list.--idtargets, only one already waiting, still times out until transition.--idimmediate match and unfiltered timeout.Behavior changes
--id/--group): returns immediately when every watched agent already satisfies--until. No need to callagent list --jsonfirst for the lead/worker case.22-agent-wait-channel-ping-recipe.mdare unchanged in intent.appeared: still transition-only (no instant match for agents already listed).Review note: Hoang can still switch to option B during review (opt-in
--nowflag on any wait) if he wants unfiltered immediate match without changing default semantics.Docs
web/content/docs/8-agent-management.mdweb/content/docs/20-cross-vendor-agent-recipe.mdweb/content/docs/22-agent-wait-channel-ping-recipe.mdskills/agent-orchestration/SKILL.mdinit --demo(PR #487) does not callagent wait; no change there.Risks
Skills / process
dev-lifecycle, tdd, verify, dev-commit, dev-review.
Tooling friction
None on this push.