From f81e0c7c8dba77007b69c992142ee633ae943703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yanli=20=E7=9B=90=E7=B2=92?= Date: Wed, 18 Mar 2026 18:18:36 +0800 Subject: [PATCH] fix: align agent log guards with workflow types --- .../use-workflow-run-event-store-only.spec.ts | 16 ---------------- .../use-workflow-agent-log.ts | 3 --- .../workflow/panel/debug-and-preview/hooks.ts | 3 --- 3 files changed, 22 deletions(-) diff --git a/web/app/components/workflow/hooks/__tests__/use-workflow-run-event-store-only.spec.ts b/web/app/components/workflow/hooks/__tests__/use-workflow-run-event-store-only.spec.ts index 57f7298e68..8574047e70 100644 --- a/web/app/components/workflow/hooks/__tests__/use-workflow-run-event-store-only.spec.ts +++ b/web/app/components/workflow/hooks/__tests__/use-workflow-run-event-store-only.spec.ts @@ -202,22 +202,6 @@ describe('useWorkflowAgentLog', () => { expect(tracing[1].execution_metadata!.agent_log).toHaveLength(1) expect(tracing[1].execution_metadata!.agent_log![0].message_id).toBe('m2') }) - - it('should ignore agent logs when node_execution_id is missing', () => { - const { result, store } = renderWorkflowHook(() => useWorkflowAgentLog(), { - initialStoreState: { - workflowRunningData: baseRunningData({ - tracing: [{ id: 'trace-1', node_id: 'n1', execution_metadata: {} }], - }), - }, - }) - - result.current.handleWorkflowAgentLog({ - data: { node_id: 'n1', message_id: 'm1' }, - } as AgentLogResponse) - - expect(store.getState().workflowRunningData!.tracing![0].execution_metadata!.agent_log).toBeUndefined() - }) }) describe('useWorkflowNodeHumanInputFormFilled', () => { diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-agent-log.ts b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-agent-log.ts index 0f88572a0b..a1a94df361 100644 --- a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-agent-log.ts +++ b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-agent-log.ts @@ -13,9 +13,6 @@ export const useWorkflowAgentLog = () => { setWorkflowRunningData, } = workflowStore.getState() - if (!data.node_execution_id) - return - setWorkflowRunningData(produce(workflowRunningData!, (draft) => { const currentIndex = draft.tracing!.findIndex(item => item.id === data.node_execution_id) if (currentIndex > -1) { diff --git a/web/app/components/workflow/panel/debug-and-preview/hooks.ts b/web/app/components/workflow/panel/debug-and-preview/hooks.ts index f7c182867f..04fd058056 100644 --- a/web/app/components/workflow/panel/debug-and-preview/hooks.ts +++ b/web/app/components/workflow/panel/debug-and-preview/hooks.ts @@ -530,9 +530,6 @@ export const useChat = ( } }, onAgentLog: ({ data }) => { - if (!data.node_execution_id) - return - const currentNodeIndex = responseItem.workflowProcess!.tracing!.findIndex(item => item.id === data.node_execution_id) if (currentNodeIndex > -1) { const current = responseItem.workflowProcess!.tracing![currentNodeIndex]