Skip to content

Commit 5a4993e

Browse files
Lms24claude
andcommitted
test(vercelai): Drop both timers from the abort scenario
Aborting from inside `doStream` hits the same pre-first-chunk race without a timer, and the trailing sleep was not load-bearing — the scenario still fails pre-fix without it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent b6eca78 commit 5a4993e

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

‎dev-packages/node-integration-tests/suites/tracing/vercelai/v6_v7/scenario-aborted-stream-text.mjs‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ import { MockLanguageModelV3 } from 'ai/test';
44

55
async function run() {
66
await Sentry.startSpan({ op: 'function', name: 'main' }, async () => {
7-
// `fetch()` rejects with the signal's reason on abort, and `@hono/node-server` aborts with a
8-
// plain string — so there is no `AbortError` name to suppress by.
7+
const controller = new AbortController();
8+
9+
// Abort the moment the model is asked for a stream, so the operation fails before its first
10+
// chunk. `fetch()` rejects with the signal's reason on abort, and `@hono/node-server` aborts
11+
// with a plain string — so there is no `AbortError` name to suppress by.
912
const model = new MockLanguageModelV3({
1013
doStream: ({ abortSignal }) =>
1114
new Promise((_, reject) => {
1215
abortSignal.addEventListener('abort', () => reject(abortSignal.reason), { once: true });
16+
controller.abort('Client connection prematurely closed.');
1317
}),
1418
});
1519

16-
const controller = new AbortController();
1720
const result = streamText({
1821
experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },
1922
maxRetries: 0,
@@ -22,15 +25,10 @@ async function run() {
2225
abortSignal: controller.signal,
2326
});
2427

25-
setTimeout(() => controller.abort('Client connection prematurely closed.'), 50);
26-
2728
for await (const _part of result.textStream) {
2829
void _part;
2930
}
3031
});
31-
32-
// Unhandled rejections are reported a turn later; don't let the process exit before that.
33-
await new Promise(resolve => setTimeout(resolve, 300));
3432
}
3533

3634
run();

0 commit comments

Comments
 (0)