diff --git a/packages/runtime-host/src/__tests__/execution-host.test.ts b/packages/runtime-host/src/__tests__/execution-host.test.ts index 94c8616bea..4f14d40622 100644 --- a/packages/runtime-host/src/__tests__/execution-host.test.ts +++ b/packages/runtime-host/src/__tests__/execution-host.test.ts @@ -1486,6 +1486,8 @@ test('steering becomes durable and ordered followups automatically start the nex const host = await fixture.startHost(); const first = await connectClient(fixture.root, 'desktop'); const second = await connectClient(fixture.root, 'tui'); + const subscription = await second.openSessionSubscription({ sessionId: fixture.sessionId }); + const subscriptionProbe = new SubscriptionProbe(subscription); const firstTurnId = randomUUID(); await first.startTurn({ sessionId: fixture.sessionId, @@ -1559,6 +1561,21 @@ test('steering becomes durable and ordered followups automatically start the nex content: { text: 'deliberately different durable identity probe' }, placement: 'next_turn', }); + const successor = await subscriptionProbe.waitFor( + (frame) => + frame.kind === 'subscription.session_projection' && + frame.snapshot.rootTurn !== null && + frame.snapshot.rootTurn.turnId !== firstTurnId, + 'ordered follow-ups did not start the successor root', + ); + assert.equal(successor.kind, 'subscription.session_projection'); + if (successor.kind !== 'subscription.session_projection' || !successor.snapshot.rootTurn) { + return; + } + const successorTurnId = successor.snapshot.rootTurn.turnId; + await waitForTerminalTurn(second, fixture.sessionId, successorTurnId); + await subscription.close(); + await subscriptionProbe.done; await first.close(); await second.close(); await fixture.stopHost(host); @@ -1596,6 +1613,7 @@ test('steering becomes durable and ordered followups automatically start the nex }); const followupTurnId = chain[1]?.turnId; assert.ok(followupTurnId); + assert.equal(followupTurnId, successorTurnId); const followupLedger = await fixture.readTurn(followupTurnId); const expectedQuotes = followupSources.flatMap((source) => source.content.quotes ?? []); assert.equal(followupLedger.userMessages.length, 1); @@ -2445,14 +2463,18 @@ async function withExecutionRoot(run: (fixture: ExecutionFixture) => Promise