TaskOutput(block=true) on a local_agent task streams the raw subagent JSONL transcript into the caller's context

Open 💬 0 comments Opened Jul 10, 2026 by anombyte93

Observed

Calling TaskOutput with block: true on a still-running local_agent task returned a truncated dump of the agent's raw JSONL transcript (assistant events, tool_use blocks, and a multi-KB base64 thinking-signature blob) as the tool result — injected straight into the orchestrator's context.

The tool's own description explicitly warns about this exact content: "For local_agent tasks: use the Agent tool result directly. Do NOT Read the .output file — it is a symlink to the full subagent conversation transcript (JSONL) and will overflow your context window." But TaskOutput itself returns that same transcript when the task type is local_agent, so following the guidance to avoid Read doesn't protect you.

Expected

For task_type=local_agent, TaskOutput should return status-only metadata while running (and the agent's final result when done) — never the raw transcript stream. The bash/remote behavior (stdout tail) is fine; local_agent is the special case the description already acknowledges.

Repro

  1. Launch an Agent-tool subagent in the background (run_in_background: true).
  2. While it runs, call TaskOutput {task_id, block: true, timeout: 300000}.
  3. On timeout, the result contains the truncated JSONL transcript (observed ~10k tokens incl. a base64 signature blob) instead of status-only.

Version: claude-code 2.1.206, linux.

Workaround

Never call TaskOutput on local_agent tasks; wait for the task-notification instead.

Suggested fix

In the TaskOutput handler, branch on task type: local_agent → {status, elapsed, lastToolName} while running; final Agent result when complete.

View original on GitHub ↗