Skip to content

Commit 6f9ab21

Browse files
committed
fix todo updates for workflow artifacts in deep research
Pass workflow metadata through todo callbacks and ignore workflow-scoped todo artifacts in UI state updates so task lists only reflect top-level research todos. Made-with: Cursor
1 parent 3e2fcff commit 6f9ab21

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

frontends/ui/src/adapters/api/deep-research-client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export interface DeepResearchCallbacks {
206206
onToolStart?: (name: string, input?: Record<string, unknown>, workflow?: string, eventId?: string, agentId?: string) => void
207207
onToolEnd?: (name: string, output?: string, eventId?: string, agentId?: string) => void
208208
/** Called on artifact updates */
209-
onTodoUpdate?: (todos: TodoItem[]) => void
209+
onTodoUpdate?: (todos: TodoItem[], workflow?: string) => void
210210
onCitationUpdate?: (url: string, content: string, isCited?: boolean) => void
211211
onFileUpdate?: (filename: string, content: string) => void
212212
onOutputUpdate?: (content: string, outputCategory?: string, workflow?: string) => void
@@ -498,7 +498,7 @@ export const createDeepResearchClient = (options: DeepResearchStreamOptions): De
498498

499499
switch (artifactData.type) {
500500
case 'todo':
501-
callbacks.onTodoUpdate?.(artifactData.content as TodoItem[])
501+
callbacks.onTodoUpdate?.(artifactData.content as TodoItem[], artifactWorkflow)
502502
break
503503
case 'citation_source':
504504
// citation_source = "Referenced" sources (discovered during search)

frontends/ui/src/features/chat/hooks/use-deep-research.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,8 @@ export const useDeepResearch = (): UseDeepResearchReturn => {
416416
setCurrentStatus('researching')
417417
},
418418

419-
onTodoUpdate: (todos: TodoItem[]) => {
419+
onTodoUpdate: (todos: TodoItem[], workflow?: string) => {
420+
if (workflow) return
420421
if (buf.active) { buf.todos = todos; return }
421422
if (!isOwnerActive()) return
422423
resetTimeout(); setDeepResearchTodos(todos)

frontends/ui/src/features/chat/hooks/use-load-job-data.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,8 @@ export const useLoadJobData = (): UseLoadJobDataReturn => {
425425
}
426426
},
427427

428-
onTodoUpdate: (todos: TodoItem[]) => {
428+
onTodoUpdate: (todos: TodoItem[], workflow?: string) => {
429+
if (workflow) return
429430
buffer.todos = todos
430431
},
431432

0 commit comments

Comments
 (0)