Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(userMemories): skip to handle WorkflowAbort (#11031)

Neko17124a8e7385
diff --git a/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topics/route.ts b/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topics/route.ts
index dd7de09e356..97622fbd68f 100644
--- a/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topics/route.ts
+++ b/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topics/route.ts
@@ -5,6 +5,7 @@ import {
} from '@lobechat/observability-otel/modules/upstash-workflow';
import { LayersEnum, MemorySourceType } from '@lobechat/types';
import { serve } from '@upstash/workflow/nextjs';
+import { WorkflowAbort } from '@upstash/workflow';
import {
MemoryExtractionExecutor,
@@ -118,11 +119,18 @@ export const { POST } = serve<MemoryExtractionPayloadInput>((context) =>
processedUsers: payload.userIds.length,
};
} catch (error) {
+ // NOTICE: Let WorkflowAbort bubble up (used internally by Upstash); record others
+ if (error instanceof WorkflowAbort) {
+ console.warn('workflow aborted:', error.message);
+ throw error;
+ }
+
span.recordException(error as Error);
span.setStatus({
code: SpanStatusCode.ERROR,
message: error instanceof Error ? error.message : 'process-topics workflow failed',
});
+
throw error;
} finally {
span.end();