Skip to content

pi/omp: discover transcripts whose session record follows a title slot - #859

Draft
avs-io wants to merge 1 commit into
getagentseal:mainfrom
avs-io:fix/omp-title-slot-discovery
Draft

pi/omp: discover transcripts whose session record follows a title slot#859
avs-io wants to merge 1 commit into
getagentseal:mainfrom
avs-io:fix/omp-title-slot-discovery

Conversation

@avs-io

@avs-io avs-io commented Jul 29, 2026

Copy link
Copy Markdown
Member

This overlaps #846, which came first. @jbspeakr — who reported #845 — opened #846 fixing the same defect. This branch was built independently from the issue before #846 surfaced in a PR sweep. #846 should have precedence.

Left open as a draft only for the one difference described below. If that difference is not wanted, close this in favour of #846.

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-width type: "title" metadata line ahead of that header, so valid OMP transcripts were excluded from codeburn 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 through readSessionLines — the helper codex.ts, droid.ts and 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: readFirstEntry now returns only session entries rather than whatever line 0 parsed to. The caller's first.type !== 'session' guard becomes redundant but is left in place rather than widening the diff.

Acceptance criteria

  • OMP title-first JSONL transcripts are discovered
  • Blank lines before the session record do not prevent discovery
  • Message-only files with no session record remain excluded
  • Pi and OMP retain identical shared discovery behaviour

Testing

Fixture tests in tests/providers/pi.test.ts reproducing 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 --noEmit clean.

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.

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
@avs-io avs-io changed the title pi/omp: discover transcripts whose session record follows a title slot pi/omp: bounded streaming scan for the title-slot discovery fix (delta over #846) Jul 29, 2026
@avs-io avs-io changed the title pi/omp: bounded streaming scan for the title-slot discovery fix (delta over #846) pi/omp: discover transcripts whose session record follows a title slot Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant