|
1 | | -import { copilotRuns, db, jobExecutionLogs, workflowSchedule } from '@sim/db' |
| 1 | +import { copilotRuns, db, jobExecutionLogs } from '@sim/db' |
2 | 2 | import { createLogger } from '@sim/logger' |
3 | 3 | import { getErrorMessage } from '@sim/utils/errors' |
4 | 4 | import { and, asc, eq, inArray, isNotNull, isNull, lte, or, sql } from 'drizzle-orm' |
@@ -73,12 +73,11 @@ function openJobRuns(status: OpenJobRunStatus, now: Date) { |
73 | 73 | admittedBillingRequestId, |
74 | 74 | scheduleId: jobExecutionLogs.scheduleId, |
75 | 75 | runStatus: copilotRuns.status, |
76 | | - userId: workflowSchedule.sourceUserId, |
77 | | - workspaceId: workflowSchedule.sourceWorkspaceId, |
| 76 | + userId: copilotRuns.userId, |
| 77 | + workspaceId: copilotRuns.workspaceId, |
78 | 78 | chatId: copilotRuns.chatId, |
79 | 79 | }) |
80 | 80 | .from(jobExecutionLogs) |
81 | | - .leftJoin(workflowSchedule, eq(workflowSchedule.id, jobExecutionLogs.scheduleId)) |
82 | 81 | .leftJoin(copilotRuns, eq(copilotRuns.streamId, jobExecutionLogs.executionId)) |
83 | 82 | .where(and(openJobRun([status]), needsAction)) |
84 | 83 | .orderBy(asc(jobExecutionLogs.startedAt)) |
|
0 commit comments