Skip to content

Commit 0a74c93

Browse files
test(mcp): cover queue output in the shared integration
1 parent c1d4b34 commit 0a74c93

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

‎apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ describe("orchestrator MCP toolkit", () => {
10471047
commandId: CommandId.make("command:mcp-parent:queue-race:user"),
10481048
threadId: parentThreadId,
10491049
messageId: queuedUserMessageId,
1050-
text: "Queue user follow-up work.",
1050+
text: "🙂".repeat(16001),
10511051
attachments: [],
10521052
modelSelection: codexSelection,
10531053
dispatchMode: { type: "queue_after_active" },
@@ -1067,6 +1067,24 @@ describe("orchestrator MCP toolkit", () => {
10671067
if (queuedUserRun === undefined) {
10681068
return yield* Effect.die(new Error("Queued user follow-up missing."));
10691069
}
1070+
const queueFirstPage = yield* invoke("t3_queue_list", { limit: 1 });
1071+
expect(queueFirstPage.structuredContent).toMatchObject({
1072+
items: [{ queuedRunId: queueRace.queuedRun.id }],
1073+
nextCursor: 1,
1074+
});
1075+
const queueSecondPage = yield* invoke("t3_queue_list", { cursor: 1, limit: 1 });
1076+
expect(queueSecondPage.structuredContent).toEqual({
1077+
items: [{ queuedRunId: queuedUserRun.id, text: "🙂".repeat(1000), truncated: true }],
1078+
nextCursor: null,
1079+
});
1080+
const queueRead = yield* invoke("t3_queue_read", { queuedRunId: queuedUserRun.id });
1081+
expect(queueRead.structuredContent).toEqual({
1082+
queuedRunId: queuedUserRun.id,
1083+
text: "🙂".repeat(16000),
1084+
truncated: true,
1085+
});
1086+
const missingQueueRead = yield* invoke("t3_queue_read", { queuedRunId: parentRun.id });
1087+
expect(missingQueueRead.structuredContent).toMatchObject({ code: "invalid_request" });
10701088
const queueRaceStatus = yield* invoke("task_status", { taskId: queueRace.task.id });
10711089
expect(queueRaceStatus.isError).toBe(false);
10721090
yield* waitForProjection(

‎apps/server/src/mcp/toolkits/thread/handlers.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
type CommandId,
23
type ThreadId,
34
type OrchestrationV2ThreadProjection,
45
type RunId,
@@ -24,10 +25,7 @@ function queueEntry(projection: OrchestrationV2ThreadProjection, runId: RunId, l
2425
}
2526
const dispatch = Effect.fn("mcp.dispatchThreadCommand")(function* (
2627
threadId: ThreadId | undefined,
27-
command: (common: {
28-
commandId: import("@t3tools/contracts").CommandId;
29-
threadId: ThreadId;
30-
}) => OrchestrationV2Command,
28+
command: (common: { commandId: CommandId; threadId: ThreadId }) => OrchestrationV2Command,
3129
) {
3230
const { threads, projection } = yield* readWritableThread(threadId);
3331
const result = yield* threads

0 commit comments

Comments
 (0)