MCPcopy Index your code
hub / github.com/simstudioai/sim / updateRunStatus

Function updateRunStatus

apps/sim/lib/copilot/async-runs/repository.ts:113–147  ·  view source on GitHub ↗
(
  runId: string,
  status: CopilotRunStatus,
  updates: {
    completedAt?: Date | null
    error?: string | null
    requestContext?: Record<string, unknown>
  } = {}
)

Source from the content-addressed store, hash-verified

111}
112
113export async function updateRunStatus(
114 runId: string,
115 status: CopilotRunStatus,
116 updates: {
117 completedAt?: Date | null
118 error?: string | null
119 requestContext?: Record<string, unknown>
120 } = {}
121) {
122 return withDbSpan(
123 TraceSpan.CopilotAsyncRunsUpdateRunStatus,
124 'UPDATE',
125 'copilot_runs',
126 {
127 [TraceAttr.RunId]: runId,
128 [TraceAttr.CopilotRunStatus]: status,
129 [TraceAttr.CopilotRunHasError]: !!updates.error,
130 [TraceAttr.CopilotRunHasCompletedAt]: !!updates.completedAt,
131 },
132 async () => {
133 const [run] = await db
134 .update(copilotRuns)
135 .set({
136 status,
137 completedAt: updates.completedAt,
138 error: updates.error,
139 requestContext: updates.requestContext,
140 updatedAt: new Date(),
141 })
142 .where(eq(copilotRuns.id, runId))
143 .returning()
144 return run ?? null
145 }
146 )
147}
148
149async function getLatestRunForExecution(executionId: string) {
150 return withDbSpan(

Callers 2

runCheckpointLoopFunction · 0.90
loggedRunStatusUpdateFunction · 0.90

Calls 3

withDbSpanFunction · 0.85
setMethod · 0.65
eqFunction · 0.50

Tested by

no test coverage detected