Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

SteeringCompletion.integration.test.ts

709 lines26.5 KB

1import { assert, it } from "@effect/vitest";
2import {
3 CommandId,
4 MessageId,
5 EventId,
6 NodeId,
7 ProjectId,
8 ProviderDriverKind,
9 ProviderInstanceId,
10 ProviderThreadId,
11 ProviderTurnId,
12 ThreadId,
13 type ModelSelection,
14 type OrchestrationV2DomainEvent,
15} from "@t3tools/contracts";
16import * as DateTime from "effect/DateTime";
17import * as Deferred from "effect/Deferred";
18import * as Effect from "effect/Effect";
19import * as Fiber from "effect/Fiber";
20import * as Queue from "effect/Queue";
21import * as Stream from "effect/Stream";
22import { CodexProviderCapabilitiesV2 } from "./Adapters/CodexAdapterV2.ts";
23import * as EffectWorker from "./EffectWorker.ts";
24import * as EventSink from "./EventSink.ts";
25import * as Orchestrator from "./Orchestrator.ts";
26import {
27 ProviderAdapterSteerRunError,
28 type ProviderAdapterV2Event,
29 type ProviderAdapterV2Shape,
30 type ProviderAdapterV2TurnInput,
31} from "@t3tools/provider-core/server/ProviderAdapter";
32import * as ProviderAdapterRegistry from "./ProviderAdapterRegistry.ts";
33import * as ProviderReplayHarness from "./testkit/ProviderReplayHarness.ts";
34import { checkpointWorkspace } from "@t3tools/provider-testing/replayWorkspace";
35​
36const driver = ProviderDriverKind.make("codex");
37const instanceId = ProviderInstanceId.make("codex");
38const modelSelection = { instanceId, model: "test-model" };
39​
40it.effect.each(
41 [false, true]
42 .flatMap((mailbox) =>
43 (
44 [
45 "before delivery",
46 "during delivery",
47 "before dispatch",
48 "after delivery",
49 "without native steering",
50 "with interrupting native steering",
51 "settled only",
52 ] as const
53 ).map((timing) => ({
54 mailbox,
55 timing,
56 label: mailbox ? "mailbox notification" : "steering",
57 })),
58 )
59 .filter(
60 ({ mailbox, timing }) =>
61 mailbox ||
62 (timing !== "without native steering" &&
63 timing !== "with interrupting native steering" &&
64 timing !== "settled only"),
65 ),
66)("delivers $label when completion wins $timing", ({ mailbox, timing }) =>
67 Effect.scoped(
68 Effect.gen(function* () {
69 const cwd = yield* checkpointWorkspace(`steering-completion-${timing.replaceAll(" ", "-")}`);
70 const events = yield* Queue.unbounded<ProviderAdapterV2Event>();
71 const started: ProviderAdapterV2TurnInput[] = [];
72 const steerEntered = yield* Deferred.make<void>();
73 const rejectSteer = yield* Deferred.make<void>();
74 let steerCalls = 0;
75 const capabilities = {
76 ...CodexProviderCapabilitiesV2,
77 turns: {
78 ...CodexProviderCapabilitiesV2.turns,
79 supportsActiveSteering: timing !== "without native steering",
80 activeSteeringInterruptsTools: timing === "with interrupting native steering",
81 },
82 };
83 const adapter: ProviderAdapterV2Shape = {
84 instanceId,
85 driver,
86 getCapabilities: () => Effect.succeed(capabilities),
87 planSelectionTransition: () => Effect.succeed({ type: "apply_on_next_turn" }),
88 openSession: (input) =>
89 Effect.gen(function* () {
90 const now = yield* DateTime.now;
91 return {
92 instanceId,
93 driver,
94 providerSessionId: input.providerSessionId,
95 providerSession: {
96 id: input.providerSessionId,
97 driver,
98 providerInstanceId: instanceId,
99 status: "ready",
100 cwd,
101 model: modelSelection.model,
102 capabilities,
103 createdAt: now,
104 updatedAt: now,
105 lastError: null,
106 },
107 events: Stream.fromQueue(events),
108 ensureThread: ({ threadId }) =>
109 Effect.succeed({
110 id: ProviderThreadId.make(`provider-thread:${threadId}`),
111 driver,
112 providerInstanceId: instanceId,
113 providerSessionId: input.providerSessionId,
114 appThreadId: threadId,
115 ownerNodeId: null,
116 nativeThreadRef: { driver, nativeId: "native-thread", strength: "strong" },
117 nativeConversationHeadRef: null,
118 status: "idle",
119 firstRunOrdinal: null,
120 lastRunOrdinal: null,
121 handoffIds: [],
122 forkedFrom: null,
123 createdAt: now,
124 updatedAt: now,
125 }),
126 resumeThread: ({ providerThread }) => Effect.succeed(providerThread),
127 startTurn: (turn) =>
128 Effect.gen(function* () {
129 started.push(turn);
130 yield* Queue.offer(events, {
131 type: "provider_turn.updated",
132 driver,
133 providerTurn: {
134 id: ProviderTurnId.make(`provider-turn:${turn.attemptId}`),
135 providerThreadId: turn.providerThread.id,
136 nodeId: turn.rootNodeId,
137 runAttemptId: turn.attemptId,
138 nativeTurnRef: {
139 driver,
140 nativeId: `native:${turn.attemptId}`,
141 strength: "strong",
142 },
143 ordinal: turn.providerTurnOrdinal,
144 status: "running",
145 startedAt: now,
146 completedAt: null,
147 },
148 });
149 }),
150 steerTurn: (turn) =>
151 Effect.gen(function* () {
152 steerCalls += 1;
153 if (timing === "after delivery") return;
154 yield* Deferred.succeed(steerEntered, undefined);
155 yield* Deferred.await(rejectSteer);
156 return yield* new ProviderAdapterSteerRunError({
157 driver,
158 providerThreadId: turn.providerThread.id,
159 providerTurnId: turn.providerTurnId,
160 cause: "turn already completed",
161 });
162 }),
163 interruptTurn: () => Effect.void,
164 respondToRuntimeRequest: () => Effect.void,
165 readThreadSnapshot: () => Effect.die("unused"),
166 rollbackThread: () => Effect.die("unused"),
167 forkThread: () => Effect.die("unused"),
168 };
169 }),
170 };
171 yield* Effect.gen(function* () {
172 const orchestrator = yield* Orchestrator.OrchestratorV2;
173 const worker = yield* EffectWorker.OrchestrationEffectWorkerV2;
174 const threadId = ThreadId.make("thread:steering-completion");
175 const watch = (predicate: (event: OrchestrationV2DomainEvent) => boolean) =>
176 orchestrator.streamDomainEvents.pipe(
177 Stream.filter(predicate),
178 Stream.take(1),
179 Stream.runDrain,
180 Effect.forkScoped,
181 );
182 yield* orchestrator.dispatch({
183 type: "thread.create",
184 commandId: CommandId.make("create"),
185 threadId,
186 projectId: ProjectId.make("project:steering-completion"),
187 title: "Steering race",
188 modelSelection,
189 runtimeMode: "full-access",
190 interactionMode: "default",
191 branch: null,
192 worktreePath: cwd,
193 createdBy: "user",
194 creationSource: "web",
195 });
196 yield* orchestrator.dispatch({
197 type: "message.dispatch",
198 commandId: CommandId.make("first"),
199 threadId,
200 messageId: MessageId.make("message:first"),
201 text: "first",
202 attachments: [],
203 dispatchMode: { type: "start_immediately" },
204 createdBy: "user",
205 creationSource: "web",
206 });
207 const running = yield* watch(
208 (event) => event.type === "provider-turn.updated" && event.payload.status === "running",
209 );
210 yield* worker.drain();
211 yield* Fiber.join(running);
212 const first = started[0]!;
213 const messageId = MessageId.make("message:steering");
214 const taskId = NodeId.make("task:mailbox");
215 if (mailbox) {
216 const sink = yield* EventSink.EventSinkV2;
217 const current = yield* orchestrator.getThreadProjection(threadId);
218 const parentRun = current.runs.find((run) => run.id === first.runId)!;
219 const now = yield* DateTime.now;
220 yield* sink.write({
221 events: [
222 {
223 id: EventId.make("mailbox:cohort"),
224 type: "run.updated",
225 threadId,
226 runId: first.runId,
227 occurredAt: now,
228 payload: {
229 ...parentRun,
230 delegatedCompletion: {
231 disposition: "open",
232 nextGeneration: 2,
233 delivery: { generation: 1, messageId, taskIds: [taskId] },
234 },
235 },
236 },
237 {
238 id: EventId.make("mailbox:task"),
239 type: "subagent.updated",
240 threadId,
241 runId: first.runId,
242 nodeId: taskId,
243 occurredAt: now,
244 payload: {
245 id: taskId,
246 threadId,
247 runId: first.runId,
248 parentNodeId: first.rootNodeId,
249 origin: "app_owned",
250 createdBy: "agent",
251 driver,
252 providerInstanceId: instanceId,
253 providerThreadId: null,
254 childThreadId: null,
255 nativeTaskRef: null,
256 prompt: "Do background work",
257 title: "Background test",
258 model: null,
259 completionWake: timing === "settled only" ? "settled_only" : "always",
260 completionDelivery: { state: "claimed", observedByRunId: null },
261 status: "completed",
262 result: "done",
263 startedAt: now,
264 completedAt: now,
265 updatedAt: now,
266 },
267 },
268 ],
269 });
270 }
271 const dispatchSteer = orchestrator.dispatch({
272 type: "message.dispatch",
273 commandId: CommandId.make("steer"),
274 threadId,
275 messageId,
276 text: "fix the popover",
277 attachments: [
278 {
279 type: "image",
280 id: "steering-screenshot",
281 name: "image.png",
282 mimeType: "image/png",
283 sizeBytes: 10,
284 },
285 ],
286 dispatchMode: mailbox
287 ? { type: "queue_after_active" }
288 : { type: "steer_active", targetRunId: first.runId },
289 createdBy: mailbox ? "agent" : "user",
290 creationSource: mailbox ? "server" : "web",
291 ...(mailbox
292 ? {
293 delegatedCompletion: {
294 parentRunId: first.runId,
295 generation: 1,
296 taskIds: [taskId],
297 },
298 }
299 : {}),
300 });
301 if (timing !== "before dispatch") yield* dispatchSteer;
302 if (timing === "after delivery") yield* worker.drain();
303 const delivery =
304 timing === "during delivery" ? yield* worker.runOnce.pipe(Effect.forkScoped) : null;
305 if (delivery !== null) yield* Deferred.await(steerEntered);
306 const completed = yield* watch(
307 (event) =>
308 event.type === "run.updated" &&
309 event.payload.id === first.runId &&
310 event.payload.status === "waiting",
311 );
312 const projection = yield* orchestrator.getThreadProjection(threadId);
313 const turn = projection.providerTurns[0]!;
314 yield* Queue.offer(events, {
315 type: "provider_turn.updated",
316 driver,
317 providerTurn: { ...turn, status: "completed", completedAt: yield* DateTime.now },
318 });
319 yield* Queue.offer(events, {
320 type: "turn.terminal",
321 driver,
322 providerThreadId: turn.providerThreadId,
323 providerTurnId: turn.id,
324 runOrdinal: first.runOrdinal,
325 status: "completed",
326 failure: null,
327 threadDisposition: "reusable",
328 });
329 yield* Fiber.join(completed);
330 if (delivery !== null) {
331 yield* Deferred.succeed(rejectSteer, undefined);
332 yield* Fiber.join(delivery);
333 }
334 if (timing === "before dispatch") yield* dispatchSteer;
335 yield* worker.drain();
336 yield* orchestrator.resumeQueuedRuns;
337 yield* worker.drain();
338 if (timing === "after delivery") {
339 assert.equal(steerCalls, 1);
340 assert.equal(started.length, 1);
341 if (mailbox) {
342 const delivered = yield* orchestrator.getThreadProjection(threadId);
343 assert.equal(delivered.subagents[0]?.completionDelivery?.state, "delivered");
344 assert.equal(delivered.subagents[0]?.completionDelivery?.observedByRunId, null);
345 assert.equal(delivered.runs[0]?.delegatedCompletion?.delivery, null);
346 assert.equal(
347 delivered.turnItems.filter((item) => item.type === "notification").length,
348 1,
349 );
350 yield* orchestrator.dispatch({
351 type: "notification.delivery.accept",
352 commandId: CommandId.make("duplicate-acceptance"),
353 threadId,
354 messageId,
355 });
356 yield* worker.drain();
357 assert.equal(steerCalls, 1);
358 yield* orchestrator.dispatch({
359 type: "delegated_task.completion-delivery.acknowledge",
360 commandId: CommandId.make("read-result"),
361 parentThreadId: threadId,
362 taskId,
363 observedByRunId: first.runId,
364 });
365 const acknowledged = yield* orchestrator.getThreadProjection(threadId);
366 assert.equal(acknowledged.subagents[0]?.completionDelivery?.state, "acknowledged");
367 }
368 return;
369 }
370 assert.equal(started.length, 2);
371 assert.equal(started[1]?.message.messageId, messageId);
372 if (mailbox) assert.include(started[1]?.message.text ?? "", String(taskId));
373 else assert.equal(started[1]?.message.text, "fix the popover");
374 assert.deepEqual(started[1]?.message.attachments, [
375 {
376 type: "image",
377 id: "steering-screenshot",
378 name: "image.png",
379 mimeType: "image/png",
380 sizeBytes: 10,
381 },
382 ]);
383 assert.equal(steerCalls, timing === "during delivery" ? 1 : 0);
384 const final = yield* orchestrator.getThreadProjection(threadId);
385 assert.equal(final.messages.filter((message) => message.id === messageId).length, 1);
386 assert.equal(
387 final.messages.find((message) => message.id === messageId)?.runId,
388 started[1]?.runId,
389 );
390 assert.equal(
391 final.turnItems.filter((item) =>
392 mailbox
393 ? item.type === "notification"
394 : item.type === "user_message" && item.messageId === messageId,
395 ).length,
396 1,
397 );
398 yield* worker.drain();
399 assert.equal(started.length, 2);
400 }).pipe(
401 Effect.provide(
402 ProviderReplayHarness.layerWithRegistry(
403 { name: `steering-completion-${timing}` },
404 ProviderAdapterRegistry.layerSingle(adapter),
405 { runEffectWorker: false },
406 ),
407 ),
408 );
409 }),
410 ),
411);
412​
413// Claude and Pi steer live but cannot interrupt-and-restart, so a changed
414// selection waits for the next turn as the thread's saved selection.
415const runSelection = {
416 instanceId,
417 model: "test-model",
418 options: [{ id: "effort", value: "xhigh" }],
419};
420const composerSelection = {
421 ...runSelection,
422 options: [...runSelection.options, { id: "fastMode", value: false }],
423};
424​
425const nextTurnSelectionHarness = Effect.fn("nextTurnSelectionHarness")(function* (name: string) {
426 const cwd = yield* checkpointWorkspace(name);
427 const events = yield* Queue.unbounded<ProviderAdapterV2Event>();
428 const started: ProviderAdapterV2TurnInput[] = [];
429 const steered: string[] = [];
430 const capabilities = {
431 ...CodexProviderCapabilitiesV2,
432 turns: {
433 ...CodexProviderCapabilitiesV2.turns,
434 supportsActiveSteering: true,
435 supportsSteeringByInterruptRestart: false,
436 },
437 };
438 const adapter: ProviderAdapterV2Shape = {
439 instanceId,
440 driver,
441 getCapabilities: () => Effect.succeed(capabilities),
442 planSelectionTransition: () => Effect.succeed({ type: "apply_on_next_turn" }),
443 openSession: (input) =>
444 Effect.gen(function* () {
445 const now = yield* DateTime.now;
446 return {
447 instanceId,
448 driver,
449 providerSessionId: input.providerSessionId,
450 providerSession: {
451 id: input.providerSessionId,
452 driver,
453 providerInstanceId: instanceId,
454 status: "ready",
455 cwd,
456 model: runSelection.model,
457 capabilities,
458 createdAt: now,
459 updatedAt: now,
460 lastError: null,
461 },
462 events: Stream.fromQueue(events),
463 ensureThread: ({ threadId }) =>
464 Effect.succeed({
465 id: ProviderThreadId.make(`provider-thread:${threadId}`),
466 driver,
467 providerInstanceId: instanceId,
468 providerSessionId: input.providerSessionId,
469 appThreadId: threadId,
470 ownerNodeId: null,
471 nativeThreadRef: { driver, nativeId: "native-thread", strength: "strong" },
472 nativeConversationHeadRef: null,
473 status: "idle",
474 firstRunOrdinal: null,
475 lastRunOrdinal: null,
476 handoffIds: [],
477 forkedFrom: null,
478 createdAt: now,
479 updatedAt: now,
480 }),
481 resumeThread: ({ providerThread }) => Effect.succeed(providerThread),
482 startTurn: (turn) =>
483 Effect.gen(function* () {
484 started.push(turn);
485 yield* Queue.offer(events, {
486 type: "provider_turn.updated",
487 driver,
488 providerTurn: {
489 id: ProviderTurnId.make(`provider-turn:${turn.attemptId}`),
490 providerThreadId: turn.providerThread.id,
491 nodeId: turn.rootNodeId,
492 runAttemptId: turn.attemptId,
493 nativeTurnRef: {
494 driver,
495 nativeId: `native:${turn.attemptId}`,
496 strength: "strong",
497 },
498 ordinal: turn.providerTurnOrdinal,
499 status: "running",
500 startedAt: now,
501 completedAt: null,
502 },
503 });
504 }),
505 steerTurn: (turn) =>
506 Effect.sync(() => {
507 steered.push(turn.message.text);
508 }),
509 interruptTurn: () => Effect.void,
510 respondToRuntimeRequest: () => Effect.void,
511 readThreadSnapshot: () => Effect.die("unused"),
512 rollbackThread: () => Effect.die("unused"),
513 forkThread: () => Effect.die("unused"),
514 };
515 }),
516 };
517 const layer = ProviderReplayHarness.layerWithRegistry(
518 { name },
519 ProviderAdapterRegistry.layerSingle(adapter),
520 { runEffectWorker: false },
521 );
522 // Creates the thread and starts its first turn on `runSelection`.
523 const startFirstTurn = Effect.gen(function* () {
524 const orchestrator = yield* Orchestrator.OrchestratorV2;
525 const worker = yield* EffectWorker.OrchestrationEffectWorkerV2;
526 const threadId = ThreadId.make(`thread:${name}`);
527 yield* orchestrator.dispatch({
528 type: "thread.create",
529 commandId: CommandId.make("create"),
530 threadId,
531 projectId: ProjectId.make(`project:${name}`),
532 title: "Steer with changed options",
533 modelSelection: runSelection,
534 runtimeMode: "full-access",
535 interactionMode: "default",
536 branch: null,
537 worktreePath: cwd,
538 createdBy: "user",
539 creationSource: "web",
540 });
541 const running = yield* orchestrator.streamDomainEvents.pipe(
542 Stream.filter(
543 (event) => event.type === "provider-turn.updated" && event.payload.status === "running",
544 ),
545 Stream.take(1),
546 Stream.runDrain,
547 Effect.forkScoped,
548 );
549 yield* orchestrator.dispatch({
550 type: "message.dispatch",
551 commandId: CommandId.make("first"),
552 threadId,
553 messageId: MessageId.make("message:first"),
554 text: "first",
555 attachments: [],
556 modelSelection: runSelection,
557 dispatchMode: { type: "start_immediately" },
558 createdBy: "user",
559 creationSource: "web",
560 });
561 yield* worker.drain();
562 yield* Fiber.join(running);
563 return threadId;
564 });
565 return { events, started, steered, layer, startFirstTurn };
566});
567​
568it.effect("steers a changed turn-scoped selection into a provider that cannot restart", () =>
569 Effect.scoped(
570 Effect.gen(function* () {
571 const { started, steered, layer, startFirstTurn } = yield* nextTurnSelectionHarness(
572 "steering-selection-change",
573 );
574 yield* Effect.gen(function* () {
575 const orchestrator = yield* Orchestrator.OrchestratorV2;
576 const worker = yield* EffectWorker.OrchestrationEffectWorkerV2;
577 const threadId = yield* startFirstTurn;
578 const steer = (id: string, selection: ModelSelection) =>
579 orchestrator
580 .dispatch({
581 type: "message.dispatch",
582 commandId: CommandId.make(id),
583 threadId,
584 messageId: MessageId.make(`message:${id}`),
585 text: id,
586 attachments: [],
587 modelSelection: selection,
588 dispatchMode: { type: "steer_active", targetRunId: started[0]!.runId },
589 createdBy: "user",
590 creationSource: "web",
591 })
592 .pipe(Effect.andThen(worker.drain()));
593​
594 yield* steer("steer-changed", composerSelection);
595 const changed = yield* orchestrator.getThreadProjection(threadId);
596 assert.deepEqual(steered, ["steer-changed"]);
597 assert.equal(started.length, 1);
598 assert.lengthOf(changed.attempts, 1);
599 assert.equal(changed.runs[0]?.status, "running");
600 assert.deepEqual(changed.runs[0]?.modelSelection, runSelection);
601 assert.deepEqual(changed.thread.modelSelection, composerSelection);
602​
603 // Choosing the running run's selection again replaces the saved choice.
604 yield* steer("steer-reverted", runSelection);
605 const reverted = yield* orchestrator.getThreadProjection(threadId);
606 assert.deepEqual(steered, ["steer-changed", "steer-reverted"]);
607 assert.lengthOf(reverted.attempts, 1);
608 assert.deepEqual(reverted.thread.modelSelection, runSelection);
609​
610 // The saved choice moves to another instance while the run keeps going.
611 // Steering with the run's selection brings the thread's instance back too.
612 const otherSelection = {
613 instanceId: ProviderInstanceId.make("codex-work"),
614 model: "other",
615 };
616 const sink = yield* EventSink.EventSinkV2;
617 yield* sink.write({
618 events: [
619 {
620 id: EventId.make("switched-away"),
621 type: "thread.provider-switched",
622 threadId,
623 providerInstanceId: otherSelection.instanceId,
624 occurredAt: yield* DateTime.now,
625 payload: {
626 ...reverted.thread,
627 providerInstanceId: otherSelection.instanceId,
628 modelSelection: otherSelection,
629 },
630 },
631 ],
632 });
633 yield* steer("steer-back", runSelection);
634 const back = yield* orchestrator.getThreadProjection(threadId);
635 assert.deepEqual(steered, ["steer-changed", "steer-reverted", "steer-back"]);
636 assert.equal(back.thread.providerInstanceId, instanceId);
637 assert.deepEqual(back.thread.modelSelection, runSelection);
638 }).pipe(Effect.provide(layer));
639 }),
640 ),
641);
642​
643it.effect("starts a steer that missed the turn on the saved next-turn selection", () =>
644 Effect.scoped(
645 Effect.gen(function* () {
646 const { events, started, steered, layer, startFirstTurn } = yield* nextTurnSelectionHarness(
647 "steering-selection-follow-up",
648 );
649 yield* Effect.gen(function* () {
650 const orchestrator = yield* Orchestrator.OrchestratorV2;
651 const worker = yield* EffectWorker.OrchestrationEffectWorkerV2;
652 const threadId = yield* startFirstTurn;
653 const first = started[0]!;
654 yield* orchestrator.dispatch({
655 type: "message.dispatch",
656 commandId: CommandId.make("steer"),
657 threadId,
658 messageId: MessageId.make("message:steer"),
659 text: "late steer",
660 attachments: [],
661 modelSelection: composerSelection,
662 dispatchMode: { type: "steer_active", targetRunId: first.runId },
663 createdBy: "user",
664 creationSource: "web",
665 });
666 // The turn ends before the worker delivers the steer, so the steer
667 // becomes a follow-up turn.
668 const settled = yield* orchestrator.streamDomainEvents.pipe(
669 Stream.filter(
670 (event) =>
671 event.type === "run.updated" &&
672 event.payload.id === first.runId &&
673 event.payload.status === "waiting",
674 ),
675 Stream.take(1),
676 Stream.runDrain,
677 Effect.forkScoped,
678 );
679 const turn = (yield* orchestrator.getThreadProjection(threadId)).providerTurns[0]!;
680 yield* Queue.offer(events, {
681 type: "provider_turn.updated",
682 driver,
683 providerTurn: { ...turn, status: "completed", completedAt: yield* DateTime.now },
684 });
685 yield* Queue.offer(events, {
686 type: "turn.terminal",
687 driver,
688 providerThreadId: turn.providerThreadId,
689 providerTurnId: turn.id,
690 runOrdinal: first.runOrdinal,
691 status: "completed",
692 failure: null,
693 threadDisposition: "reusable",
694 });
695 yield* Fiber.join(settled);
696 yield* worker.drain();
697 yield* orchestrator.resumeQueuedRuns;
698 yield* worker.drain();
699​
700 const projection = yield* orchestrator.getThreadProjection(threadId);
701 assert.deepEqual(steered, []);
702 assert.equal(started.length, 2);
703 assert.equal(started[1]?.message.messageId, MessageId.make("message:steer"));
704 assert.deepEqual(started[1]?.modelSelection, composerSelection);
705 assert.deepEqual(projection.thread.modelSelection, composerSelection);
706 }).pipe(Effect.provide(layer));
707 }),
708 ),
709);