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.
Enums§
- Extend 🔒
Constants§
- IDX 🔒
- IDX_
GEN_ 🔒META - Key in
output.idx’s file metadata naming theoutputgeneration the index was built for (Phase 5a-2b;filestore/counter.rs). Written in the same transaction as the index, so the label always describes the bytes. - OUTPUT_
IDX_ 🔒HEADER_ LEN - Magic header size for
output.idx: the first 8 bytes are theoutputbyte-size the index was built for. The index is valid iff this equalsoutput’s current size; otherwise it is stale and must be rebuilt.
Functions§
- build_
output_ 🔒idx_ from - Shared scanner behind both entry points.
- extend_
output_ 🔒idx - Bring an existing
output.idxup tooutput’s current size by scanning ONLY the appended bytes, instead of rescanning from byte zero. - labelled_
for 🔒 - Whether an index with metadata
metamay describeoutputof generationoutput_gen, apart from its covered size. - 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_
indexed 🔒 - 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.- try_
extend 🔒