MCPcopy Index your code
hub / github.com/coder/mux / isWorkflowOwnedDescendantAgentTask

Method isWorkflowOwnedDescendantAgentTask

src/node/services/taskService.ts:6336–6379  ·  view source on GitHub ↗
(
    ancestorWorkspaceId: string,
    taskId: string
  )

Source from the content-addressed store, hash-verified

6334 }
6335
6336 async isWorkflowOwnedDescendantAgentTask(
6337 ancestorWorkspaceId: string,
6338 taskId: string
6339 ): Promise<boolean> {
6340 assert(
6341 ancestorWorkspaceId.length > 0,
6342 "isWorkflowOwnedDescendantAgentTask: ancestorWorkspaceId required"
6343 );
6344 assert(taskId.length > 0, "isWorkflowOwnedDescendantAgentTask: taskId required");
6345
6346 const cfg = this.config.loadConfigOrDefault();
6347 const indexResult = this.getWorkflowOwnedDescendantAgentTaskUsingIndex(
6348 this.buildAgentTaskIndex(cfg),
6349 ancestorWorkspaceId,
6350 taskId
6351 );
6352 if (indexResult != null) {
6353 return indexResult;
6354 }
6355
6356 const cached = this.completedReportsByTaskId.get(taskId);
6357 if (hasWorkflowOwnedAncestorWorkspaceId(cached, ancestorWorkspaceId)) {
6358 return true;
6359 }
6360 if (hasAncestorWorkspaceId(cached, ancestorWorkspaceId)) {
6361 return false;
6362 }
6363
6364 const sessionDir = this.config.getSessionDir(ancestorWorkspaceId);
6365 const persisted = await readSubagentReportArtifactsFile(sessionDir);
6366 const entry = persisted.artifactsByChildTaskId[taskId];
6367 if (entry != null) {
6368 return hasWorkflowOwnedAncestorWorkspaceId(entry, ancestorWorkspaceId);
6369 }
6370
6371 // A workflow-owned child that failed terminally leaves only a failure
6372 // artifact. It must stay excluded from direct task_await after cleanup,
6373 // matching live behavior: its failure is consumed through the workflow run.
6374 const failures = await readSubagentFailureArtifactsFile(sessionDir);
6375 return hasWorkflowOwnedAncestorWorkspaceId(
6376 failures.failuresByChildTaskId[taskId],
6377 ancestorWorkspaceId
6378 );
6379 }
6380
6381 private getWorkflowOwnedDescendantAgentTaskUsingIndex(
6382 index: AgentTaskIndex,

Callers 3

createTaskListToolFunction · 0.80

Calls 10

buildAgentTaskIndexMethod · 0.95
hasAncestorWorkspaceIdFunction · 0.85
loadConfigOrDefaultMethod · 0.80
getMethod · 0.65
getSessionDirMethod · 0.65
assertFunction · 0.50

Tested by

no test coverage detected