From 9027a5c28dadd9f6524923e831fbb7e4237522dc Mon Sep 17 00:00:00 2001 From: Sreeram Sreedhar Date: Wed, 10 Jun 2026 15:27:23 -0700 Subject: [PATCH] fix(supermemory): gate indexing readiness on dreamingStatus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The indexing poll previously treated status === "done" as fully ready. In the deferred dreaming path the backend atomically writes status:"done" + dreamingStatus:"dreaming", so a doc reads "done" the entire time dreaming inference runs — searching then returns nothing. A doc is now considered ready only when status === "done" AND dreamingStatus !== "dreaming" (still also requiring memory.status === "done"). dreamingStatus alone is unsafe since its column default is "done", so a doc still at status:"indexing" would read prematurely ready. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/providers/supermemory/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/providers/supermemory/index.ts b/src/providers/supermemory/index.ts index 027bc32..2aca344 100644 --- a/src/providers/supermemory/index.ts +++ b/src/providers/supermemory/index.ts @@ -83,11 +83,14 @@ export class SupermemoryProvider implements Provider { const results = await Promise.allSettled( pendingArray.map(async (docId) => { const doc = await this.client!.documents.get(docId) - if (doc.status === "done" || doc.status === "failed") { + const dreamingStatus = (doc as { dreamingStatus?: string }).dreamingStatus + const docReady = doc.status === "done" && dreamingStatus !== "dreaming" + const docFailed = doc.status === "failed" + if (docReady || docFailed) { const memory = await this.client!.memories.get(docId) - return { docId, docStatus: doc.status, memStatus: memory.status } + return { docId, docStatus: docFailed ? "failed" : "done", memStatus: memory.status } } - return { docId, docStatus: doc.status, memStatus: "pending" } + return { docId, docStatus: "pending", memStatus: "pending" } }) )