测试骨架不再重复下发 turn.started
- harness.ts 记录运行态"最新回合是否在跑",emitDirectThreadEvents 只在生命周期事件上更新 - completeDirectThreadTurn 仅在回合没在跑时补 turn.started,避免与用例先发的事件重叠
This commit is contained in:
@@ -754,6 +754,9 @@ function createProjectSupervisorRuntimeHarness({
|
||||
let pendingDirectThreadEvents: Array<Record<string, unknown>> = [];
|
||||
let directThreadHistoryItems: Array<Record<string, unknown>> = [];
|
||||
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<Record<string, unknown>>
|
||||
) => {
|
||||
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<Record<string, unknown>> = [{ type: 'turn.started' }];
|
||||
// 生命周期锚点只有一份:回合已经在跑时不再补 `turn.started`。
|
||||
const events: Array<Record<string, unknown>> = directThreadTurnRunning
|
||||
? []
|
||||
: [{ type: 'turn.started' }];
|
||||
if (prompt.trim()) {
|
||||
events.push({
|
||||
type: 'item.completed',
|
||||
|
||||
Reference in New Issue
Block a user