File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change 11import { randomUUID } from "node:crypto" ;
22import { Agent , PermissionMode } from "@posthog/agent" ;
33import { type BrowserWindow , type IpcMainInvokeEvent , ipcMain } from "electron" ;
4- import type { TaskRun } from "@/shared/types" ;
54
65interface AgentStartParams {
76 taskId : string ;
@@ -124,12 +123,8 @@ export function registerAgentIpc(
124123 const pollTaskProgress = async ( ) => {
125124 if ( abortController . signal . aborted ) return ;
126125 try {
127- const runs = await posthogClient . listTaskRuns ( posthogTaskId ) ;
128- const latestRun = runs ?. sort (
129- ( a : TaskRun , b : TaskRun ) =>
130- new Date ( b . created_at ) . getTime ( ) -
131- new Date ( a . created_at ) . getTime ( ) ,
132- ) [ 0 ] ;
126+ const task = await posthogClient . fetchTask ( posthogTaskId ) ;
127+ const latestRun = task ?. latest_run ;
133128
134129 // Only emit progress for runs created after this workflow started
135130 if (
@@ -146,7 +141,7 @@ export function registerAgentIpc(
146141 } ) ;
147142 }
148143 } catch ( err ) {
149- console . warn ( "[agent] failed to fetch task runs " , err ) ;
144+ console . warn ( "[agent] failed to fetch task progress " , err ) ;
150145 }
151146 } ;
152147
You can’t perform that action at this time.
0 commit comments