Skip to content

Commit 35433a7

Browse files
author
rsi-pr-agent
committed
fixup! fix(server): in-thread MCP thread reads show background work (#1831)
Fork-Domain: device-auth Fork-Tier: core
1 parent 7f92cc8 commit 35433a7

5 files changed

Lines changed: 425 additions & 61 deletions

File tree

‎apps/server/src/mcp/McpThreadWork.fork.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import * as ProjectService from "../project/ProjectService.ts";
3333
import * as ProviderRegistry from "../provider/ProviderRegistry.ts";
3434
import * as ServerEnvironment from "../environment/ServerEnvironment.ts";
3535
import * as ServerSettings from "../serverSettings.ts";
36+
import * as RemoteDelegation from "../peer/RemoteDelegation.ts";
3637
import * as ExternalMcpService from "./external/ExternalMcpService.fork.ts";
3738
import type { McpInvocationScope } from "./McpInvocationContext.ts";
3839
import * as OrchestratorMcpService from "./OrchestratorMcpService.ts";
@@ -674,6 +675,7 @@ const inThread = (harness: ReturnType<typeof makeHarness>) =>
674675
Layer.mock(ProjectService.ProjectService)({}),
675676
Layer.mock(SecretRequests.SecretRequests)({}),
676677
Layer.mock(ScheduledTaskService.ScheduledTaskService)({}),
678+
Layer.mock(RemoteDelegation.RemoteDelegation)({}),
677679
),
678680
),
679681
),

‎apps/server/src/mcp/external/ExternalMcpService.fork.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ import * as ServerEnvironment from "../../environment/ServerEnvironment.ts";
5353
import * as ServerSettings from "../../serverSettings.ts";
5454
import {
5555
listItemFromShellFork,
56-
resolveInteractionMode,
57-
resolveRuntimeMode,
5856
threadDetailFork,
5957
threadManagementFailureFork,
6058
threadRunFork,
6159
timelineItemFork,
6260
} from "../OrchestratorMcpService.ts";
61+
import { resolveInteractionMode, resolveRuntimeMode } from "../delegatedTaskModes.ts";
6362
import {
6463
assertWaitTarget,
6564
type McpThreadReadResult,
@@ -712,7 +711,7 @@ const make = Effect.gen(function* () {
712711
runId: result.run?.id ?? null,
713712
status: result.run?.status ?? "idle",
714713
timedOut: result.timedOut,
715-
pendingRequestCount: result.pendingRequestCount,
714+
pendingRequestCount: result.pendingRequestCount ?? 0,
716715
work,
717716
} satisfies McpThreadWaitResult;
718717
}),

‎apps/server/src/mcp/toolkits/orchestrator/threadWork.fork.ts‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import * as McpInvocationContext from "../../McpInvocationContext.ts";
2525
import * as McpToolAccess from "../../McpToolAccess.ts";
2626
import * as OrchestratorMcpService from "../../OrchestratorMcpService.ts";
2727
import type { OrchestratorToolkit } from "./tools.ts";
28+
import { threadNotFound } from "../../threadAccess.ts";
2829

2930
const loadShell = (
3031
threads: ThreadManagementService.ThreadManagementServiceShape,
@@ -34,12 +35,7 @@ const loadShell = (
3435
Effect.mapError(OrchestratorMcpService.threadManagementFailureFork),
3536
Effect.filterOrElse(
3637
(shell): shell is OrchestrationV2ThreadShell => shell !== null && shell.deletedAt === null,
37-
() =>
38-
OrchestratorMcpService.threadNotFound(
39-
threads,
40-
threadId,
41-
`Thread ${threadId} was not found.`,
42-
),
38+
() => threadNotFound(threads, threadId, `Thread ${threadId} was not found.`),
4339
),
4440
);
4541

0 commit comments

Comments
 (0)