Skip to content

test(agent): abort matrix for stream unhandled rejections (stacked on #122) - #130

Draft
LukasParke wants to merge 3 commits into
mainfrom
test/stream-abort-matrix
Draft

LukasParke wants to merge 3 commits into
mainfrom
test/stream-abort-matrix

Conversation

@LukasParke

Copy link
Copy Markdown
Contributor

Stacked on #122 (fork branch warun7:fix/unhandled-rejection-on-stream-abort). GitHub can't target a fork branch as a base, so this PR targets main and currently includes #122's commits. Once #122 merges, the diff here is only the new test file. Please merge #122 first.

What

Adds packages/agent/tests/unit/stream-abort-unhandled-rejection.test.ts, an 11-case abort matrix for #113. Each case asserts that the consumer rejects and that no process-level unhandledRejection fires:

  • each stream getter (getFullResponsesStream, getTextStream, getItemsStream, getReasoningStream, getToolStream, getToolCallsStream, getNewMessagesStream) aborted mid-stream
  • abort while a client tool is executing
  • early break, then abort
  • three parallel runs sharing one signal
  • getText() with and without tools

Why

#122's test only covers getFullResponsesStream. The fix lives on the shared broadcaster path, so a regression there would show up on the other getters too. Without the #122 fix, 7 of these 11 cases fail (all four other broadcaster-backed getters, early-break, parallel). With it, all 11 pass.

Tests only, so there's no changeset.

Test plan

  • pnpm install --frozen-lockfile, pnpm typecheck, pnpm lint, pnpm test (1248 agent tests pass)
  • Reverted model-result.ts to main locally: 7/11 cases fail, which confirms the matrix catches the regression

Refs #113, #122

🤖 Generated with Claude Code

warun7 and others added 3 commits September 5, 2026 00:13
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ers (#113)

Covers every stream getter, abort during client tool execution, early
break then abort, parallel runs sharing one signal, and getText with and
without tools. 7 of the 11 cases fail without the #122 fix; #122's own
test covers only getFullResponsesStream.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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