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

Method listActiveBackgroundWorkflowRunIds

src/node/services/taskService.ts:1241–1271  ·  view source on GitHub ↗
(
    workspaceId: string,
    referencedWorkflowRunIds: readonly string[]
  )

Source from the content-addressed store, hash-verified

1239 }
1240
1241 private async listActiveBackgroundWorkflowRunIds(
1242 workspaceId: string,
1243 referencedWorkflowRunIds: readonly string[]
1244 ): Promise<string[]> {
1245 assert(workspaceId.length > 0, "listActiveBackgroundWorkflowRunIds requires workspaceId");
1246 if (referencedWorkflowRunIds.length === 0) {
1247 return [];
1248 }
1249
1250 try {
1251 const referencedRunIdSet = new Set(referencedWorkflowRunIds);
1252 const runStore = new WorkflowRunStore({ sessionDir: this.config.getSessionDir(workspaceId) });
1253 const runs = await runStore.listRuns();
1254 return runs
1255 .filter(
1256 (run) =>
1257 referencedRunIdSet.has(run.id) &&
1258 run.workspaceId === workspaceId &&
1259 isActiveWorkflowRunStatus(run.status)
1260 )
1261 .map((run) => run.id);
1262 } catch (error: unknown) {
1263 // Workflow state should never make stream-end cleanup fail; task_await can still discover
1264 // runs on a later turn once storage is readable again.
1265 log.warn("Failed to list active background workflow runs", {
1266 workspaceId,
1267 error: getErrorMessage(error),
1268 });
1269 return [];
1270 }
1271 }
1272
1273 private async listBlockingBackgroundWorkflowRunIds(
1274 workspaceId: string,

Callers 2

handleStreamEndMethod · 0.95

Calls 6

listRunsMethod · 0.95
getErrorMessageFunction · 0.90
getSessionDirMethod · 0.65
assertFunction · 0.50
hasMethod · 0.45

Tested by

no test coverage detected