From f7b10d42e484b308b3883e9c311baa7fa7960c30 Mon Sep 17 00:00:00 2001 From: yangzheli <43645580+yangzheli@users.noreply.github.com> Date: Thu, 30 Apr 2026 06:41:54 +0800 Subject: [PATCH] fix(frontend): create thread on first submit in new-agent page (#2656) The new-agent page pre-generates a thread UUID and passed it directly to useThreadStream, which made the LangGraph SDK POST to /threads/{uuid}/runs/stream against a thread the backend had never created. After PR #2566 introduced multi-tenant owner checks on the runs endpoints, that request now 404s with "Thread not found". Pass threadId: undefined to useThreadStream so the SDK takes the create-then-run path. The pre-generated UUID is still forwarded via SubmitOptions.threadId in sendMessage, so the new thread is created with that exact id and onCreated rebinds the hook to it. Co-authored-by: Claude Opus 4.7 --- frontend/src/app/workspace/agents/new/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/workspace/agents/new/page.tsx b/frontend/src/app/workspace/agents/new/page.tsx index 06f50c365..f5b2e6070 100644 --- a/frontend/src/app/workspace/agents/new/page.tsx +++ b/frontend/src/app/workspace/agents/new/page.tsx @@ -102,7 +102,7 @@ export default function NewAgentPage() { const threadId = useMemo(() => uuid(), []); const { thread, sendMessage } = useThreadStream({ - threadId: step === "chat" ? threadId : undefined, + threadId: undefined, context: { mode: "flash", is_bootstrap: true,