refactor(trace): record output messages through record() - #171
Draft
rgao-coreweave wants to merge 1 commit into
Draft
refactor(trace): record output messages through record()#171rgao-coreweave wants to merge 1 commit into
rgao-coreweave wants to merge 1 commit into
Conversation
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
HiveMind Sessions4 sessions · 40m · $13
View all sessions in HiveMind → Run |
rgao-coreweave
force-pushed
the
turn-record-output-messages
branch
from
August 14, 2026 18:57
c49a807 to
8fdc2a9
Compare
rgao-coreweave
force-pushed
the
turn-record-output-messages
branch
from
August 14, 2026 19:26
8fdc2a9 to
f1936b9
Compare
rgao-coreweave
force-pushed
the
turn-record-output-messages
branch
from
August 17, 2026 16:47
f1936b9 to
2110d47
Compare
weave 0.16.6 adds outputMessages to both Turn.record() and SubAgent.record(), so all five gen_ai.output.messages writers stop hand-serializing the attribute. One recordOutput() helper replaces the per-site guard and shape code, so each call site is a single line and the already-ended guard lives in one place. assistantOutputMessages() has no callers left and is deleted. Wire format is unchanged, pinned by the assertions in the parent PR plus the existing subagent assertions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
rgao-coreweave
force-pushed
the
turn-record-output-messages
branch
from
August 17, 2026 16:47
2110d47 to
6c0c6d4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

0.16.5 added
outputMessagestoTurn.record(); 0.16.6 added it toSubAgent.record()too. That closes the parity gap, so all fivegen_ai.output.messageswriters migrate together instead of leaving a split.A single
recordOutput()helper holds the shape conversion and thealready-ended guard, so no call site repeats them. Net effect across the repo is
+2 lines.
assistantOutputMessages()has no callers left and is deleted;assistantMessages()is now module-private. AfterwardsATTR.OUTPUT_MESSAGESsurvives only as a constant used by tests, and no
src/code hand-serializesthe attribute.
Wire format is unchanged
Verified against a live in-memory exporter before writing the change:
Message.contentis an optional field the SDK stringifies verbatim, so{role, content}survives as-is, andSubAgent.end()serializes_outputMessagesexactly asTurn.end()does. Two independent pins confirm it: the turn-side assertions added in #170, and the pre-existing subagent assertions (25 of them fail if the subagent writes are removed).Two deliberate details
The
Turncalls stay guarded.record()writes atend()and warns when the span has already ended. Making it unconditional would emitweave.Turn.record() called after end()noise into the daemon log on recovery paths that write nothing today. Passingundefinedfor either field is a no-op inside the SDK, so a previously recorded model is never clobbered.gen_ai.response.modelis left alone.record({ model })writesgen_ai.request.model, a different attribute. ThesetAttributes({ [ATTR.RESPONSE_MODEL]: … })calls inhookHandler.tsare therefore not folded in, since that would silently move the value to a different key.Verification
tsc clean, 203/203 pass.
🤖 Generated with Claude Code