[go] Merged memory extractor with ingestion task handler (#17730)

Routes async memory extraction through the shared ingestion NATS
pipeline via task_type=memory, removing the dedicated Redis consumer.
Memory failures ack terminally, transient errors nack for redelivery.
This commit is contained in:
Zhichang Yu
2026-08-03 17:08:14 +08:00
committed by GitHub
parent 8ac047d11a
commit c69a2d4798
10 changed files with 430 additions and 82 deletions

View File

@@ -559,6 +559,10 @@ func runIngestor(ctx context.Context, cancel context.CancelFunc, args *serverArg
globalConfig.GetDefaultChatModel().Name,
globalConfig.GetDefaultEmbeddingModel().Name,
)
// Memory extraction runs on the Ingestor's shared NATS consumer + worker
// pool (task_type="memory" dispatched by processMessage -> executeMemoryTask),
// so there is no longer a dedicated Redis memory consumer to start.
ingestor.SetMemoryMessageService(service.NewMemoryMessageService(service.NewMemoryService()))
// Start returns immediately (it launches the owned consume/compile
// goroutines and joins them via Stop); a provisioning failure here is
@@ -567,13 +571,6 @@ func runIngestor(ctx context.Context, cancel context.CancelFunc, args *serverArg
common.Error("Failed to initialize ingestor", err)
}
// Memory extraction consumer: drains task_type="memory" messages
// from the te.0.common Redis stream and runs LLM extraction.
memoryConsumerCtx, stopMemoryConsumer := context.WithCancel(ctx)
defer stopMemoryConsumer()
memoryMessageSvc := service.NewMemoryMessageService(service.NewMemoryService())
go memoryMessageSvc.StartTaskConsumer(memoryConsumerCtx)
common.Info("\n ____ __ _\n" +
" / _/___ ____ ____ _____/ /_(_)___ ____ ________ ______ _____ _____\n" +
" / // __ \\/ __ `/ _ \\/ ___/ __/ / __ \\/ __ \\ / ___/ _ \\/ ___/ | / / _ \\/ ___/\n" +