Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1579,15 +1579,23 @@ describe("orchestrator MCP toolkit", () => {
const delegatedStatusAfterFollowup = yield* decodeDelegateTaskResult(
delegatedStatusAfterFollowupCall.structuredContent,
).pipe(Effect.orDie);
// A follow-up the child finishes is finalized onto the task as its new result.
expect(delegatedStatusAfterFollowup).toMatchObject({
childRunId: delegated.childRunId,
status: "completed",
summary: delegatedResult,
summary: "Claude completed: Confirm the delegated API boundary remains inspected.",
hasPendingChildRuns: false,
latestTerminalRunId: childFollowup.runId,
latestTerminalStatus: "completed",
latestTerminalSummary:
"Claude completed: Confirm the delegated API boundary remains inspected.",
});
expect(delegatedStatusAfterFollowup.latestTerminalSummary).not.toBeNull();
expect(
delegatedStatusAfterFollowup.latestTerminalResultContextTransferId,
).not.toBeNull();
expect(delegatedStatusAfterFollowup.latestTerminalResultContextTransferId).not.toBe(
delegatedStatusAfterFollowup.resultContextTransferId,
);

const activeChildFollowupCall = yield* invoke("t3_thread_send", {
threadId: delegated.childThreadId,
Expand All @@ -1611,7 +1619,7 @@ describe("orchestrator MCP toolkit", () => {
expect(delegatedStatusDuringFollowup).toMatchObject({
childRunId: delegated.childRunId,
status: "completed",
summary: delegatedResult,
summary: "Claude completed: Confirm the delegated API boundary remains inspected.",
hasPendingChildRuns: true,
latestTerminalRunId: childFollowup.runId,
latestTerminalStatus: "completed",
Expand Down Expand Up @@ -1680,14 +1688,17 @@ describe("orchestrator MCP toolkit", () => {
const delegatedStatusAfterCleanup = yield* decodeDelegateTaskResult(
delegatedStatusAfterCleanupCall.structuredContent,
).pipe(Effect.orDie);
// The interrupted follow-up is the task's latest finalized outcome.
expect(delegatedStatusAfterCleanup).toMatchObject({
childRunId: delegated.childRunId,
status: "completed",
summary: delegatedResult,
status: "interrupted",
hasPendingChildRuns: false,
latestTerminalRunId: activeChildFollowup.runId,
latestTerminalStatus: "interrupted",
});
expect(delegatedStatusAfterCleanup.summary).toBe(
delegatedStatusAfterCleanup.latestTerminalSummary,
);

// A wait-mode child (completionWake settled_only) that completes
// while the parent run is live does not offer a wake: the
Expand Down Expand Up @@ -3801,14 +3812,17 @@ describe("orchestrator MCP toolkit", () => {
expect(finalStatus).toMatchObject({
childRunId: delegated.childRunId,
status: "completed",
summary: delegatedResult,
summary: queuedFollowupResult,
resultContextTransferId: delegated.resultContextTransferId,
hasPendingChildRuns: false,
latestTerminalRunId: queuedFollowup.runId,
latestTerminalStatus: "completed",
latestTerminalSummary: queuedFollowupResult,
latestTerminalResultContextTransferId: null,
});
expect(finalStatus.latestTerminalResultContextTransferId).not.toBeNull();
expect(finalStatus.latestTerminalResultContextTransferId).not.toBe(
delegated.resultContextTransferId,
);
}).pipe(Effect.provide(testLayer));
}),
),
Expand Down
Loading
Loading