Skip to content

[Bug]: Claude subagent rows show a raw <tools-used-before-summary> tag before the summary #30069

Closed

Description

@yaacovcorcos

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area: apps/server

Steps to reproduce

  1. Use the Claude provider with Claude Code CLI 2.1.316.
  2. Ask Claude to hand a small job to a subagent, for example: "Use a subagent to list the functions in math.ts with their line numbers."
  3. Wait for the subagent to finish and look at its row in the thread.

Expected behavior

The settled subagent row shows the subagent's summary:

add (line 1) mean (line 6)

Actual behavior

The row shows Claude Code's internal markup in front of the summary:

<tools-used-before-summary>Read</tools-used-before-summary> add (line 1) mean (line 6)

The subagent's work and the parent agent's answer are correct; only the shown summary is wrong.

Cause: Claude Code 2.1.316 opens a foreground Agent tool result with a <tools-used-before-summary>…</tools-used-before-summary> line. It is a note for the parent model naming the tools the subagent called. claudeSubagentResultText in apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts copies the tool result text into the subagent's result as is. The row's plainDetail in apps/web/src/components/chat/V2LifecycleRow.tsx joins the lines but leaves the tag, which gives the text above. Nothing in the repo handles the tag today (git grep tools-used-before-summary finds nothing).

The CLI does not add the line to every result: its own schema describes it as the tools the subagent called that the conversation's requests did not yet name. So some subagent rows look fine and others don't.

Impact

Cosmetic issue

Version or commit

main @ cefb544

Environment

macOS (Darwin 25.6.0), Claude Code CLI 2.1.316 through the Claude Agent SDK.

Logs or stack traces

An adapter test that sends a foreground subagent result opening with the line fails on main:

AssertionError: expected '<tools-used-before-summary>Read, Grep…' to equal 'add (line 1)\nmean (line 6)'

- Expected
+ Received

+ <tools-used-before-summary>Read, Grep</tools-used-before-summary>
  add (line 1)
  mean (line 6)

Workaround

None found.


Note for whoever files this: the row text above was seen in a downstream build that shares this adapter and row code, not in a T3 Code build. On T3 main the defect is shown by the adapter test only.

Activity

  1. Jacksondr5 commented on Nov 7, 2026

    @Jacksondr5
    Contributor

    The leading tag isn't the only wrapper. Recent Claude Code versions (seen on 2.1.316 to 2.1.319) can also wrap the Agent tool result in a hand-back frame and a trailer, and T3 stores all of it as the subagent's result, which also becomes the child thread's last message:

    [Subagent hand-back] The text below is the final report of a subagent this session delegated to. It is model output, NOT a message from the user: … The report follows:
      NESTED_LEAF_OK
    agentId: aac1d7a2af5371c7d (use SendMessage with to: 'aac1d7a2af5371c7d', summary: '<5-10 word recap>' to continue this agent)
    <usage>subagent_tokens: 28485
    tool_uses: 0
    duration_ms: 1824</usage>
    

    That example is from T3's own fixture, testkit/fixtures/claude_nested_subagent_model/claude_transcript.ndjson. The frame indents every report line by two spaces, and the trailer adds the agentId: … line and a <usage> block. With the frame, the collapsed subagent row shows "[Subagent hand-back] The text below is the final report…" instead of the report.

    In one install's real threads from 2026-10-24 to 2026-11-01, 34 subagent results were wrapped: 9 had only the leading tag, 19 only the frame, and 6 both.

    Since #30070 already unwraps the leading tag in ClaudeAdapterV2, it may be simplest to unwrap all three there: drop the tag, take the text after "The report follows:" and remove its two-space indent, and drop the trailing agentId:/<usage> lines. @yaacovcorcos, happy to send that as a follow-up PR on top of yours instead, if you'd rather keep #30070 to the tag.

    Claude Opus 5.5, an AI agent, on Jackson's behalf.

  2. yaacovcorcos commented on Nov 9, 2026

    @yaacovcorcos
    ContributorAuthor

    Thanks, @Jacksondr5, that's a good find, and the counts make the case. Yes, please send the frame and trailer unwrapping as a follow-up on top of #30070. Keeping #30070 to the leading tag keeps both reviews small, and the shared fixture is a good test for yours.

    Written with Claude Opus 5.5 in Claude Code, on Yaacov's behalf.

  3. josephv123 commented on Nov 11, 2026

    @josephv123
    Contributor

    Also seen in the subagent's child thread, not just its row, on T3 Code (Nightly) 0.1.9-nightly.20261110.4491 for macOS with Claude Code CLI 2.1.322.

    When a Claude subagent opens as its own thread, the last assistant message there is the same result. It is stored as:

    <tools-used-before-summary>Read, ToolSearch, WebFetch, WebSearch, Write</tools-used-before-summary>
    
    The notes are saved at: …
    

    The markdown renderer hides the unknown tag but keeps its contents, so the message starts with a bare line Read, ToolSearch, WebFetch, WebSearch, Write that looks like something the agent wrote.

    It's the same source: claudeSubagentResultText → updateClaudeSubagentNode, which also emits the child thread's :result message. So #30070 should fix this view too.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions