Skip to content

Commit 270b898

Browse files
only21milcodex
andcommitted
fix(server): empty MCP status filters no longer hide threads
Treat statuses: [] like an omitted filter in t3_thread_list. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: GPT-6.1 Sol <[email protected]>
1 parent a2589f2 commit 270b898

2 files changed

Lines changed: 54 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2691,7 +2691,11 @@ const make = Effect.gen(function* () {
26912691
),
26922692
);
26932693
const nowMs = yield* Clock.currentTimeMillis;
2694-
const statuses = input.statuses === undefined ? null : new Set(input.statuses);
2694+
// An empty list is no filter: clients that fill every optional field send `[]`.
2695+
const statuses =
2696+
input.statuses === undefined || input.statuses.length === 0
2697+
? null
2698+
: new Set(input.statuses);
26952699
const titleContains = input.titleContains?.toLocaleLowerCase();
26962700
const filtered = projectThreads
26972701
.filter(

‎apps/server/src/mcp/toolkits/core.test.ts‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,3 +888,52 @@ it.effect("only the caller that prepared a pending upload can discard it", () =>
888888
),
889889
),
890890
);
891+
892+
it.effect(
893+
"t3_thread_list settled:false with an empty statuses list lists the unsettled threads",
894+
() => {
895+
const unsettled = McpToolAccessTestkit.liveThreadShell(ThreadId.make("unsettled-thread"));
896+
const settled = {
897+
...McpToolAccessTestkit.liveThreadShell(ThreadId.make("settled-thread")),
898+
settledOverride: "settled",
899+
} as const;
900+
return Effect.gen(function* () {
901+
const server = yield* McpServer.McpServer;
902+
const result = yield* server
903+
.callTool({
904+
name: "t3_thread_list",
905+
arguments: { projectId: unsettled.projectId, settled: false, statuses: [] },
906+
})
907+
.pipe(
908+
Effect.provideService(
909+
McpInvocationContext.McpInvocationContext,
910+
clientScope("full-access"),
911+
),
912+
Effect.provideService(McpSchema.McpServerClient, client),
913+
);
914+
expect(result.isError).toBe(false);
915+
expect(result.structuredContent).toMatchObject({
916+
threads: [{ threadId: unsettled.id, settled: false }],
917+
total: 1,
918+
});
919+
}).pipe(
920+
Effect.provide(
921+
layerOrchestratorToolkit.pipe(
922+
Layer.provideMerge(McpServer.McpServer.layer),
923+
Layer.provide(NodeCrypto.layer),
924+
Layer.provide(
925+
Layer.mock(ThreadManagement.ThreadManagementService)({
926+
listProjectThreads: () => Effect.succeed([unsettled, settled]),
927+
}),
928+
),
929+
Layer.provide(ServerSettings.layerTest()),
930+
Layer.provide(Layer.mock(ProviderRegistry.ProviderRegistry)({})),
931+
Layer.provide(Layer.mock(ProviderAdapterRegistry.ProviderAdapterRegistryV2)({})),
932+
Layer.provide(Layer.mock(ScheduledTaskService.ScheduledTaskService)({})),
933+
Layer.provide(Layer.mock(ProjectService.ProjectService)({})),
934+
Layer.provide(Layer.mock(SecretRequests.SecretRequests)({})),
935+
),
936+
),
937+
);
938+
},
939+
);

0 commit comments

Comments
 (0)