pi/omp: discover transcripts whose session record follows a title slot - #859
Draft
avs-io wants to merge 1 commit into
Draft
pi/omp: discover transcripts whose session record follows a title slot#859avs-io wants to merge 1 commit into
avs-io wants to merge 1 commit into
Conversation
The shared Pi/OMP discovery gate only checked the first physical line of a transcript for a `type: "session"` record. Oh My Pi writes a fixed-width `type: "title"` metadata line before that header (upstream can1357/oh-my-pi@0ce330a, 2026-06-27), so valid OMP transcripts were rejected and omitted from `codeburn sessions --provider omp`. readFirstEntry now scans up to MAX_HEADER_LINES_SCANNED (20) leading lines via the existing streaming readSessionLines helper, skipping blank lines and malformed JSON, until it finds a session record. This keeps discovery bounded for message-only files (and pathological blank/junk-line runs) instead of reading the whole file, and Pi and OMP continue to share the exact same discovery path. Fixes getagentseal#845
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relates to #845.
The defect
The shared Pi/OMP JSONL discovery gate inspected only the first physical line of a transcript for a
type: "session"record. Oh My Pi writes a fixed-widthtype: "title"metadata line ahead of that header, so valid OMP transcripts were excluded fromcodeburn sessions --provider omp. Both this branch and #846 scan past leading non-session lines to fix it, and both keep Pi and OMP on the identical shared path.Difference from #846
Read cost. #846 keeps
readSessionFile, which reads the entire transcript into memory (up to the 128MB cap) and then iterates its lines. This branch streams throughreadSessionLines— the helpercodex.ts,droid.tsand others already use — and stops after 20 leading lines.The distinction matters most for the negative case. A message-only file with no session record is read in full under both the old code and #846; under a bounded scan it costs 20 lines. Session directories accumulate such files, and discovery walks all of them on every run.
Worth noting the pre-existing code only looked bounded: it read the whole file and then used line 0. So this is not a regression #846 introduces, it is an existing cost neither the old code nor #846 avoids.
One semantic change here:
readFirstEntrynow returns only session entries rather than whatever line 0 parsed to. The caller'sfirst.type !== 'session'guard becomes redundant but is left in place rather than widening the diff.Acceptance criteria
Testing
Fixture tests in
tests/providers/pi.test.tsreproducing a title-slot-first OMP transcript, confirmed failing before the change. Also covered: blank-line tolerance, malformed leading JSON handled without throwing, message-only exclusion, a session record placed beyond the scan bound (which must not be found, proving the scan is bounded rather than full-file), and a large message-only file completing well inside a generous time ceiling.Full suite 2471 passed,
tsc --noEmitclean.Credit
@jbspeakr reported #845 and traced the format to its upstream origin (
can1357/oh-my-pi@0ce330ab, 2026-06-27), which is what made this straightforward to scope.