Skip to content

fix(daemon): final-message root output, normalized chat-span parts - #135

Draft
rgao-coreweave wants to merge 1 commit into
mainfrom
rgao/output-messages-contract
Draft

fix(daemon): final-message root output, normalized chat-span parts#135
rgao-coreweave wants to merge 1 commit into
mainfrom
rgao/output-messages-contract

Conversation

@rgao-coreweave

Copy link
Copy Markdown
Contributor

Summary

  • The root invoke_agent turn span now carries only the final assistant message on gen_ai.output.messages. Interstitial text already renders as ordered assistant_text child spans, and re-dumping every text block on the root is what collapsed the Agents chat view into one trailing message.
  • Chat spans now emit normalized GenAI parts (text/thinking become {type, content}, tool_use becomes {type: 'tool_call', toolCallId, toolName, arguments}) instead of raw Anthropic blocks, matching the Codex plugin. Covers both the main-agent path (emitChatSpanForResponse) and the subagent/teammate path (emitChatSpansFromAssistantCalls); deletes the now-dead assistantBlocksToText.
  • Open question: tool_call parts duplicate the sibling execute_tool spans (Codex does the same). If the chat view keys off tool spans instead, we can drop tool entries from parts.

Test plan

  • New tests/output-messages-contract.test.ts: root output with and without last_assistant_message, normalized parts on both chat-span paths, and a redacted_thinking-only response emitting no gen_ai.output.messages.
  • npm run check green (build + 90 tests).
  • Pending before merge: live-trace check that the Agents chat view interleaves correctly (item A validation steps in the re-eval doc).

🤖 Generated with Claude Code

The root invoke_agent span re-dumped every text block of the turn as
gen_ai.output.messages, and chat spans passed raw Anthropic content blocks
as parts. Both collapsed the Weave Agents chat view into one trailing
message. Root output is now the final assistant message only (interstitial
text renders as ordered assistant_text child spans), and chat-span parts are
normalized to the GenAI shape the chat view expects, matching the Codex
plugin.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant