Expand description
output.idx rebuild: a lazily-built, self-validating line-offset cache.
Structs§
- Indexed
Read - Lines
[offset, offset + limit)ofoutput, read throughoutput.idx. - Output
Index outputand itsoutput.idxas they were at ONE moment — one database snapshot (Codex on #3634): separate reads of the index’s size, header and label could each see a different version of an index another srv instance is rebuilding, and pass an old count off as fresh.
Functions§
- extend_
output_ idx - Bring an existing
output.idxup tooutput’s current size by scanning ONLY the appended bytes, instead of rescanning from byte zero. - lines_
before_ byte - How many lines of
zone’soutputstart before bytebyte, and how many there are: the line a reader loading up tobytestops at. A binary search overoutput.idx, from one snapshot;Nonewhen the index isn’t fresh foroutput(extend it first,extend_output_idx). - output_
index - See
OutputIndex.Nonewhen there is nooutput. - output_
now output’s size and valid generation, from the database — never this process’sstatcache, which another srv instance’s append makes stale. A counter only behind (an older build appended since) is caught up first, so its generation holds across those appends (filestore/counter.rs).- read_
via_ index - Read lines
[offset, offset + limit)ofoutputthrough a freshoutput.idx, with the freshness check, the index entries and the output bytes all from ONE database snapshot (Codex on #3634): validating in one read and fetching entries and bytes in later ones would let another srv instance replaceoutputand rebuild the index in between — the answer would mix the new file’s lines with the old file’s total. - read_
via_ stale_ index read_via_indexfrom an index that covers only a prefix ofoutput: lines appended since it was built aren’t returned (totalis the index’s count), nor is the last indexed line, whose end the index can’t give. For the read right after extending the index, when an append landed in between — before this, that read fell back to loading the whole transcript (1.3 GB, ~15 s, under the store’s lock) whenever an agent’s spawn was writing to the transcript its pane was opening (docs/reports/REPORT_AGENT_OPEN_STALL_RCA_2026_10_05.md). The lines it leaves out are the newest few, which the pane’s live stream delivers.Noneunder the same conditions asread_via_index, and when nothing requested is within the indexed prefix.