Skip to content

fix(tools): await conversation persistence#1276

Open
GautamSharma99 wants to merge 1 commit into
supermemoryai:mainfrom
GautamSharma99:fix/await-vercel-conversation-persistence
Open

fix(tools): await conversation persistence#1276
GautamSharma99 wants to merge 1 commit into
supermemoryai:mainfrom
GautamSharma99:fix/await-vercel-conversation-persistence

Conversation

@GautamSharma99

Copy link
Copy Markdown
Contributor

Summary

The Vercel AI SDK middleware previously started conversation persistence without
awaiting it. This allowed non-streaming requests and output streams to finish
while the /v4/conversations request was still pending.

In serverless environments, the runtime could terminate immediately afterward and
silently lose the conversation.

Changes

  • Await conversation persistence before doGenerate resolves.
  • Await persistence during stream finalization.
  • Preserve immediate delivery of streamed response chunks.
  • Add regression tests for both non-streaming and streaming paths.

Testing

  • Focused Vitest tests pass.
  • Focused Bun tests pass.
  • Biome checks pass.
  • Package build passes.
  • Changed files have no TypeScript diagnostics.
  • Full repository suite: 311 passed, 64 skipped, with 21 pre-existing unrelated
    failures.

Notes

Persistence errors remain non-fatal because saveMemoryAfterResponse already
handles and logs failures internally.

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