Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 58c1aaa. Configure here.
| }) | ||
| .start() | ||
| .completed(); | ||
| }); |
There was a problem hiding this comment.
Cache token test not skipped on v6
Medium Severity
The new cache-token test is registered for both matrix versions, but v6 cannot derive cache counts from this gateway scenario. Nearby version-specific cases use test.skipIf, so the v6 entry will assert gen_ai.usage.input_tokens.cache_read and cache_creation values that that path never writes.
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit 58c1aaa. Configure here.
There was a problem hiding this comment.
this seems to work just fine
size-limit report 📦
|
| const invokeAgent = container.items.find( | ||
| span => span.attributes['sentry.op']?.value === 'gen_ai.invoke_agent', | ||
| )!; | ||
| expect(invokeAgent).toBeDefined(); | ||
| expect(invokeAgent.attributes[GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS]?.value).toBe(80); | ||
| expect(invokeAgent.attributes[GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS]?.value).toBe(20); | ||
| }, | ||
| }) | ||
| .start() | ||
| .completed(); | ||
| }); |
There was a problem hiding this comment.
Bug: The test 'reads cache token counts from the SDK usage object' is missing a test.skipIf(version === '6') condition, causing it to fail for the v6 test matrix.
Severity: LOW
Suggested Fix
Wrap the test case 'reads cache token counts from the SDK usage object' with a skip condition to prevent it from running against v6. Use test.skipIf(version === '6') around the test definition, similar to other version-specific tests in the suite.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location:
dev-packages/node-integration-tests/suites/tracing/vercelai/v6_v7/test.ts#L820-L843
Potential issue: The integration test `'reads cache token counts from the SDK usage
object'` is intended to run for both v6 and v7 of the Vercel AI SDK. However, the test
is missing a required skip condition for v6. The test asserts that cache token counts
are derived from the SDK's usage object, a feature specific to v7. The v6 OTel
integration derives these counts from `providerMetadata` and cannot handle the `gateway`
provider metadata shape used in this test scenario. As a result, the test will
incorrectly execute and fail during CI runs for v6.
Did we get this right? 👍 / 👎 to inform future reviews.
Add a node integration test that runs the real `ai@^7` package through the channel subscriber with `providerMetadata` keyed `gateway` (the AI Gateway shape), asserting cache read/write counts are still derived from the SDK's normalized usage. Skipped on v6, whose OTel processor only reads `providerMetadata`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
58c1aaa to
27897d2
Compare


Stacked on #24350. Adds an end-to-end node integration test that exercises the cache-token fix against the real
ai@^7package, not just the unit test in the base PR.The scenario drives
generateTextthrough a mock model whose usage carries cache read/write counts in the v7 shape (inputTokens.{cacheRead,cacheWrite}) whileproviderMetadatais keyedgateway— the Vercel AI Gateway shape that has no provider-specific cache key. Without the base PR the channel subscriber drops these counts; the test asserts they land on both thegenerate_contentandinvoke_agentspans. It's skipped on v6, whose OTel-processor path derives cache counts fromproviderMetadataalone and can't see the gateway case.🤖 Generated with Claude Code