Repository navigation
fix(sdk): squad_route handler returns false success without spawning a session - #1066
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the SDK squad_route tool so it no longer reports a false success when no agent session was actually spawned. It rewires the tool to the existing fan-out infrastructure, adds validation/error handling around that path, and updates SDK-facing tests/docs to reflect the real contract.
Changes:
- Wire
squad_routethroughspawnParallelvia a new optionalfanOutDepsGetterconstructor dependency onToolRegistry. - Add validation, roster checks, and sanitized failure responses when routing cannot proceed.
- Add SDK-tier/tests and update reference docs plus changeset text for the new behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
test/tools.test.ts |
Updates unit/integration-style tool tests for new squad_route success/failure behavior. |
test/sdk/squad-route.test.ts |
Adds black-box SDK contract tests covering happy path, validation, roster checks, and error sanitization. |
test/integration.test.ts |
Adjusts hook-pipeline integration expectations to the new honest failure mode without fan-out deps. |
packages/squad-sdk/src/tools/index.ts |
Implements the actual squad_route spawn path, dependency injection, validation, and sanitized failures. |
packages/squad-sdk/README.md |
Documents the new fanOutDepsGetter wiring requirement for squad_route. |
docs/src/content/docs/reference/sdk.md |
Updates SDK reference docs for the new ToolRegistry constructor shape and routing requirement. |
docs/src/content/docs/reference/api-reference.md |
Updates API reference docs for squad_route dependency requirements and validation behavior. |
.changeset/wire-squad-route.md |
Adds release note describing the behavior fix and new constructor parameter. |
jagilber
force-pushed
the
squad/1065-fix-squad-route
branch
from
May 2, 2026 20:55
9c9ac6e to
364ed18
Compare
…a session The squad_route tool returned resultType: 'success' without ever spawning a session ΓÇö a silent no-op masquerading as success for SDK embedders. Changes: - Wire squad_route handler to spawnParallel (existing fan-out primitive) - Add fanOutDepsGetter as optional 5th ToolRegistry constructor param - Validate targetAgent with /^[a-zA-Z0-9_-]+$/ regex + trim - Add roster check via state.agents when SquadState is available - Wrap spawnParallel in try/catch; sanitize errors before returning to LLM - Document fanOutDepsGetter wiring and failure modes in SDK README, sdk.md, and api-reference.md - Add 11 SDK-tier tests covering the full squad_route contract Without fanOutDepsGetter wired, squad_route now returns an honest failure (error: 'fan-out-deps-unavailable') instead of false success. Closes github#1065 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jagilber
force-pushed
the
squad/1065-fix-squad-route
branch
from
May 2, 2026 21:01
364ed18 to
e0898ad
Compare
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.
The squad_route tool returned resultType: 'success' without ever spawning a session — a silent no-op masquerading as success for SDK embedders.
Changes:
Without fanOutDepsGetter wired, squad_route now returns an honest failure (error: 'fan-out-deps-unavailable') instead of false success.
Closes #1065
What
Fixes the
squad_routeSDK tool handler which silently returned{success: true}without spawning an agent session. Rewires it to use the existingspawnParallelfan-out primitive, adds input validation (regex + roster check), error sanitization, and comprehensive test coverage.Why
The
squad_routetool is the primary mechanism for LLM-driven agent delegation. Returning false success means the coordinator believes work was dispatched when nothing happened — a critical silent failure. Closes #1065.How
fanOutDepsGetteras an optional 5thToolRegistryconstructor parameter (dependency injection pattern matching existingstateGetter/configGetter)fan-out-deps-unavailableerror immediatelytargetAgentwith/^[a-zA-Z0-9_-]+$/regex and optional roster check viaSquadState.agentsspawnParallel(already usesPromise.allSettledinternally) and mapsSpawnResult[]to the tool responsesanitizeErrorForLlm()— strips paths, stack traces, caps at 512 charsnpx changeset add/.changeset/*.md, directCHANGELOG.mdentry for maintainers, orskip-changeloglabel for no user-facing changes)PR Readiness Checklist
Branch & Commit
dev(notmain)dev(git fetch upstream && git rebase upstream/dev)git diff --cached --stat)Build & Test
npm run buildpassesnpm testpasses (all tests green — 15/15 squad-route tests; pre-existing vitest worker timeouts on full suite affect dev baseline equally)npm run lintpasses (type check clean)npm run lint:eslintpassesChangeset
npx changeset add(ifpackages/squad-sdk/src/orpackages/squad-cli/src/changed)CHANGELOG.mdentry (maintainers only — write-protected for external contributors)skip-changeloglabel applied (if no user-facing changes)Docs
Exports
@bradygaster/squad-sdk/toolssubpath exportBreaking Changes
None.
fanOutDepsGetteris optional (5th param). Without it,squad_routereturns an honest error instead of previous silent false-success.Waivers
None.