Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Nov 25, 2025

Two fixes for flaky integration tests:

1. sendMessageAndWait timeout handling
When sendMessageAndWait times out waiting for stream-end, it now throws an error with diagnostics instead of silently returning partial events.

  • Before: Confusing failures like expect(createStreamEnd).toBeDefined()
  • After: Clear error: Timeout waiting for stream-end after 15000ms with event diagnostics

2. resumeStream test fix
Fixed incorrect assumption that StreamEndEvent has a content field—it has a parts array of MuxTextPart | MuxReasoningPart | MuxToolPart. Now correctly extracts text from the parts.


Generated with mux

…ing partial events

The helper was ignoring the return value of waitForEvent, so when a
timeout occurred tests would get partial events without stream-end,
causing confusing assertion failures like 'expected undefined to be defined'.

Now throws a clear error with diagnostics: 'Timeout waiting for stream-end after Xms'
@ammar-agent ammar-agent force-pushed the fix-flaky-file-read-test branch from 0b8f139 to a8b537b Compare November 25, 2025 01:36
The test was flaky because stream-delta events can be batched or arrive
before the collector starts collecting. Using getFinalMessage().content
is more reliable since it's captured from the stream-end event.
@ammar-agent ammar-agent force-pushed the fix-flaky-file-read-test branch from a8b537b to 5c7dff9 Compare November 25, 2025 01:40
@ammar-agent ammar-agent changed the title 🤖 fix: throw on sendMessageAndWait timeout for clearer test failures 🤖 fix: de-flake integration tests (sendMessageAndWait timeout + resumeStream) Nov 25, 2025
@ammario ammario merged commit e18a1dc into main Nov 25, 2025
13 checks passed
@ammario ammario deleted the fix-flaky-file-read-test branch November 25, 2025 01:49
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.

2 participants