fix: rename to gen_ai.input.messages / gen_ai.output.messages (0.2.9)#21
Merged
Merged
Conversation
Sentry JS SDK 10.53.x follows the current OTel gen_ai semantic convention,
which renamed gen_ai.request.messages -> gen_ai.input.messages and
gen_ai.response.text -> gen_ai.output.messages. The SDK silently dropped
our legacy keys and initialized gen_ai.input.messages to an empty array
on the chat span, so Sentry's AI Conversations view treated every turn
as "no input -> no conversation" and stayed empty even though all the
sibling attributes (agent.name, conversation.id, provider, model, etc.)
were correct.
- src/spans.ts: rename on both invoke_agent (agent) and chat (child)
spans; output is now serialized as [{role:"assistant", content:response}]
to match the array shape the SDK expects.
- src/subagent.ts: same rename on the synthesized subagent invoke_agent.
- tests/spans.test.ts: updated 6 assertions to the new attribute names.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e3881e1 to
ee4ddcf
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.
Summary
gen_ai.request.messages→gen_ai.input.messagesandgen_ai.response.text→gen_ai.output.messagesto match the current OTel gen_ai semantic convention that@sentry/node10.53.x follows.[{role: "assistant", content: response}]so the value shape matches what the SDK expects for output messages.src/subagent.ts).package.json,.claude-plugin/plugin.json,.claude-plugin/marketplace.json.Why
0.2.8 mirrored the prompt onto the chat child as
gen_ai.request.messages, but the Sentry SDK silently dropped the legacy keys and initializedgen_ai.input.messagesto[]. Confirmed by inspecting a live span —gen_ai.input.messages: []with nogen_ai.request.messagespresent. AI Conversations reads the new key and treats[]as "no conversation", so the view stayed empty.Test plan
pnpm buildcleanpnpm test— 424/424 pass/plugin update: send a turn, confirm the chat span showsgen_ai.input.messagesandgen_ai.output.messagespopulated in Sentry, AI Conversations view populates for the session.🤖 Generated with Claude Code