Skip to content

fix(runtime): accept redundant delegation job selectors - #2188

Merged
vastsa merged 1 commit into
mainfrom
fix/2173-task-job-arguments
Nov 8, 2026
Merged

vastsa merged 1 commit into
mainfrom
fix/2173-task-job-arguments

Conversation

@vastsa

@vastsa vastsa commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #2173.

  • Accept job.kind: "delegation" together with omitted/empty delegationIds, or IDs that all identify that same job.
  • Ignore mode / minCompleted for an explicit single-delegation job while preserving its wait timeout, cancellation signal and result delivery.
  • Reject conflicting or malformed selectors with corrective usage instructions. Keep Bash selector restrictions and implicit delegation defaults unchanged.
  • Add regression coverage and a deterministic real parent/delegate tool-loop E2E. Synchronize runtime and E2E specs.

Task-candidate validation

  • Candidate: 275748889e78a1729dc00e2be9b3716312ed9ca6
  • Base main: b7678c36cb8fd4bcb1db7173b5e0a6be9e4c07f0
  • 70 tests pass in background-job-tools.test.ts and subagent.test.ts.
  • 101 runtime tests pass with -t 'delegat|subagent|job controls' (313 unrelated tests not selected).
  • Shared, agent-runtime and host-runtime TypeScript builds pass.
  • node --check scripts/e2e-task-job-selectors.mjs and PR-base/diff checks pass.
  • PI_DESKTOP_HOST_BIN=<rebuilt-base-host> node scripts/e2e-task-job-selectors.mjs passes: seven parent provider rounds, report re-read, matching/empty selectors and cancellation of a real pending delegate provider request. The same E2E fails against the original runtime.

Environment: existing host Node/dependencies and Cargo cache, isolated Host data/workspace, deterministic localhost provider. No external model request or running user Desktop instance. Native Windows / the reported real model were not exercised.

Broader local baseline observations

These are outside the changed behavior and were independently reproduced with untouched base source and the same environment:

  • An expanded 484-test local run has one failure in compacts at the turn boundary rather than ahead of it (compaction mark provider/model fields).
  • The existing Bash background-job E2E receives failed instead of stopped in its service-stop assertion. This PR changes neither Bash process state handling nor that script.

Biome configuration excludes the changed files; the attempted targeted invocation processed no files and is not counted as passing lint. Remote repository checks remain the landing gate.

Models can supply both job and delegationIds for the same subagent.
Accept equivalent selectors and ignore single-target wait options without
changing Bash controls or allowing conflicting delegation targets.

fixes #2173
Copilot AI balanced review requested due to automatic review settings November 8, 2026 07:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@vastsa

vastsa commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

PR integration validation passed on GitHub merge ref 805f2efc9f33fa3762f88b74d8b7e7027c3b72dc (base b7678c36cb8fd4bcb1db7173b5e0a6be9e4c07f0, head 275748889e78a1729dc00e2be9b3716312ed9ca6). Its tree is identical to the tested task candidate (241e1480a85f871fb3cccda5fef043f5ff14a15b). Shared/runtime builds and the real parent/delegate selector E2E passed again while checked out at that merge ref. Remote checks are still pending; no merge has been performed.

@vastsa
vastsa merged commit fc734a2 into main Nov 8, 2026
6 checks passed
@vastsa
vastsa deleted the fix/2173-task-job-arguments branch November 8, 2026 07:19
vastsa pushed a commit that referenced this pull request Nov 21, 2026
#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 #2487
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.

[Bug] TaskWait/TaskStop 同时收到 job 和 delegationIds 时直接报错,GPT-6.1 Sol 无法等待或停止子智能体

2 participants