@devries-cameron20 / t3code-1 / commits / f1e0a4d4d0
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

test(server): promoting a queued message into a running Claude turn succeeds (#20065)

Co-authored-by: Aaron Queen <bompus@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 15, 2026 at 20:05 UTC f1e0a4d4d0600b2803e311989151c7f89ced3251
1 file changed +44 -3
apps/server/src/orchestration-v2/ClaudeAutomaticDelivery.integration.test.ts
+44 -3
@@ -124,7 +124,14 @@ const result = (uuid: string, aborted: boolean) =>
124 modelUsage: {},
125 });
126
127 -it.effect.each(["child completion", "scheduled message", "user steering"] as const)(
127 +const deliveries = [
128 + "child completion",
129 + "scheduled message",
130 + "user steering",
131 + "promoted queued message",
132 +] as const;
133 +
134 +it.effect.each(deliveries)(
135 "delivers %s with Claude's native pending-tool cancellation behavior",
136 (delivery) =>
137 Effect.scoped(
@@ -339,7 +346,7 @@ it.effect.each(["child completion", "scheduled message", "user steering"] as con
346 ),
347 ),
348 );
342 - } else {
349 + } else if (delivery === "user steering") {
350 yield* orchestrator.dispatch({
351 type: "message.dispatch",
352 commandId: CommandId.make("steer"),
@@ -351,9 +358,43 @@ it.effect.each(["child completion", "scheduled message", "user steering"] as con
358 createdBy: "user",
359 creationSource: "web",
360 });
361 + } else {
362 + yield* orchestrator.dispatch({
363 + type: "message.dispatch",
364 + commandId: CommandId.make("queue"),
365 + threadId,
366 + messageId,
367 + text: "Change direction now.",
368 + attachments: [],
369 + dispatchMode: { type: "queue_after_active" },
370 + createdBy: "user",
371 + creationSource: "web",
372 + });
373 + const queuedRun = (yield* orchestrator.getThreadProjection(threadId)).runs[1]!;
374 + yield* orchestrator.dispatch({
375 + type: "queued-message.promote-to-steer",
376 + commandId: CommandId.make("promote"),
377 + threadId,
378 + queuedRunId: queuedRun.id,
379 + targetRunId: parent.id,
380 + });
381 + // Promotion cancels the queued run and moves its message into the
382 + // running run as a steer that remembers where it came from.
383 + const promoted = yield* orchestrator.getThreadProjection(threadId);
384 + assert.equal(promoted.runs.find((run) => run.id === queuedRun.id)?.status, "cancelled");
385 + assert.equal(
386 + promoted.messages.find((message) => message.id === messageId)?.runId,
387 + parent.id,
388 + );
389 + const steer = promoted.turnItems.find(
390 + (item) => item.type === "user_message" && item.messageId === messageId,
391 + );
392 + assert.ok(steer?.type === "user_message");
393 + assert.equal(steer.inputIntent, "promoted_queued_to_steer");
394 }
395 yield* worker.drain();
356 - const explicitSteer = delivery === "user steering";
396 + const explicitSteer =
397 + delivery === "user steering" || delivery === "promoted queued message";
398 assert.equal(batchAbort.signal.aborted, explicitSteer);
399 assert.equal(offers.length, explicitSteer ? 2 : 1);
400 const finished = yield* watch(