Skip to main content

request_context_usage

Function request_context_usage 

Source
fn request_context_usage(
    state: &TransportState,
    probes: &mut ContextProbe,
    update: &SessionUpdate,
)
Expand description

Ask the core for a fresh context reading on a seat a page shows.

A turn finishing is when a reading stops being true: the transcript grew by the turn, and the number the seat holds was taken before it. A view refreshes on the same frame, for the seat it is addressing, and a client reading a seat is that same act - the answer lands as a SessionUpdate::ContextUsageSnapshot on the stream that page is already reading.

Only a seat a page shows, because the reading exists for the reader and the probe costs the CLI a walk over its whole transcript. Bounded by probe, the same limits a view applies to its own ask - except for the post-compaction ask, which may not be refused by the reading it exists to replace.

Both records below are debug lines and nothing else. The refusal is the one asserted, and it is emitted from the spawned fold rather than from anything a test drives - so the test that reads it back holds a subscriber across its awaits rather than calling the crate’s test_support::logged, which runs a closure to completion on the caller’s thread and cannot span the fold. The read path’s own ask in transport::wire has the same record and no test.

That refusal is not only the no-agent case: the same arm carries a seat with no stamped session id and one whose session has closed, which is what refresh_context_usage refuses.