Skip to content

Language interoperability#1162

Open
chuck-dbos wants to merge 37 commits intomainfrom
chuck/interop
Open

Language interoperability#1162
chuck-dbos wants to merge 37 commits intomainfrom
chuck/interop

Conversation

@chuck-dbos
Copy link
Collaborator

@chuck-dbos chuck-dbos commented Jan 28, 2026

Support for enqueuing and interacting with workflows across languages. Centers on use of simple JSON in the workflow_status and other tables, adds a column to distinguish the serialization format.

Portable enqueue can be done via DBOSClient, DBOS., and direct INSERT into the WF status table. startWorkflow will also start a workflow with portable serialization format, if it is requested, or if the registration indicates such. Portable WFs will set their return value, events, and stream writes in portable format, but this can be overridden when calling DBOS.setEvent, DBOS.writeStream, and DBOS.send, allowing full interaction across languages.

Obviously, this tightens the rules about arguments and return values... for portable workflows the rule is "must be serializable as plain JSON" not "must be serializable with SuperJSON".

serialization: string | null,
serializer: DBOSSerializer,
): Error {
if (serialization === DBOSPortableJSON.name()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work? I might be missing something, but errors won't be portable-JSON-serializable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, we are replacing errors with an error with a portable surface area containing:
Message - (seems to exist universally)
Name - class name (commonly exists)
Code - seems common enough to keep
Data - Where everything else goes, up to the app
This pattern is what is used in other frameworks that do similar things.

If you just want an error for human consumption / to know if it went wrong, this will be OK. If you want to be able to handle the error exactly as thrown, you need to get your function to throw/catch an error of this shape. (Your whole function prototype has tighter restrictions than that of the native language serializer, this compromise is inevitable when making portable calls.)

There is currently one loose end with that that I intend to fix ... reinterpreting whatever is thrown from a WF into this error within a direct TS call that does not use the handle.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out that errors aren't serializable with any fidelity at all in JS, and we have a small hole in the SDK already.

@chuck-dbos chuck-dbos marked this pull request as ready for review February 6, 2026 13:25
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.

2 participants