Skip to content

Commit 738654d

Browse files
fix(memory): add batch completed log after embedding batch finishes (#94732)
* [AI] fix(memory): add batch completed and batch failed logs for embedding ops The embedBatchWithRetry function logged 'batch start' but never logged 'batch completed' or 'batch failed' after the embedding batch call, leaving operators with no post-request feedback. When batches hang or time out, only 'batch start' appears in logs with no diagnostic signal. Add 'batch completed' log after runEmbeddingOperationWithTimeout success and 'batch failed' log in the catch handler. This is an observability improvement, not a functional fix for the underlying hang (#93312). Related to #93312 * [AI] fix(memory): use formatErrorMessage for embedding batch error log Replace String(err) with formatErrorMessage(err) in the batch failed catch handler to redact sensitive provider error text (e.g. API keys and tokens embedded in error messages) before logging. Related to #94732 --------- Co-authored-by: Vincent Koc <[email protected]>
1 parent 7f29380 commit 738654d

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎extensions/memory-core/src/memory/manager-embedding-ops.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,16 @@ export abstract class MemoryManagerEmbeddingOps extends MemoryManagerSyncOps {
408408
items: batchTexts.length,
409409
timeoutMs,
410410
});
411-
return await runEmbeddingOperationWithTimeout({
411+
const result = await runEmbeddingOperationWithTimeout({
412412
timeoutMs,
413413
message: `memory embeddings batch timed out after ${Math.round(timeoutMs / 1000)}s`,
414414
run: async (signal) => await provider.embedBatch(batchTexts, { signal }),
415415
});
416+
log.debug("memory embeddings: batch completed", {
417+
provider: provider.id,
418+
items: batchTexts.length,
419+
});
420+
return result;
416421
},
417422
isRetryable: isRetryableMemoryEmbeddingError,
418423
isSplittable: isSplittableMemoryEmbeddingTransportError,
@@ -428,6 +433,10 @@ export abstract class MemoryManagerEmbeddingOps extends MemoryManagerSyncOps {
428433
},
429434
});
430435
} catch (err) {
436+
log.debug("memory embeddings: batch failed", {
437+
provider: provider.id,
438+
error: formatErrorMessage(err),
439+
});
431440
this.markLocalEmbeddingProviderDegraded(err);
432441
throw createMemoryEmbeddingOperationError({
433442
operation: "batch",

0 commit comments

Comments
 (0)