summaryrefslogtreecommitdiffhomepage
path: root/packages/session-orchestrator/src/queue.test.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-07-01 03:30:42 +0900
committerAdam Malczewski <[email protected]>2026-07-01 03:30:42 +0900
commit566c64033ad79538f9208fc3ef9477cd8a58f7da (patch)
tree0919ed136d8f219880440ab7a007760dc62b1b31 /packages/session-orchestrator/src/queue.test.ts
parent81e9e7ee9064b98e06a5f947c67a6ec73b7e578d (diff)
parentebb29b1e5b929493315469fcbd5eca6f13bd1c32 (diff)
downloaddispatch-566c64033ad79538f9208fc3ef9477cd8a58f7da.tar.gz
dispatch-566c64033ad79538f9208fc3ef9477cd8a58f7da.zip
Merge branch 'feature/in-flight-compaction' into predev
Diffstat (limited to 'packages/session-orchestrator/src/queue.test.ts')
-rw-r--r--packages/session-orchestrator/src/queue.test.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/packages/session-orchestrator/src/queue.test.ts b/packages/session-orchestrator/src/queue.test.ts
index 65cc06f..e5746c3 100644
--- a/packages/session-orchestrator/src/queue.test.ts
+++ b/packages/session-orchestrator/src/queue.test.ts
@@ -217,7 +217,9 @@ function createDrainingCaptureRunTurn(): {
captured.push(input);
if (input.drainSteering !== undefined) {
drainCalled = true;
- const drained = input.drainSteering();
+ // The kernel awaits drainSteering (it may return a Promise that
+ // persists the injected messages); the fake mirrors that.
+ const drained = await input.drainSteering();
drainedMessages.push(...drained);
}
return {
@@ -332,6 +334,18 @@ describe("drainSteering", () => {
expect(steering?.conversationId).toBe("conv-drain");
expect(steering?.text).toBe("first\n\nsecond");
expect(steering?.turnId).toMatch(/^turn-/);
+
+ // The steering message was PERSISTED to the store (not just injected into
+ // the kernel's in-memory array). Without this, a user could never see the
+ // steering message, and in-flight compaction (which uses the live messages)
+ // would be the only thing keeping it — but only if it fired.
+ const stored = store.data.get("conv-drain") ?? [];
+ const storedSteering = stored.find(
+ (m) =>
+ m.role === "user" &&
+ m.chunks.some((c) => c.type === "text" && c.text === "first\n\nsecond"),
+ );
+ expect(storedSteering).toBeDefined();
});
it("drainSteering on an empty queue returns [] and emits nothing", async () => {