From e9dd0314f0e450cecab05889e28c2b560722a241 Mon Sep 17 00:00:00 2001 From: euvre <93761161+euvre@users.noreply.github.com> Date: Wed, 5 Aug 2026 22:51:50 -0700 Subject: [PATCH] Fix: dataflow log sheet shows the previous run's log in Go mode (#17790) --- web/src/pages/agent/hooks/use-run-dataflow.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/web/src/pages/agent/hooks/use-run-dataflow.ts b/web/src/pages/agent/hooks/use-run-dataflow.ts index da74fc8865..217bfc6679 100644 --- a/web/src/pages/agent/hooks/use-run-dataflow.ts +++ b/web/src/pages/agent/hooks/use-run-dataflow.ts @@ -1,5 +1,6 @@ import message from '@/components/ui/message'; import { useSendMessageBySSE } from '@/hooks/use-send-message'; +import i18n from '@/locales/config'; import api from '@/utils/api'; import { get } from 'lodash'; import { useCallback, useState } from 'react'; @@ -25,6 +26,13 @@ export function useRunDataflow({ const success = saveRet?.code === 0; if (!success) return; + // The Go backend runs the dataflow debug synchronously, so the new + // message_id only arrives with the run response (seconds later). + // Clear the previous polling key first so the log sheet renders the + // loading state instead of replaying the previous run's log, which is + // still within its Redis TTL and would otherwise look like the current + // result. + setMessageId(''); showLogSheet(); const res = await send({ agent_id: id, @@ -34,7 +42,14 @@ export function useRunDataflow({ files: [fileResponseData.file], }); - if (res && res?.response.status === 200 && get(res, 'data.code') === 0) { + if (!res) { + // send() swallowed a network/parse failure; without a new message_id + // the sheet would stay on the previous run's log, so surface it. + message.error(i18n.t('message.requestError')); + return; + } + + if (res?.response.status === 200 && get(res, 'data.code') === 0) { // fetch canvas setUploadedFileData(fileResponseData.file[0]); const msgId = get(res, 'data.data.message_id');