feat(core): add dynamic swarm worker tool#3433
Conversation
Add a swarm tool for ad-hoc parallel worker execution with bounded concurrency, wait-all and first-success modes, per-worker failure isolation, and aggregated results. Register the tool in core, prevent nested worker recursion, and document the new workflow.
Prevent swarm calls from bypassing the outer scheduler concurrency budget. Disallow interactive question prompts in swarm workers by default, and avoid incomplete Markdown table escaping by using an HTML entity for pipe characters. Add focused tests for the scheduler behavior, worker tool restrictions, and result formatting.
wenshao
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅ — gpt-5.4 via Qwen Code /review
|
Verified end-to-end on the current head ( 1. wait_all smoke (per PR description, 3 tasks × "Return exactly: X",
2. first_success early termination ( Confirms 3. per-worker timeout ( Confirms the The two review comments from the earlier
The CodeQL "incomplete string escaping" alert is also resolved by switching Unit tests pass locally: One non-blocking observation for follow-up: LGTM. |
|
Opening a discussion on how we handle larger community contributions going forward — using this PR as a concrete example, not to critique it specifically. My main concern is design scrutiny. This PR adds ~900 lines introducing a new top-level core tool that overlaps meaningfully with our existing
These are the kinds of questions a design doc or an issue thread surfaces naturally, and that an automated Curious what others think. Not asking to revisit this PR; just want us to be deliberate about how new surfaces enter the codebase. |
|
Thanks for raising this. I agree with the concern. I initially treated the linked issue as a detailed feature proposal because it included pain points, requirements, examples, and acceptance criteria. In hindsight, I understand that this was not the same as explicit design alignment from maintainers, especially for a new top- level tool touching shared execution infrastructure. I apologize for the extra review and discussion burden this created. As an external contributor, I am still learning the project’s expectations around larger design changes, and I appreciate guidance on the right process. I also agree that for future changes introducing new tools or touching shared infrastructure, it would be helpful to have explicit human design alignment before merge, in addition to automated review. Since this PR has already been merged, I am happy to help with whichever follow-up path maintainers prefer: revert/remove the tool and discuss the design first, gate it as experimental, reshape it as an |
|
@wenshao 老师,原则上,我们不合并任何没有演示视频,没有产完整 E2E 测试的 PR ,同时也不能完全依赖 gpt-5.4 的review 能力,swarm agents 和 agent team 息息相关,是非常重要的能力,原则上也不接受社区 PR |
|
@wenshao @reidliu41 我建议 revert 该 PR |
* feat(core): add dynamic swarm worker tool Add a swarm tool for ad-hoc parallel worker execution with bounded concurrency, wait-all and first-success modes, per-worker failure isolation, and aggregated results. Register the tool in core, prevent nested worker recursion, and document the new workflow. * fix(core): harden swarm worker execution Prevent swarm calls from bypassing the outer scheduler concurrency budget. Disallow interactive question prompts in swarm workers by default, and avoid incomplete Markdown table escaping by using an HTML entity for pipe characters. Add focused tests for the scheduler behavior, worker tool restrictions, and result formatting.
TLDR
Adds a new
swarmcore tool for ad-hoc parallel worker execution.The main agent can now dynamically spawn ephemeral workers from a single tool call, pass each worker its own task prompt, run workers with bounded concurrency, and receive aggregated results. The implementation supports
wait_allandfirst_successmodes, isolates individual worker failures, and prevents nested workers from recursively spawning more swarm or agent sessions.Screenshots / Video Demo
Dive Deeper
This PR introduces SwarmTool, a lightweight map-style worker orchestration tool.
Key behavior:
Updated areas:
Reviewer Test Plan
Run the focused swarm tests:
cd packages/core
npx vitest run src/tools/swarm.test.ts
Expected output:
✓ src/tools/swarm.test.ts (4 tests)
Test Files 1 passed (1)
Tests 4 passed (4)
This directly validates:
Run the full core suite:
cd packages/core
npm run test
Expected output includes the new test file and full core pass:
✓ src/tools/swarm.test.ts (4 tests)
Test Files 238 passed (238)
Tests 5794 passed | 2 skipped (5796)
Run core static checks:
cd packages/core
npm run typecheck
npm run lint
Expected output:
Run root build and bundle from the repository root:
npm run build
npm run bundle
Expected bundle output:
Copied sandbox profiles to dist/
Copied vendor directory to dist/
Copied bundled skills to dist/bundled/
Copied docs/users/ to dist/bundled/qc-helper/docs/
✅ All bundle assets copied to dist/
Run root checks:
npm run typecheck
npm run lint
Expected output includes:
Run root tests:
npm run test
Expected output:
packages/cli:
Test Files 268 passed (268)
Tests 4183 passed | 7 skipped (4190)
packages/core:
Test Files 238 passed (238)
Tests 5794 passed | 2 skipped (5796)
packages/sdk-typescript:
Test Files 6 passed (6)
Tests 201 passed (201)
packages/vscode-ide-companion:
Test Files 30 passed (30)
Tests 192 passed | 1 skipped (193)
Testing Matrix
Linked issues / bugs
Resolves #1816