Skip to main content

conversation_for

Function conversation_for 

Source
pub async fn conversation_for(
    state: &TransportState,
    slot: &SessionSlot,
    timings: &mut OpenTimings,
) -> Option<Arc<Held>>
Expand description

The seat’s conversation, answering from its own transcript when the stream holds none.

A seat has two sources of history and each answers what it alone can. The transport’s held copy is the live one: the fold applies every ChatAppended the session emits, so a seat that has run in this process already has its conversation here. The transcript on disk is what a seat LEFT: a sleeping seat has no copy, and reading its file costs no wait (measured live 2026-10-12: ~2.6s for a history on disk).

So a copy is returned as it stands, and a seat with none is seeded from the file. A copy of another occupant is waited for, never replaced and never answered over: the seal the header moved on from is the fold’s to apply, and a transcript seed here would be a row subset - the Result frames a transcript never carries would go with the copy.

The two paths do not cost the same on failure. A held copy that never turns current spends the wait and is then answered as no conversation - refused rather than filled from a subset. A seat with no copy pays the file read and answers at once with what the read inserted, or with nothing when the read’s own occupant is stale; a file that holds nothing yet falls through to the same bounded wait for its first Connected.

No lock is held across the wait, and two callers on two cold seats do not serialise: each waits on its own seat’s arrival, and the notice only says that some seat’s copy moved.