Skip to content

ACP: subagent output (parentToolUseId) is mixed into the main assistant message #7342

Description

@k0d3r1s

Summary

claude-agent-acp tags subagent updates with _meta.claudeCode.parentToolUseId. The ACP translator ignores this tag. Subagent text and reasoning stream into the same channel as the main assistant message. Every subagent tool_call closes the main message, which splits it into fragments. Subagent tool calls show at the top level instead of under their Agent call.

Repro

Code path (found by reading main):

  1. Use an ACP provider backed by claude-agent-acp.
  2. Ask the agent to run a subagent that writes text and runs a command.
  3. The subagent's text appears inside the main assistant message. Each subagent tool call closes the main message and splits it. The subagent's command shows at the top level.

Cause

Line numbers are from main at 7c1353d8.

  • packages/provider-bridge-acp/src/delta-translation.ts:658: every agent_message_chunk uses key: { channel: ASSISTANT_STREAM_KEY }. The thought chunk at :676 does the same.
  • delta-translation.ts:691: every tool_call closes the root streams with const flush = [closeThoughtStream(), closeAssistantStream()].
  • parentToolUseId and parentRef do not appear anywhere in packages/provider-bridge-acp.
  • The protocol already supports nesting: packages/provider-bridge-protocol/src/assembler/delta-assembler.ts:175 uses key.parentRef, and the Claude Code bridge sets it.

Suggested fix

Read _meta.claudeCode.parentToolUseId from each update and send it as parentRef in the delta keys: text streams, item.open, item.close, item.progress and command output. Then:

  • Keep a separate text stream per parent, so a subagent's text does not join or close the root stream.
  • Resolve the parent once when the call opens, and reuse it for later updates of that call.
  • Ignore a parent id that equals the call's own id.
  • Close a parent's streams when its tool call completes, and when the turn ends or is interrupted.
const parentRef = claudeCodeParentToolUseId(update); // from update._meta.claudeCode.parentToolUseId
key: { channel: ASSISTANT_STREAM_KEY, ...(parentRef ? { parentRef } : {}) }

Tested locally with a regression test.

Activity

  1. added theissue type on Nov 10, 2026
  2. added
    providers
    provider-acp
    confirmed-repro
    on Nov 10, 2026
  3. bb-slop-cop commented on Nov 10, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority Medium · Effort Medium · providers, provider-acp.
    • Verdict: REPRODUCED · confidence high · reproduction label confirmed-repro.
    • Reproduction and root-cause report. Published to the reports repository; GitHub Pages deployment currently fails, so this links directly to the committed report.
    • Root cause: ACP translation drops nested ownership metadata, so child text and tool activity use root stream keys.
    • Fix: Ready PR #7367, not merged — 302 changed lines across two files, using the existing protocol.
    • Verification: The ACP nested output ownership regression fails on trusted main in two clean checkouts and passes with the fix. ACP suite: 587 passed, 4 skipped; lint/typecheck pass. Recorded parity: 10 passed, 1 skipped, with a temporary empty allowlist because the default contains stale exceptions. No live external-provider/UI session is claimed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-reproprovider-acpproviders

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions