Repository navigation
feat(server)!: stream everything a mirror sends the server over one stream - #97
Merged
Merged
Conversation
…tream A mirror's state and its changes now travel over one ordered stream, so the server learns of a quarantine as it happens from the same place as everything else, and later traffic such as captures can share it instead of opening its own connection. The reconnecting, resyncing and keepalives are generic, so the next kind of message only adds a variant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeping a quiet stream alive is the stream's concern, so every kind of message a stream carries would otherwise need its own keepalive variant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OutChannel says what it is: the outgoing half of a channel to the server, which keeps its stream open, rather than a mailbox messages wait in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In staging, Caddy ended request streams that were quiet for 60s, so a longer keepalive interval would drop every quiet mirror's stream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jvmakine
marked this pull request as ready for review
November 4, 2026 04:08
alecthomas
reviewed
Nov 4, 2026
alecthomas
approved these changes
Nov 4, 2026
The reporter is the only stream a mirror opens, so a generic channel abstracted over one caller. Captures can pull out an abstraction once they are a second caller that shows what it needs. Each source sends its quarantine once, so the queue never fills and the reporter's run loop owns the quarantines without a lock. Co-Authored-By: Claude Opus 5.5 <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.
A mirror sent its whole state to the server every 30s with a unary
Update, so the server learned of a quarantine only when the next call arrived. Upcoming pod traffic, such as captures, would have needed its own calls. Now everything a mirror sends the server travels over one orderedUpdatestream, as agreed in the review of #96.The reporter keeps the mirror's one stream open:
--server-keepalive-interval(30s). This keeps the stream inside the 60s idle limit Caddy puts on request streams (found in staging, reproduced locally) and the server's 90s state TTL, and a failed keepalive is how a mirror notices a dead stream.--server-stream-max-age(10m, with jitter), so streams spread across server replicas after a deploy and never depend on mesh connection limits.The stream is client streaming rather than bidirectional, so it works over HTTP/1.1 through the mesh egress socket. A mirror's messages are a
model.Updatesum type of the whole state or a quarantine. Captures will add a variant. Keepalives belong to the stream rather than the update type. The reporter is the only stream for now; when captures need the same stream, we can pull out a shared abstraction with two real callers to shape it.Breaking changes:
Updateis now a client-streaming RPC whose first message is the mirror's whole state.--heartbeat-intervalis replaced by--server-keepalive-intervaland--server-stream-max-age.🤖 Generated with Claude Code