MCPcopy
hub / github.com/coder/mux / setupParentWithActiveChild

Function setupParentWithActiveChild

src/node/services/taskService.test.ts:17336–17396  ·  view source on GitHub ↗
(rootDirPath: string)

Source from the content-addressed store, hash-verified

17334
17335 describe("parent auto-resume flood protection", () => {
17336 async function setupParentWithActiveChild(rootDirPath: string) {
17337 const config = await createTestConfig(rootDirPath);
17338 const projectPath = path.join(rootDirPath, "repo");
17339 await fsPromises.mkdir(projectPath, { recursive: true });
17340
17341 const rootWorkspaceId = "root-resume-111";
17342 const childTaskId = "child-resume-222";
17343
17344 await config.saveConfig({
17345 projects: new Map([
17346 [
17347 projectPath,
17348 {
17349 trusted: true,
17350 workspaces: [
17351 projectWorkspace(projectPath, "root", rootWorkspaceId, {
17352 aiSettings: { model: "openai:gpt-5.2", thinkingLevel: "medium" as const },
17353 }),
17354 projectWorkspace(projectPath, "child-task", childTaskId, {
17355 parentWorkspaceId: rootWorkspaceId,
17356 agentType: "explore",
17357 taskStatus: "running" as const,
17358 taskModelString: "openai:gpt-5.2",
17359 }),
17360 ],
17361 },
17362 ],
17363 ]),
17364 taskSettings: { maxParallelAgentTasks: 3, maxTaskNestingDepth: 3 },
17365 });
17366
17367 const { aiService } = createAIServiceMocks(config);
17368 const { workspaceService, sendMessage } = createWorkspaceServiceMocks();
17369 const { taskService } = createTaskServiceHarness(config, {
17370 aiService,
17371 workspaceService,
17372 });
17373
17374 const internal = taskService as unknown as {
17375 handleStreamEnd: (event: StreamEndEvent) => Promise<void>;
17376 };
17377
17378 const makeStreamEndEvent = (): StreamEndEvent => ({
17379 type: "stream-end",
17380 workspaceId: rootWorkspaceId,
17381 messageId: `assistant-${Date.now()}`,
17382 metadata: { model: "openai:gpt-5.2" },
17383 parts: [],
17384 });
17385
17386 return {
17387 config,
17388 taskService,
17389 internal,
17390 sendMessage,
17391 rootWorkspaceId,
17392 childTaskId,
17393 projectPath,

Callers 1

Calls 6

projectWorkspaceFunction · 0.85
createAIServiceMocksFunction · 0.85
createTaskServiceHarnessFunction · 0.85
saveConfigMethod · 0.80
createTestConfigFunction · 0.70

Tested by

no test coverage detected