Files
Peter Steinberger 4ca976fb88 perf(sessions): skip cold envelopes for transcripts over the archive limit (#183378)
* perf(sessions): skip cold envelopes for transcripts over the archive limit

Cold storage learned that a transcript exceeds the 64 MiB uncompressed
archive limit only after building its whole envelope inside a read
snapshot, then ended the batch. On Team, 50 windows (6.15 GiB) are over
the limit; their snapshot reads took a median 3.2 s and up to 106 s, and
the in-memory cooldown resets on every deploy, so each restart re-read
them.

Selection now sums the original event bytes through the session index
and classifies those windows as oversized before any envelope work; later
candidates in the same pass still archive. The warning names the session
and the lower-bound bytes.

* fix(sessions): bound UTF-16 stores by UTF-8 bytes in the cold pre-check

UTF-16 SQLite stores leave event_utf8_bytes null, and octet_length counts
stored UTF-16 bytes, so the pre-check could mark an archivable transcript
oversized and park it on cooldown. Sum exact UTF-8 bytes where known and
halve unknown stored bytes on UTF-16 stores, as sqlite-jsonl-budget does.
2026-10-25 11:30:24 +00:00
..