Skip to content

Commit b37034d

Browse files
test(v2): follow-ups aimed at maintenance runs queue instead of failing
1 parent 0811501 commit b37034d

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎apps/server/src/orchestration-v2/ThreadLaunchService.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,29 @@ it.effect("keeps native maintenance commands out of steering and restart message
699699
const targetRun = before.runs[0];
700700
if (targetRun === undefined) return yield* Effect.die("Launch must create a run");
701701
const commandId = CommandId.make(`${scenario.name}:message`);
702+
// Steering into a run whose user message is a native maintenance
703+
// command queues the follow-up behind it instead of failing delivery;
704+
// the maintenance run cannot take the steer either way.
705+
const queuesBehindMaintenanceRun =
706+
scenario.name === "steer-logout" || scenario.name === "steer-compaction";
707+
if (queuesBehindMaintenanceRun) {
708+
yield* threads.dispatch({
709+
type: "message.dispatch",
710+
commandId,
711+
threadId: launched.threadId,
712+
messageId: MessageId.make(`${scenario.name}:message`),
713+
createdBy: "user",
714+
creationSource: "web",
715+
text: scenario.next,
716+
attachments: [],
717+
dispatchMode: { type: scenario.mode, targetRunId: targetRun.id },
718+
});
719+
const after = yield* threads.getThreadProjection(launched.threadId);
720+
const queuedRun = after.runs.find((run) => run.ordinal === 2);
721+
assert.isDefined(queuedRun);
722+
assert.equal(queuedRun?.status, "queued");
723+
continue;
724+
}
702725
const failure = yield* threads
703726
.dispatch({
704727
type: "message.dispatch",

0 commit comments

Comments
 (0)