Skip to content

WebSocket Ack Request over IPC and FFI - #207

Merged
fr3shw3b merged 3 commits into
mainfrom
feat/ws-ack-request-over-ipc
Aug 27, 2026
Merged

fr3shw3b merged 3 commits into
mainfrom
feat/ws-ack-request-over-ipc

Conversation

@fr3shw3b

@fr3shw3b fr3shw3b commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds support for WebSocket Ack requests over IPC and FFI for the runtime.

Summary by CodeRabbit

  • New Features

    • Added support for waiting for client delivery acknowledgements when sending WebSocket messages, including across clustered connections and retries.
    • Acknowledgement requests are now consistently honored when explicitly requested.
  • Documentation

    • Clarified message acknowledgement, redelivery, and batch failure behavior across the Node.js, Python, and runtime SDKs.
    • Documented that reported message failures must reference messages from the current batch.

fr3shw3b and others added 3 commits August 27, 2026 09:58
… means

The comment said this was only used when broadcasting to other nodes in a
cluster, which the work that made a send mean the same thing wherever the
connection is had already made untrue. A message to a client on this node is
waited for the same way, which was the point of it.

It now says that, and says what a caller can otherwise get wrong, that a
message which does not ask its client to acknowledge it is settled by the
write, since nothing was asked and no answer is coming.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…er ipc

A handler running as a separate process could not ask for one. The contract
carried the clients to inform if a message was lost and the caller to name in
that event, and nothing for the acknowledgement those exist alongside, so the
runtime built the context with the request hard coded off. Everything the two
branches before this built, waiting for the client, sending again while
attempts remain and declaring a message lost, was reachable only by a caller
holding the bindings directly.

The message carries the request now, and the runtime builds a context where a
handler asked for either that or clients informed, rather than only the
latter. The acknowledgement a handler receives for the send then reports what
its client made of the message rather than what the socket made of it.

What a handler can get wrong is recorded on the field. The message has to ask
its client for an acknowledgement in the payload it composes, which the
runtime does not write, so asking for one on a message that asks nothing waits
until the runtime gives up on it.

The stand-in registry in the tests keeps what each send asked for, so the test
covers the path from the frame to the registry rather than the decision alone,
which is where this was wrong.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…dings

Both bindings described the shape a handler returns and not what returning it
causes. For a source that acknowledges, the result decides whether the message
is delivered again, which is the one thing a handler author needs to know
before answering, and neither binding said it.

They now record that a success acknowledges the message and a failure leaves
it on its source, that reporting success for work a handler did not do means
never seeing that work again, that naming failures answers for each message in
a batch separately while naming none answers for the whole of it, and that a
non-empty list is taken as the answer even alongside a success.

The id a failure names has to be the one the message arrived with. One
matching nothing in the batch would leave nothing behind, so the runtime
refuses the whole answer rather than acknowledging a batch it cannot apply.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@fr3shw3b
fr3shw3b merged commit 5189251 into main Aug 27, 2026
11 checks passed
@fr3shw3b
fr3shw3b deleted the feat/ws-ack-request-over-ipc branch August 27, 2026 09:07
@coderabbitai

coderabbitai Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 54310ef0-26a8-4169-b59b-6bd4f999da14

📥 Commits

Reviewing files that changed from the base of the PR and between 9347637 and 2fadb63.

⛔ Files ignored due to path filters (1)
  • libs/runtime/core/src/generated/celerity.runtime.v1.rs is excluded by !**/generated/**
📒 Files selected for processing (7)
  • libs/runtime/core/src/ipc_stream.rs
  • libs/runtime/proto/celerity/runtime/v1/runtime.proto
  • libs/runtime/sdk/node/index.d.ts
  • libs/runtime/sdk/node/src/consumer.rs
  • libs/runtime/sdk/python/python/celerity_runtime_sdk/_celerity_runtime_sdk.pyi
  • libs/runtime/sdk/python/src/consumer.rs
  • libs/runtime/ws/ws-registry/src/registry.rs

📝 Walkthrough

Walkthrough

The runtime now forwards WebSocket client acknowledgement requests through WsOutbound, SendContext, and the connection registry. Tests cover requested and absent contexts. Node.js and Python SDK documentation now describes batch acknowledgement and failure semantics.

Changes

WebSocket acknowledgement propagation

Layer / File(s) Summary
Acknowledgement contract and context
libs/runtime/proto/.../runtime.proto, libs/runtime/ws/ws-registry/src/registry.rs
WsOutbound adds wait_for_ack. SendContext documents acknowledgement behavior for local and clustered connections.
Send context propagation and validation
libs/runtime/core/src/ipc_stream.rs
The IPC stream forwards wait_for_ack to the registry, creates contexts when acknowledgement or loss notification is requested, and tests both context cases.
SDK acknowledgement documentation
libs/runtime/sdk/node/..., libs/runtime/sdk/python/...
The Node.js and Python SDKs document batch acknowledgement, redelivery, failure precedence, schedule handling, and message ID validation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ws-ack-request-over-ipc

Warning

Some tools did not complete. Review the errors below.

🔧 Buf (1.72.0)
libs/runtime/proto/celerity/runtime/v1/runtime.proto

fatal: unable to access 'https://github.com/newstack-cloud/celerity.git/': Failed to connect to github.com port 443 via 127.0.0.1 after 0 ms: Could not connect to server
fatal: could not fetch 72991602e21acdc30700ac4a2f397b4731cefda1 from promisor remote


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

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