Conversation
Contributor
size-limit report 📦
|
JPeer264
force-pushed
the
jp/e2e-stream-cloudflare-vercelai-v7
branch
from
September 1, 2026 15:21
9ab59af to
346c2fc
Compare
JPeer264
force-pushed
the
jp/e2e-stream-cloudflare-vercelai-v7
branch
from
September 2, 2026 06:21
346c2fc to
7800f8e
Compare
JPeer264
force-pushed
the
jp/e2e-stream-cloudflare-vercelai-v7
branch
from
September 2, 2026 07:10
7800f8e to
6cb6f44
Compare
JPeer264
force-pushed
the
jp/e2e-stream-cloudflare-vercelai-v7
branch
from
September 2, 2026 07:46
6cb6f44 to
e2d1685
Compare
JPeer264
marked this pull request as ready for review
September 2, 2026 07:49
andreiborza
approved these changes
Sep 2, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
JPeer264
force-pushed
the
jp/e2e-stream-cloudflare-vercelai-v7
branch
from
September 2, 2026 11:30
e2d1685 to
de3e557
Compare
Comment on lines
+15
to
+16
| const invokeAgentSpan = genAiSpans.find(span => getSpanOp(span) === 'gen_ai.invoke_agent'); | ||
| const generateContentSpan = genAiSpans.find(span => getSpanOp(span) === 'gen_ai.generate_content'); |
Contributor
There was a problem hiding this comment.
Bug: The test assumes invoke_agent and generate_content spans arrive in the same envelope. With streaming enabled, they might arrive separately, causing generateContentSpan to be undefined and the test to fail.
Severity: MEDIUM
Suggested Fix
To make the test robust against spans arriving in different envelopes, replace the waitForStreamedSpans function with collectStreamedSpans. The collectStreamedSpans function is designed to accumulate all spans for a trace across multiple envelopes, ensuring that both invoke_agent and generate_content spans are available for assertion regardless of how they are flushed.
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/e2e-tests/test-applications/cloudflare-vercelai-v7/tests/index.test.ts#L15-L16
Potential issue: The test logic at this location has been updated to assert on streamed
spans. However, it uses the `waitForStreamedSpans` function, which only captures spans
from a single data envelope. With the removal of `traceLifecycle: 'static'`, the
Cloudflare SDK's `SpanStreaming` integration is enabled by default. This integration may
flush the `invoke_agent` and `generate_content` spans in separate envelopes. If this
occurs, `waitForStreamedSpans` will only capture the first envelope, likely containing
just the `invoke_agent` span. As a result, the `generateContentSpan` variable will be
`undefined`, causing the test assertion that checks its `parent_span_id` to fail.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
Ports
cloudflare-vercelai-v7to span streaming. The spec already asserted on streamed spans, so this only removes the static pin and a comment that described gen_ai extraction as a special case.