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

Method resolveWaiters

src/node/services/taskService.ts:9623–9672  ·  view source on GitHub ↗
(
    taskId: string,
    report: {
      reportMarkdown: string;
      title?: string;
      structuredOutput?: unknown;
      planFilePath?: string;
    }
  )

Source from the content-addressed store, hash-verified

9621 }
9622
9623 private resolveWaiters(
9624 taskId: string,
9625 report: {
9626 reportMarkdown: string;
9627 title?: string;
9628 structuredOutput?: unknown;
9629 planFilePath?: string;
9630 }
9631 ): boolean {
9632 this.markTaskForegroundRelevant(taskId);
9633
9634 const cfg = this.config.loadConfigOrDefault();
9635 const index = this.buildAgentTaskIndex(cfg);
9636 const ancestorWorkspaceIds = this.listAncestorWorkspaceIdsUsingParentById(
9637 index.parentById,
9638 taskId
9639 );
9640 const workflowOwnedAncestorWorkspaceIds = ancestorWorkspaceIds.filter(
9641 (ancestorWorkspaceId) =>
9642 this.getWorkflowOwnedDescendantAgentTaskUsingIndex(index, ancestorWorkspaceId, taskId) ===
9643 true
9644 );
9645
9646 this.completedReportsByTaskId.set(taskId, {
9647 reportMarkdown: report.reportMarkdown,
9648 title: report.title,
9649 planFilePath: report.planFilePath,
9650 structuredOutput: report.structuredOutput,
9651 ancestorWorkspaceIds,
9652 workflowOwnedAncestorWorkspaceIds,
9653 });
9654 this.enforceCompletedReportCacheLimit();
9655
9656 const waiters = this.pendingWaitersByTaskId.get(taskId);
9657 if (!waiters || waiters.length === 0) {
9658 return false;
9659 }
9660
9661 this.pendingWaitersByTaskId.delete(taskId);
9662 for (const waiter of waiters) {
9663 try {
9664 waiter.cleanup();
9665 waiter.resolve(report);
9666 } catch {
9667 // ignore
9668 }
9669 }
9670
9671 return true;
9672 }
9673
9674 private rejectWaiters(taskId: string, error: Error): void {
9675 this.markTaskForegroundRelevant(taskId);

Callers 2

Calls 11

buildAgentTaskIndexMethod · 0.95
loadConfigOrDefaultMethod · 0.80
setMethod · 0.80
resolveMethod · 0.80
getMethod · 0.65
cleanupMethod · 0.65
deleteMethod · 0.45

Tested by

no test coverage detected