Skip to content

sessions_spawn schema allows streamTo for runtime=subagent but execute rejects it #60965

Description

@wen0531

Bug Description

The sessions_spawn tool schema (SessionsSpawnToolSchema) accepts streamTo as an optional parameter for ALL runtimes, including runtime="subagent" and runtime="acp" together.

However, the execute function rejects streamTo when runtime="subagent":

if (streamTo && runtime !== "acp") return jsonResult({
  error: `streamTo is only supported for runtime=acp; got runtime=${runtime}`
});

Expected Behavior

The schema should either:

  1. Not include streamTo in the runtime="subagent" case (conditional schema), OR
  2. Document clearly that streamTo is ignored/rejected for subagent runtime

Actual Behavior

  1. Schema accepts streamTo unconditionally (no runtime-aware conditional)
  2. Execute function rejects it for runtime="subagent"
  3. Agents that follow the schema may include streamTo in their runtime="subagent calls, resulting in predictable errors

Schema Location

File: dist/pi-embedded-BYdcxQ5A.js, line ~22950

const SessionsSpawnToolSchema = Type.Object({
  task: Type.String(),
  runtime: optionalStringEnum(SESSIONS_SPAWN_RUNTIMES),
  streamTo: optionalStringEnum(SESSIONS_SPAWN_ACP_STREAM_TARGETS),  // ← allowed for ALL runtimes
  ...
})

Suggested Fix

Use a conditional/dependent schema so streamTo is only allowed when runtime="acp":

  • When runtime === "acp"streamTo is allowed
  • When runtime === "subagent"streamTo should be stripped or rejected at schema level

Or alternatively: strip streamTo from params before the validation check when runtime !== "acp".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions