SMOODEV-1891: Connection backplane — pluggable scale-out + event-delivery seam#7
Merged
Conversation
…very seam Adds the foundation for running smooth-operator as a horizontally-scaled WS service (ADR-027) and the plug point for non-AI realtime. - smooth_operator::backplane (lib): a `Backplane` async trait (attach/detach a connection's local sink, associate it with targets, publish(Target, event) to every connection for a target) + a default `InMemoryBackplane` (registry + direct local delivery). Runtime-agnostic: the sink is a `LocalSink` closure, so the lib takes no async-runtime dependency. `Target` = Connection/Session/User/ Org/Agent. - Server: each connection attaches its sink on connect, associates its session + agent at create-session, detaches on disconnect. AppState gains the provider (`with_backplane`, default InMemory). - A Redis/NATS impl (SMOODEV-1892) makes the same publish() fan out cross-pod. Tests: 5 lib unit (publish/associate/detach/multi-target) + 2 WS e2e (an out-of-band publisher reaches a live client over WS; detach stops delivery on disconnect). fmt + clippy clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: d9b4e09 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
kind-deploy-smoke has been red on every PR (incl. #6, last merged to main): the Dockerfile builds with `cargo build --release --locked`, which requires a committed Cargo.lock, but .gitignore excluded it. A workspace that ships a binary must commit its lock. Un-ignore + commit the resolved graph. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The foundational build for ADR-027 — running smooth-operator as a horizontally-scaled WS service — and the plug point for non-AI realtime.
The reference server was single-process: each connection's sink is an in-process channel with no registry and no way to reach a connection from outside its own read loop. That blocks (a) >1 replica and (b) any non-agent service pushing events to a client. The
Backplaneis the seam for both.smooth_operator::backplane(public mechanism): aBackplaneasync trait —attach/detacha connection's local sink,associateit with targets,publish(Target, event)to every connection for a target — plus a defaultInMemoryBackplane(in-memory registry + direct local delivery).Target= Connection / Session / User / Org / Agent. Runtime-agnostic: the sink is aLocalSinkclosure, so the lib takes no async-runtime dependency.create_conversation_session, and detaches on disconnect.AppState::with_backplane()(defaultInMemoryBackplane).publish()fan out across pods — multi-replica scale-out.Why it matters
Backplane.publish(Target::Session(...), event)is callable by any service (job status, ingestion progress, notifications) — AI becomes one publisher among many, and realtime becomes a general pub/sub→WebSocket substrate.Verification
129 + 21 + 2 + 4green.)cargo fmt --check+ clippy clean; no async-runtime dep added to the lib.Epic SMOODEV-1887 (ADR-027). Next: SMOODEV-1892 (Redis/NATS impls).
🤖 Generated with Claude Code