( runId: string, rootDir?: string, nowMs?: number, )
| 680 | } |
| 681 | |
| 682 | export async function markAutonomyRunRunning( |
| 683 | runId: string, |
| 684 | rootDir?: string, |
| 685 | nowMs?: number, |
| 686 | ): Promise<AutonomyRunRecord | null> { |
| 687 | const updated = await updateAutonomyRun( |
| 688 | runId, |
| 689 | current => |
| 690 | current.status === 'queued' |
| 691 | ? { |
| 692 | ...current, |
| 693 | status: 'running', |
| 694 | startedAt: nowMs ?? Date.now(), |
| 695 | ownerProcessId: process.pid, |
| 696 | ownerSessionId: getSessionId(), |
| 697 | } |
| 698 | : null, |
| 699 | rootDir, |
| 700 | ) |
| 701 | if (updated?.parentFlowId && updated.parentFlowSyncMode === 'managed') { |
| 702 | await markManagedAutonomyFlowStepRunning({ |
| 703 | flowId: updated.parentFlowId, |
| 704 | runId: updated.runId, |
| 705 | rootDir, |
| 706 | nowMs: updated.startedAt, |
| 707 | }) |
| 708 | } |
| 709 | return updated |
| 710 | } |
| 711 | |
| 712 | export async function markAutonomyRunCompleted( |
| 713 | runId: string, |
no test coverage detected