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.

🔨 chore(userMemories): @upstash/workflow workflow id will drift, fallback to chat-topic group serveMany (#12154)

Neko265491cfde28
diff --git a/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topic/[...any]/route.ts b/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/[...any]/route.ts
similarity index 87%
rename from src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topic/[...any]/route.ts
rename to src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/[...any]/route.ts
index 4437f3bb8f8..b86572ac51c 100644
--- a/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topic/[...any]/route.ts
+++ b/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/[...any]/route.ts
@@ -3,7 +3,7 @@ import { serveMany } from '@upstash/workflow/dist/nextjs';
import { parseMemoryExtractionConfig } from '@/server/globalConfig/parseMemoryExtractionConfig';
-import { processTopicWorkflow } from '../workflows/topic';
+import { processTopicWorkflow } from '../process-topic/workflows/topic';
const { upstashWorkflowExtraHeaders } = parseMemoryExtractionConfig();
diff --git a/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topic/workflows/topic.ts b/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topic/workflows/topic.ts
index b392ac67fd0..63634009691 100644
--- a/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topic/workflows/topic.ts
+++ b/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topic/workflows/topic.ts
@@ -174,4 +174,4 @@ export const processTopicWorkflow = createWorkflow<MemoryExtractionPayloadInput,
},
);
-processTopicWorkflow.workflowId = 'process-topic/process-topic';
+processTopicWorkflow.workflowId = 'process-topic';
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 52b87994b09..fbadda7db8b 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
@@ -46,11 +46,6 @@ export const { POST } = serve<MemoryExtractionPayloadInput>(
});
try {
- console.log('[chat-topic][batch] Starting batch topic processing workflow', {
- topicIds: payload.topicIds,
- userIds: payload.userIds,
- });
-
if (!payload.userIds.length) {
span.setStatus({ code: SpanStatusCode.OK });
@@ -113,10 +108,6 @@ export const { POST } = serve<MemoryExtractionPayloadInput>(
}),
);
- console.log('[chat-topic][batch] Batch topic processing workflow completed', {
- processedTopics: payload.topicIds.length,
- });
-
// Trigger user persona update after topic processing using the workflow client.
await context.run(`memory:user-memory:users:${userId}`, async () => {
await MemoryExtractionWorkflowService.triggerPersonaUpdate(userId, payload.baseUrl, {
diff --git a/src/server/services/memory/userMemory/extract.ts b/src/server/services/memory/userMemory/extract.ts
index 7696408fc9e..c81bdd1821e 100644
--- a/src/server/services/memory/userMemory/extract.ts
+++ b/src/server/services/memory/userMemory/extract.ts
@@ -2177,9 +2177,6 @@ export class MemoryExtractionExecutor {
const WORKFLOW_PATHS = {
personaUpdate: '/api/workflows/memory-user-memory/pipelines/persona/update-writing',
- // process-topic is exposed via serveMany under a catch-all route, so it requires the extra slug
- // segment to reach the actual workflow handler.
- topic: '/api/workflows/memory-user-memory/pipelines/chat-topic/process-topic/process-topic',
topicBatch: '/api/workflows/memory-user-memory/pipelines/chat-topic/process-topics',
userTopics: '/api/workflows/memory-user-memory/pipelines/chat-topic/process-user-topics',
users: '/api/workflows/memory-user-memory/pipelines/chat-topic/process-users',
@@ -2270,28 +2267,6 @@ export class MemoryExtractionWorkflowService {
});
}
- static triggerProcessTopic(
- userId: string,
- topicId: string,
- payload: MemoryExtractionPayloadInput,
- options?: { extraHeaders?: Record<string, string> },
- ) {
- if (!payload.baseUrl) {
- throw new Error('Missing baseUrl for workflow trigger');
- }
-
- const url = getWorkflowUrl(WORKFLOW_PATHS.topic, payload.baseUrl);
- return this.getClient().trigger({
- body: { ...payload, topicIds: [topicId], userId, userIds: [userId] },
- flowControl: {
- key: `memory-user-memory.pipelines.chat-topic.process-topic.user.${userId}.topic.${topicId}`,
- parallelism: 5,
- },
- headers: options?.extraHeaders,
- url,
- });
- }
-
static triggerPersonaUpdate(
userId: string,
baseUrl: string,