GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(mcp): t3_thread_wait no longer has parents poll a task's first ru… · pingdotgg/t3code@83edd5e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/mcp
    • OrchestratorMcpService.test.ts
    • OrchestratorMcpService.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/mcp/OrchestratorMcpService.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/mcp/OrchestratorMcpService.test.ts
+20-4Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ describe("OrchestratorMcpService", () => {
617617
const childThreadId = ThreadId.make("thread:mcp-next-child");
618618
const taskId = NodeId.make("node:mcp-next-task");
619619
let finished = false;
620+
let firstRun = false;
620621
let pendingRequest: "live" | "message" | null = null;
621622
const parentProjection = () =>
622623
({
@@ -640,12 +641,17 @@ describe("OrchestratorMcpService", () => {
640641
const childRun = () => ({
641642
id: RunId.make("run:mcp-next-child"),
642643
ordinal: 1,
643-
status: finished ? ("completed" as const) : ("running" as const),
644-
delegatedTaskId: taskId,
644+
status: finished && !firstRun ? ("completed" as const) : ("running" as const),
645+
// A task's first run is untagged; the child's fork node names the task.
646+
...(firstRun ? {} : { delegatedTaskId: taskId }),
645647
});
646648
const childProjection = () =>
647649
({
648-
thread: { id: childThreadId, title: "Child task" },
650+
thread: {
651+
id: childThreadId,
652+
title: "Child task",
653+
forkedFrom: { type: "node", nodeId: taskId },
654+
},
649655
runs: [childRun()],
650656
contextTransfers: [],
651657
messages: [],
@@ -677,7 +683,7 @@ describe("OrchestratorMcpService", () => {
677683
Effect.succeed({
678684
threadId: childThreadId,
679685
run: childRun() as unknown as OrchestrationV2ThreadProjection["runs"][number],
680-
timedOut: !finished,
686+
timedOut: !finished || firstRun,
681687
}),
682688
dispatch: () => Effect.succeed({} as never),
683689
}),
@@ -725,7 +731,17 @@ describe("OrchestratorMcpService", () => {
725731
assert.equal(working.next, ORCHESTRATOR_MCP_RUNNING_TASK_NEXT);
726732
pendingRequest = null;
727733

734+
firstRun = true;
735+
const first = yield* service.waitForThread(scope, { threadId: childThreadId });
736+
assert.equal(first.next, ORCHESTRATOR_MCP_RUNNING_TASK_NEXT);
737+
738+
// An untagged run after the task has its result is no longer that task.
728739
finished = true;
740+
const followUp = yield* service.waitForThread(scope, { threadId: childThreadId });
741+
assert.isTrue(followUp.timedOut);
742+
assert.notProperty(followUp, "next");
743+
firstRun = false;
744+
729745
const completed = yield* service.taskStatus(scope, taskId);
730746
assert.equal(completed.status, "completed");
731747
assert.notProperty(completed, "next");
Collapse file

‎apps/server/src/mcp/OrchestratorMcpService.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/mcp/OrchestratorMcpService.ts
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3713,7 +3713,11 @@ const make = Effect.gen(function* () {
37133713
})
37143714
.pipe(Effect.mapError(threadManagementFailure));
37153715
const status = result.run === null ? "idle" : runOutcome(result.run);
3716-
const taskId = result.run?.delegatedTaskId;
3716+
// A task's first run carries no task id; the child's untagged runs continue that task
3717+
// until it has a result.
3718+
const taskId =
3719+
result.run?.delegatedTaskId ??
3720+
(target.thread.forkedFrom?.type === "node" ? target.thread.forkedFrom.nodeId : undefined);
37173721
const ownedTask =
37183722
result.timedOut &&
37193723
status !== "waiting" &&
@@ -3725,7 +3729,8 @@ const make = Effect.gen(function* () {
37253729
task.origin === "app_owned" &&
37263730
task.threadId === parent.thread.id &&
37273731
task.childThreadId === input.threadId &&
3728-
task.completionDelivery?.state !== "disposed",
3732+
task.completionDelivery?.state !== "disposed" &&
3733+
(result.run?.delegatedTaskId !== undefined || task.result === null),
37293734
);
37303735
// A child waiting on a question or approval needs an answer, not a wake.
37313736
const childRequests = ownedTask

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.