( runId: string, rootDir?: string, nowMs?: number, )
| 760 | } |
| 761 | |
| 762 | export async function markAutonomyRunCancelled( |
| 763 | runId: string, |
| 764 | rootDir?: string, |
| 765 | nowMs?: number, |
| 766 | ): Promise<AutonomyRunRecord | null> { |
| 767 | const updated = await updateAutonomyRun( |
| 768 | runId, |
| 769 | current => |
| 770 | current.status === 'queued' || current.status === 'running' |
| 771 | ? { |
| 772 | ...current, |
| 773 | status: 'cancelled', |
| 774 | endedAt: nowMs ?? Date.now(), |
| 775 | error: undefined, |
| 776 | } |
| 777 | : null, |
| 778 | rootDir, |
| 779 | ) |
| 780 | if (updated?.parentFlowId && updated.parentFlowSyncMode === 'managed') { |
| 781 | await markManagedAutonomyFlowStepCancelled({ |
| 782 | flowId: updated.parentFlowId, |
| 783 | runId: updated.runId, |
| 784 | rootDir, |
| 785 | nowMs: updated.endedAt, |
| 786 | }) |
| 787 | } |
| 788 | return updated |
| 789 | } |
| 790 | |
| 791 | export async function finalizeAutonomyRunCompleted(params: { |
| 792 | runId: string |
no test coverage detected