Late is lost: weida learns to drop on purpose
Two projects asked weida for data that may be lost. An agent wrote the design from their requirements, I accepted it, and it was built one backlog item at a time.
Until this week weida delivered all of a unit or a named failure. Within a connection QUIC retransmits until the stream finishes or is reset, which is right for a file and wrong for a voice frame: “a 20 ms audio frame that arrives after its playout time is worthless”. Decision 0034, Late is lost, gives weida a way to lose data on purpose, where the loss can be seen and nobody waits for it.
Two requests from outside
The sentence about the audio frame is not mine. It comes from one of two requirement documents that projects building on weida filed against it:
- griasdi voice: griasdi is a chat and voice application in which every byte travels over weida. Voice is 50 datagrams a second per speaker, 80 to 250 bytes each, from a client to its server and from the server to everyone who listens.
- zeughaus video: fan-out of preview frames to several viewers, and later compressed video, whose frames depend on each other.
griasdi asked for a primitive and explicitly not for a pattern, because fan-out is the forwarding server’s job. I wanted more than that: something that is part of weida itself, so that architectures like these can be expressed in it, even if that takes new patterns. Both positions are recorded in the decision, and the second one shaped it.
What reading quinn turned up
Before any of it was built, writing the decision meant reading quinn’s source, and that turned up a problem that already existed. Every weida QUIC connection advertised datagram support, and quinn would buffer up to STREAM_RWND = 1 250 000 bytes of a peer’s datagrams per connection, which weida never read. The buffer is bounded, it drops the oldest, but no document named it: at 64 connections that is about 80 MB per peer.
It was the first item fixed, in ef27f72 (“fix(weida): stop advertising datagrams nobody reads”). The regression test saw max_datagram_size() == Some(1162) before the fix and None after it. The analysis is in 0034 §2.3, the result in the B-279 line of docs/NIGHTLOG.md.
One carrier, two stream mechanisms, one pattern
That is the shape of the decision:
- A datagram flow at L0. A FLOW stream registers it and is its lifetime, its units travel as QUIC datagrams,
sendnever waits, and a slow reader loses its oldest datagrams. It is off by default. Where the peer has not agreed to datagrams, opening a flow fails with a named error; weida never quietly substitutes a stream, which would deliver the unit late. - Expiry and priority on the streams that already exist:
OutgoingTransfer::expire_atresets a stream whose bytes are not all acknowledged by a deadline, andset_priorityhandsquinn’s priority to the stream. - RADIO/DISH, ZeroMQ’s name for lossy fan-out. A new segment resets the unacknowledged copies of the previous one on its topic, a dish states a
max_age, and a dish that falls behind loses the old segment, never the new one.
A forwarding server is one loop
The guide teaches it with a program, crates/weida/examples/guide_late_is_lost.rs, and crates/weida/tests/guide.rs asserts what it prints. This is the whole forwarding path of a selective forwarding unit, from docs/GUIDE.md §2.6:
while let Ok(Incoming::Flow(mic)) = mics.accept().await {
let radio = room.clone();
tokio::spawn(async move {
while let Some(frame) = mic.recv().await {
let _ = radio.datagram("room.voice", frame);
}
});
}A microphone is a flow into the server, and every frame goes back out as a one-packet segment on the radio. The payload is bytes to it; in griasdi’s case it is ciphertext the server cannot read. The program’s own output:
100 of 100 frames reached both listeners; 5 of 5 segments crossed the relay; payload untouched: trueWhat voice costs beside a bulk upload
Item B-289 measured one question the decision left open: what a bulk upload to the same host does to a voice flow, by path and by congestion controller. The conditions, from docs/IMPLEMENTATION.md §4 “Verified results — voice beside bulk (B-289)”, commit c45c63c: AMD Ryzen 7 5800X, Linux 7.2.8, rustc 1.98.1, release profile, loopback through an in-process shaper (20 Mbit/s from client to server into a 64 KiB drop-tail queue), voice of 200 bytes at 50 Hz beside back-to-back 1 MiB uploads, two runs of the whole probe. Each cell gives both runs.
| Paths | Controller | Voice p50 (ms) | Voice p95 (ms) | Voice loss (%) |
|---|---|---|---|---|
| separate | CUBIC | 43.0 / 43.9 | 81.6 / 91.7 | 4.10 / 4.60 |
| separate | BBR | 5.6 / 5.6 | 6.7 / 47.7 | 8.69 / 8.69 |
| one | CUBIC | 42.7 / 42.2 | 49.5 / 49.5 | 0.00 / 0.00 |
| one | BBR | 8.8 / 48.5 | 56.6 / 52.8 | 5.39 / 1.90 |
The rule was set before measuring: on separate paths, BBR had to cut voice p95 by at least 30 %. It did, so 0034 §6 now says that a bulk profile sharing a bottleneck with media runs BBR. The default stays CUBIC. The same rows show the price: voice loss roughly doubles under BBR, and its p95 differs sevenfold between the two runs.
The backlog item asked for tc netem. The agent’s loop runs without sudo, so it built a userspace shaper instead and flagged that for me to look at. A loopback with a userspace shaper is not a residential uplink, and the document says so.
How it was built
This is the part the log is for. The decision was written by a coding agent from the two requirement documents. I reviewed it and accepted it in fce4fd8 (“docs(decisions): accept 0034, late is lost”). After that it was built as backlog items B-279 to B-292 under the rule of docs/LOOP.md: one backlog item, one gate, one commit. The whole run is the 29 commits from accepting the note to 59f79f6, which brings RADIO/DISH to blocking Rust and Python.
The run ended with the nightlog’s review section, written for me. Apart from the shaper it named three corrections the plan had not asked for, each recorded on its item: the radio keeps a floor when it evicts a topic, so a re-created topic cannot restart below a dish’s newest segment (B-285); a fuzz target that had not compiled since the protocol gained DATA key 13 was fixed in 862ac88; and the guide program paces its segments at a frame interval, because segments sent back to back counted the reader’s own copies as superseded before their acknowledgement arrived (B-290).
What this does not claim
Nobody runs datagram flows or RADIO/DISH yet. griasdi and zeughaus asked for them, and neither uses them today. The measurement above is one machine on loopback, and nothing here is tested for interoperability with MOQT or moq-lite.
