Files
Agent-System/web/src/hooks/useTaskRunAttempts.test.ts
T
weichenandCursor 57873f6c84 refactor(web): retry chat and task runs from one hook
Keep reconnect on the existing run id so a dropped stream does not start a second task.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-19 12:05:01 +00:00

16 lines
758 B
TypeScript

import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import test from 'node:test';
test('chat and task attempts live in one hook', () => {
const app = readFileSync(new URL('../App.tsx', import.meta.url), 'utf8');
const hook = readFileSync(new URL('./useTaskRunAttempts.ts', import.meta.url), 'utf8');
assert.equal((app.match(/useTaskRunAttempts\(/g) || []).length, 1);
assert.equal(app.includes('streamChat('), false);
assert.equal(app.includes('createTaskRun('), false);
assert.equal(hook.includes('streamChat'), true);
assert.equal(hook.includes('createTaskRun'), true);
assert.equal(hook.includes('shouldSubscribeExistingRun'), true);
assert.equal(hook.includes('禁止无条件 setRunId(null)'), true);
});