Repository navigation
fix(agent-runtime): accept job plus multi-id TaskWait selectors - #2489
Merged
Merged
Conversation
vastsa#2188 relaxed target() to accept an omitted/empty delegationIds or one containing only job.id. It still threw when a delegation job accompanied a delegationIds array naming other subagents, even though the wrapper already falls through to delegates.wait/stop.execute(id, params) and that path honors the full multi-target list. Strict Responses-style models send both shapes when collecting several completed reports, so every TaskWait failed and the reports never reached the parent. Return undefined instead of throwing for a valid delegationIds array that selects other ids, letting the existing multi-target path handle it. Keep the single-job path for omitted/empty/same-id arrays and keep rejecting malformed selectors (non-array values or non-string entries) with an actionable error that tells the model to drop job and retry with delegationIds. Bash job selectors are unchanged. Also stop TaskList from echoing `job={"kind":"delegation",...}` for each delegation; it now prints the delegationIds form the model should pass. Fixes vastsa#2487
There was a problem hiding this comment.
AIUO CodePilot · Preliminary review
Diff-only preliminary review of PR 2489 (delegation TaskWait/TaskStop selectors). The change relaxes target() so a conflicting delegationIds array falls through to multi-target delegates, narrows malformed selectors to a new error, and rewrites TaskList output from job= to delegationIds=. Logic and tests appear consistent with the stated intent; I could not run tests or inspect surrounding runtime code, so findings are limited to what is visible in the patch.
No evidenced findings in the supplied diff.
Head: aef5ada
Base: 48a6558
CI: success; mergeable: true.
Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.
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.
Fixes #2487
Problem
#2188 (the fix for #2173) let
TaskWait/TaskStopaccept a delegationjobtogether with an omitted/emptydelegationIds, or a list containing only that job's id.target()still threw when the same job arrived with adelegationIdsarray naming any other id. Strict Responses-style models (reported withgpt-6.2-astra) fill optional parameters and send the job plus every id when collecting several completed subagent reports. EveryTaskWaitthen failed, so the parent never received the report bodies: 21 failures over 32 minutes and roughly 12 KB of subagent output lost in the report.The guard was stricter than the implementation:
buildJobTools()already falls through todelegates.wait/stop.execute(id, params)whentarget()returns no job, and those delegates honor the fulldelegationIdslist.Change
target()now returnsundefined(no job) when a valid delegationdelegationIdsarray selects ids other thanjob.id, so the existing multi-target path handles the call and keeps the original wait options.job.id(including duplicates) still resolve to the single job.joband retry withdelegationIds: [...].TaskListno longer echoesjob={"kind":"delegation",...}per delegation; it printsdelegationIds=["<id>"], so it no longer advertises the shape that led the model to sendjob.Tests
pnpm --filter @pi-desktop/shared buildpackages/agent-runtime: vitest run src/background-job-tools.test.ts— 42 passedpackages/agent-runtime: vitest run src/runtime.test.ts— 429 passedpackages/agent-runtime: vitest run src/subagent.test.ts src/delegation-chain.test.ts src/delegation-history.test.ts— 120 passedpnpm --filter @pi-desktop/shared typecheckandpnpm --filter @pi-desktop/agent-runtime typecheck— passNew coverage:
["other"]and["delegate", "other"]now fall through to the delegate with the original params; malformed values ("delegate",null,["delegate", null],[42]) keep throwing; the existing same-id/empty/omitted single-job cases still pass; TaskList output asserts thedelegationIdsform and nojob=.