Skip to content

Conversation

@isaacs
Copy link
Member

@isaacs isaacs commented Dec 8, 2025

@linear
Copy link

linear bot commented Dec 8, 2025

@isaacs isaacs requested a review from RulaKhaled December 8, 2025 21:14
@isaacs isaacs force-pushed the isaacschlueter/js-1218-js-google-genai-response-model-missing branch from c076192 to ff94aff Compare December 8, 2025 21:14
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.81 kB - -
@sentry/browser - with treeshaking flags 23.3 kB - -
@sentry/browser (incl. Tracing) 41.55 kB - -
@sentry/browser (incl. Tracing, Profiling) 46.14 kB - -
@sentry/browser (incl. Tracing, Replay) 79.97 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.7 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 84.64 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 96.89 kB - -
@sentry/browser (incl. Feedback) 41.52 kB - -
@sentry/browser (incl. sendFeedback) 29.49 kB - -
@sentry/browser (incl. FeedbackAsync) 34.48 kB - -
@sentry/react 26.52 kB - -
@sentry/react (incl. Tracing) 43.75 kB - -
@sentry/vue 29.27 kB - -
@sentry/vue (incl. Tracing) 43.36 kB - -
@sentry/svelte 24.82 kB - -
CDN Bundle 27.24 kB - -
CDN Bundle (incl. Tracing) 42.23 kB - -
CDN Bundle (incl. Tracing, Replay) 78.75 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 84.21 kB - -
CDN Bundle - uncompressed 80.04 kB - -
CDN Bundle (incl. Tracing) - uncompressed 125.39 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 241.42 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 254.18 kB - -
@sentry/nextjs (client) 45.97 kB - -
@sentry/sveltekit (client) 41.92 kB - -
@sentry/node-core 51.5 kB - -
@sentry/node 159.95 kB +0.08% +124 B 🔺
@sentry/node - without tracing 92.91 kB - -
@sentry/aws-serverless 108.44 kB - -

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,746 - 8,679 +1%
GET With Sentry 1,691 19% 1,681 +1%
GET With Sentry (error only) 6,023 69% 6,043 -0%
POST Baseline 1,193 - 1,203 -1%
POST With Sentry 586 49% 581 +1%
POST With Sentry (error only) 1,064 89% 1,052 +1%
MYSQL Baseline 3,340 - 3,297 +1%
MYSQL With Sentry 477 14% 426 +12%
MYSQL With Sentry (error only) 2,695 81% 2,665 +1%

View base workflow run

@isaacs isaacs force-pushed the isaacschlueter/js-1218-js-google-genai-response-model-missing branch from ff94aff to 75f40f5 Compare December 8, 2025 22:36

span.setAttributes({
[GEN_AI_REQUEST_MESSAGES_ATTRIBUTE]: JSON.stringify(truncateGenAiMessages(messages)),
[GEN_AI_RESPONSE_MODEL_ATTRIBUTE]: String(params.model),

This comment was marked as outdated.

@isaacs isaacs force-pushed the isaacschlueter/js-1218-js-google-genai-response-model-missing branch from 75f40f5 to 63be4b7 Compare December 8, 2025 22:49
@isaacs isaacs force-pushed the isaacschlueter/js-1218-js-google-genai-response-model-missing branch from 63be4b7 to 0a5ed6e Compare December 8, 2025 23:24
Comment on lines 156 to 160
if (Array.isArray(params.contents)) {
messages.push(...params.contents);
} else {
messages.push({ role: 'user', content: params.contents });
}

This comment was marked as outdated.

span.setAttributes({ [GEN_AI_REQUEST_MESSAGES_ATTRIBUTE]: truncatedMessage });
if (Array.isArray(params.message)) {
messages.push(...params.message);
} else {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Part arrays incorrectly spread as individual messages

When params.message is Part[] (array of parts for a single user message), the code spreads each Part object as a separate item in the messages array. However, Part objects like { text: "hello" } don't have content: string or parts: Array properties required by the truncation logic in truncateGenAiMessages. When truncation is needed, these Part objects fail both isContentMessage and isPartsMessage checks, causing truncateSingleMessage to return an empty array and silently drop the data. The Part[] should instead be wrapped as { role: 'user', parts: params.message } to match the Google GenAI Content format. The same issue affects contents when it's PartUnion[].

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Member

@nicohrubec nicohrubec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me. Maybe we could also update the main scenario in our node integration tests to verify that this works as expected?

isaacs added a commit that referenced this pull request Dec 9, 2025
Move the message reformatting into a separate util for google-genai, and
add unit test coverage for that file.

Add an integration test scenario to ensure that the system message will
be included if provided in the config params.

Related to getsentry/testing-ai-sdk-integrations#10

Fix JS-1218
@isaacs isaacs force-pushed the isaacschlueter/js-1218-js-google-genai-response-model-missing branch from 0a5ed6e to cd250d2 Compare December 9, 2025 21:55
isaacs added a commit that referenced this pull request Dec 9, 2025
Move the message reformatting into a separate util for google-genai, and
add unit test coverage for that file.

Add an integration test scenario to ensure that the system message will
be included if provided in the config params.

Related to getsentry/testing-ai-sdk-integrations#10

Fix JS-1218
@isaacs isaacs force-pushed the isaacschlueter/js-1218-js-google-genai-response-model-missing branch from cd250d2 to 47e85eb Compare December 9, 2025 22:06
Move the message reformatting into a separate util for google-genai, and
add unit test coverage for that file.

Add an integration test scenario to ensure that the system message will
be included if provided in the config params.

Related to getsentry/testing-ai-sdk-integrations#10

Fix JS-1218
@isaacs isaacs force-pushed the isaacschlueter/js-1218-js-google-genai-response-model-missing branch from 47e85eb to e2a9837 Compare December 10, 2025 16:35
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.

3 participants