From 1b3a3b003fb1ec69d9b35a54e12096cc79756dfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Wed, 16 Sep 2026 23:45:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=AA=A8=E6=9E=B6=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E9=87=8D=E5=A4=8D=E4=B8=8B=E5=8F=91=20turn.started?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - harness.ts 记录运行态"最新回合是否在跑",emitDirectThreadEvents 只在生命周期事件上更新 - completeDirectThreadTurn 仅在回合没在跑时补 turn.started,避免与用例先发的事件重叠 --- .../tests/appSurface/harness.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/ai-game-creator-shell/tests/appSurface/harness.ts b/apps/ai-game-creator-shell/tests/appSurface/harness.ts index d0e923feb..dc18ea287 100644 --- a/apps/ai-game-creator-shell/tests/appSurface/harness.ts +++ b/apps/ai-game-creator-shell/tests/appSurface/harness.ts @@ -754,6 +754,9 @@ function createProjectSupervisorRuntimeHarness({ let pendingDirectThreadEvents: Array> = []; let directThreadHistoryItems: Array> = []; let directThreadLastCompletedItemId: string | null = null; + // 运行态事件里只有一个"最新回合是否在跑"的布尔:与 Thread Manager 只保留一条生命周期 + // 锚点一致,重复 `turn.started` 在生产里不会出现。 + let directThreadTurnRunning = false; const conversationRecord = ( role: 'user' | 'assistant', @@ -1184,6 +1187,10 @@ function createProjectSupervisorRuntimeHarness({ const emitDirectThreadEvents = ( ...events: Array> ) => { + for (const event of events) { + if (event.type === 'turn.started') directThreadTurnRunning = true; + if (event.type === 'turn.completed') directThreadTurnRunning = false; + } pendingDirectThreadEvents.push(...events); if (directThreadSubscriptionId) { directThreadNotifyHandler?.({ @@ -1303,7 +1310,10 @@ function createProjectSupervisorRuntimeHarness({ at?: number; status?: string; }) { - const events: Array> = [{ type: 'turn.started' }]; + // 生命周期锚点只有一份:回合已经在跑时不再补 `turn.started`。 + const events: Array> = directThreadTurnRunning + ? [] + : [{ type: 'turn.started' }]; if (prompt.trim()) { events.push({ type: 'item.completed',