Skip to content

Conversation

@rovo89
Copy link

@rovo89 rovo89 commented Feb 11, 2026

I'm currently building a chat using DurableAgent and frequently (almost for every message) had missing chunks. Often the text-start was missing or some of the words were lost. The chunks are persisted totally fine.

Investigations have shown that the chunks were dismissed as out-of-order. Indeed, they arrived at the listen handler in a different order than they were processed in writeToStreamMulti(). Since making the proposed changes - especially awaiting the `postgres.notify()´ calls - I haven't seen a single missing chunk.

While it might technically work, it hands control back to the Postgres
module very early and then relies on microtask scheduling to ensure the
correct order. But after parsing the message, the function already uses
a mutex for correct ordering of chunks within a stream, so each chunk
is queued twice. Parsing synchronously avoids that back-and-forth and
makes the code flow easier to follow.


Signed-off-by: Robert Vollmer <[email protected]>
@changeset-bot
Copy link

changeset-bot bot commented Feb 11, 2026

🦋 Changeset detected

Latest commit: 3ac3271

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@workflow/world-postgres Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Contributor

vercel bot commented Feb 11, 2026

@rovo89 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Signed-off-by: Robert Vollmer <[email protected]>
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