Skip to content

fix(agents): ignore acp-only streamTo on subagent sessions_spawn#56906

Closed
vincentkoc wants to merge 1 commit into
mainfrom
vincentkoc-code/pr-55483-replacement
Closed

fix(agents): ignore acp-only streamTo on subagent sessions_spawn#56906
vincentkoc wants to merge 1 commit into
mainfrom
vincentkoc-code/pr-55483-replacement

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Supersedes #55483.

  • preserves the original ACP-only streamTo schema/docs fix on a clean branch
  • keeps the changelog credit intact for @Mintalix and @vincentkoc
  • avoids the dirty-branch/auto-close state on the original PR

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Mar 29, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac732a8f3e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Type.String({
enum: [...ACP_SPAWN_STREAM_TARGETS],
description:
'ACP-only output routing hint. Only used for runtime="acp" and currently ignored for subagent spawns.',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Align streamTo contract text with actual subagent behavior

This schema description now says streamTo is "currently ignored for subagent spawns," but createSessionsSpawnTool still returns an error when streamTo is set and runtime !== "acp" (if (streamTo && runtime !== "acp") ...). In practice, callers relying on the updated contract will see request failures instead of a no-op when they pass streamTo for subagents. Please either update execution to ignore the field for subagent runtime or revert the schema wording so the contract matches runtime behavior.

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR rebases a prior fix (#55483) cleanly onto main, adding a description to the streamTo field in SessionsSpawnToolSchema to document it as ACP-only, and logging the change in CHANGELOG.md.

The only code change is replacing optionalStringEnum(ACP_SPAWN_STREAM_TARGETS) with an inline Type.Optional(Type.String({ enum: [...], description: ... })). While the JSON Schema output is functionally equivalent, the added description contains a factual inaccuracy: it states streamTo is "currently ignored for subagent spawns" when the execute handler (lines 136–141, unchanged by this PR) actually returns an explicit error response whenever streamTo is provided for runtime !== "acp". Callers relying on the schema description will be misled into thinking the field is silently accepted, when it is not.

  • P1: streamTo schema description says "ignored for subagent spawns" but the runtime returns { status: "error", error: "streamTo is only supported for runtime=acp; …" } — documentation and behavior are inconsistent.
  • Minor: switching from optionalStringEnum (which emits Type.Unsafe<"parent"> for a precise TypeScript type) to Type.String() slightly weakens the TypeScript type of the field from "parent" | undefined to string | undefined, though this has no runtime impact since the value is manually narrowed at line 114.

Confidence Score: 4/5

Safe to merge after resolving the schema description mismatch — either update the description to reflect the error behavior or remove lines 136-141 to truly ignore the field.

One P1 finding: the newly added schema description says streamTo is 'ignored for subagent spawns' but the code returns an explicit error, misleading callers who rely on the documented contract.

src/agents/tools/sessions-spawn-tool.ts — description at lines 44-50 and the guard block at lines 136-141 need to be reconciled.

Important Files Changed

Filename Overview
src/agents/tools/sessions-spawn-tool.ts Schema description for streamTo says 'currently ignored for subagent spawns' but the execute handler still returns an error for that case — documentation and behavior are inconsistent.
CHANGELOG.md Adds a changelog entry crediting both contributors; entry is accurate at a high level but inherits the same 'ignore' language that does not match the actual error-returning behavior.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/tools/sessions-spawn-tool.ts
Line: 44-50

Comment:
**Schema description contradicts actual runtime behavior**

The description states `"currently ignored for subagent spawns"`, but the execute handler at lines 136–141 returns an explicit error response when `streamTo` is supplied for a non-ACP runtime:

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

A caller reading this schema description will expect that passing `streamTo` to a subagent spawn is silently accepted/ignored, but they will actually receive an error response at runtime.

If the intent (as the PR title and description suggest) was to **truly ignore** `streamTo` for subagent spawns, the guard block at lines 136–141 should have been removed so the field is silently dropped. If the intent was simply to document the existing "unsupported" constraint, the description should say `"not supported for subagent spawns"` (or similar) rather than `"ignored"`.

Suggested fix (documenting the actual behavior):
```suggestion
  streamTo: Type.Optional(
    Type.String({
      enum: [...ACP_SPAWN_STREAM_TARGETS],
      description:
        'ACP-only output routing hint. Only used for runtime="acp"; passing it for subagent spawns returns an error.',
    }),
  ),
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(agents): ignore acp-only streamTo on..." | Re-trigger Greptile

Comment on lines +44 to +50
streamTo: Type.Optional(
Type.String({
enum: [...ACP_SPAWN_STREAM_TARGETS],
description:
'ACP-only output routing hint. Only used for runtime="acp" and currently ignored for subagent spawns.',
}),
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Schema description contradicts actual runtime behavior

The description states "currently ignored for subagent spawns", but the execute handler at lines 136–141 returns an explicit error response when streamTo is supplied for a non-ACP runtime:

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

A caller reading this schema description will expect that passing streamTo to a subagent spawn is silently accepted/ignored, but they will actually receive an error response at runtime.

If the intent (as the PR title and description suggest) was to truly ignore streamTo for subagent spawns, the guard block at lines 136–141 should have been removed so the field is silently dropped. If the intent was simply to document the existing "unsupported" constraint, the description should say "not supported for subagent spawns" (or similar) rather than "ignored".

Suggested fix (documenting the actual behavior):

Suggested change
streamTo: Type.Optional(
Type.String({
enum: [...ACP_SPAWN_STREAM_TARGETS],
description:
'ACP-only output routing hint. Only used for runtime="acp" and currently ignored for subagent spawns.',
}),
),
streamTo: Type.Optional(
Type.String({
enum: [...ACP_SPAWN_STREAM_TARGETS],
description:
'ACP-only output routing hint. Only used for runtime="acp"; passing it for subagent spawns returns an error.',
}),
),
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/tools/sessions-spawn-tool.ts
Line: 44-50

Comment:
**Schema description contradicts actual runtime behavior**

The description states `"currently ignored for subagent spawns"`, but the execute handler at lines 136–141 returns an explicit error response when `streamTo` is supplied for a non-ACP runtime:

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

A caller reading this schema description will expect that passing `streamTo` to a subagent spawn is silently accepted/ignored, but they will actually receive an error response at runtime.

If the intent (as the PR title and description suggest) was to **truly ignore** `streamTo` for subagent spawns, the guard block at lines 136–141 should have been removed so the field is silently dropped. If the intent was simply to document the existing "unsupported" constraint, the description should say `"not supported for subagent spawns"` (or similar) rather than `"ignored"`.

Suggested fix (documenting the actual behavior):
```suggestion
  streamTo: Type.Optional(
    Type.String({
      enum: [...ACP_SPAWN_STREAM_TARGETS],
      description:
        'ACP-only output routing hint. Only used for runtime="acp"; passing it for subagent spawns returns an error.',
    }),
  ),
```

How can I resolve this? If you propose a fix, please make it concise.

@vincentkoc

Copy link
Copy Markdown
Member Author

closing as superseded by current main. src/agents/tools/sessions-spawn-tool.ts now treats streamTo as ACP-only and rejects it outside runtime="acp", with coverage in src/agents/tools/sessions-spawn-tool.test.ts. the old branch conflicts and its ignore behavior is weaker than the current explicit rejection.

@vincentkoc vincentkoc closed this Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant