Skip to content

fix(supermemory): gate indexing readiness on dreamingStatus#45

Open
sreedharsreeram wants to merge 1 commit into
mainfrom
sreedharsreeram/poll-dreaming-status
Open

fix(supermemory): gate indexing readiness on dreamingStatus#45
sreedharsreeram wants to merge 1 commit into
mainfrom
sreedharsreeram/poll-dreaming-status

Conversation

@sreedharsreeram

Copy link
Copy Markdown
Member

What

The Supermemory indexing poll (awaitIndexing) previously treated doc.status === "done" as fully indexed. That's unsafe with the deferred dreaming path: the backend atomically writes status:"done" + dreamingStatus:"dreaming", so a doc reads "done" the entire time dreaming inference runs. Searching during that window returns nothing.

Change

A doc is now considered ready only when:

doc.status === "done" && dreamingStatus !== "dreaming"

(still also gated on memory.status === "done" downstream).

Why not dreamingStatus alone? Its column default is "done", so a doc still at status:"indexing" would read dreamingStatus:"done" and be declared ready before ingest even finishes. Both fields together is the only race-free condition.

dreamingStatus is read via a cast since the installed supermemory SDK type (DocumentGetResponse) doesn't expose the field yet.

Testing

Not yet validated end-to-end — the local worker on :8787 was flapping (503 / 500 / connection refused) during attempts, so ingest never reached the indexing phase. Logic type-checks clean. Worth a run against a stable backend before merge.

🤖 Generated with Claude Code

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) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant