Skip to content

fix(agentspan): map handoff toolType to INLINE instead of silent SIMPLE default - #1435

Open
kowser-orkes wants to merge 1 commit into
mainfrom
fix/swarm-transfer-tooltype-inline
Open

fix(agentspan): map handoff toolType to INLINE instead of silent SIMPLE default#1435
kowser-orkes wants to merge 1 commit into
mainfrom
fix/swarm-transfer-tooltype-inline

Conversation

@kowser-orkes

Copy link
Copy Markdown
Contributor

Pull Request type

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • WHOSUSING.md
  • Other (please describe):

NOTE: Please remember to run ./gradlew spotlessApply to fix any format violations.

Changes in this PR

Bug: ToolCompiler.TYPE_MAP has no entry for toolType="handoff" (the SWARM/hybrid transfer
tool's type since PR #1356). compileToolSpecs silently falls through to its "SIMPLE" default,
so every {source}_transfer_to_{peer} tool's LLM-facing spec says "type": "SIMPLE" — directly
contradicting the "deliberately not a worker" comment on the same .toolType("handoff") call.

Impact: cosmetic to the server's own dispatch (transfer calls are intercepted by the INLINE
checkTransferTask/toolRouter before dynamic-fork dispatch ever runs), but it's the field
client SDKs read to decide "does this tool need a local worker" — and it's wrong. One half of the
fix for #1363 (stateful SWARM handoffs hanging forever); paired python-sdk PR fixes the client
side that this bug misleads.

Fix:

  • TYPE_MAP: add "handoff" → "INLINE", matching how handoff_check/check_transfer are
    already typed.
  • compileToolSpecs: WARN-log unrecognized toolTypes instead of silently defaulting to
    "SIMPLE" — a silent default to the one type that implies "needs a worker" is exactly what let
    this regress unnoticed for 9+ days.
  • Tests: new testCompileToolSpecs_Handoff (direct coverage) and
    testCompileToolSpecs_compilerOwnedToolTypesHaveExplicitMappings (pins all 3 compiler-owned
    toolTypes so a future unmapped one is caught here). Fixed one pre-existing
    SwarmHandoffCompilerContractTest assertion that had hardcoded this bug ("SIMPLE") as expected
    behavior.

Not fixed by this PR alone: requiredWorkers (computed from
WorkflowDef#collectSimpleTaskNames(), which reads the compiled graph task's type, not the LLM
tool spec) already excluded these names, confirmed live both before and after this change. This PR
only fixes the LLM-facing spec field.

Issue #1363

Alternatives considered

  • Restore server-side TaskDef registration for the transfer tool — rejected: the transfer task
    is never dynamically forked/scheduled in the first place (checkTransferTask/toolRouter
    interception), so a registered TaskDef would just be dead clutter.
  • Introduce a new task-type marker instead of reusing "INLINE" — rejected: INLINE is already
    what handoff_check/check_transfer use for "resolved server-side, no worker."

ToolCompiler.TYPE_MAP had no entry for toolType="handoff", so compileToolSpecs fell through to the SIMPLE default -- contradicting the "deliberately not a worker" comment on the same tool definition and misleading every client SDK that reads the compiled tool spec to decide whether a name needs a worker.
@kowser-orkes
kowser-orkes force-pushed the fix/swarm-transfer-tooltype-inline branch from 5c2a06f to 5c9221b Compare July 30, 2026 16:36
NicholasDCole
NicholasDCole previously approved these changes Jul 30, 2026
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.

2 participants