( runId: string, rootDir?: string, nowMs?: number, )
| 710 | } |
| 711 | |
| 712 | export async function markAutonomyRunCompleted( |
| 713 | runId: string, |
| 714 | rootDir?: string, |
| 715 | nowMs?: number, |
| 716 | ): Promise<AutonomyRunRecord | null> { |
| 717 | const updated = await updateAutonomyRun( |
| 718 | runId, |
| 719 | current => |
| 720 | current.status === 'queued' || current.status === 'running' |
| 721 | ? { |
| 722 | ...current, |
| 723 | status: 'completed', |
| 724 | endedAt: nowMs ?? Date.now(), |
| 725 | error: undefined, |
| 726 | } |
| 727 | : null, |
| 728 | rootDir, |
| 729 | ) |
| 730 | if (updated?.parentFlowId && updated.parentFlowSyncMode === 'managed') { |
| 731 | await markManagedAutonomyFlowStepCompleted({ |
| 732 | flowId: updated.parentFlowId, |
| 733 | runId: updated.runId, |
| 734 | rootDir, |
| 735 | nowMs: updated.endedAt, |
| 736 | }) |
| 737 | } |
| 738 | return updated |
| 739 | } |
| 740 | |
| 741 | export async function markAutonomyRunFailed( |
| 742 | runId: string, |
no test coverage detected