fix(pi): support Oh My Pi (OMP) session format and directory naming - #143
Merged
Conversation
OMP (Oh My Pi) stores sessions under ~/.omp/agent/sessions/ using: - Home-relative directory names (e.g. -src-dotai for ~/src/dotai) instead of Pi's legacy absolute format (--Users-ooxx-src-dotai--) - A 'title' preamble record before the session header in JSONL files Changes: - workspaceToPiSessionDirVariants: add homeExact/homePrefix fields for OMP's home-relative directory naming convention - listSessionDirectories: match against homeExact/homePrefix variants - probeTranscript: skip 'title' preamble records before session header - Fix path.win32.isAbsolute/normalize bug on macOS (returns true for /Users/... paths, mangling forward slashes to backslashes) Documentation: - Add OMP to README.md and README.zh-CN.md more-adapters sections - Add OMP row to adapter matrix tables (overview and canonical) - Add OMP discovery and lifecycle sections - Add OMP to output modes list Usage: PI_CODING_AGENT_DIR=~/.omp/agent better-harness harness evidence-bundle --platform pi --workspace <path>
OMP /fork creates a new session file with parentSession field in header, duplicating all parent messages. 38/479 (7.9%) sessions are forked. Follow-up design: detect parentSession, mark as derived, process only incremental messages after fork point to avoid double-counting.
OMP /fork creates a new session file with all parent entries copied. The parentSession field in the session header identifies the source. Changes: - probeTranscript: detect parentSession, store forkTimestamp - addRef: propagate forkTimestamp/parentSessionId to session object - readSession: skip events with timestamp < forkCutoff to avoid double-counting inherited parent messages Verified: 1 forked session detected in dotai (103 sessions), properly marked as derived with incremental-only processing.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new home-relative session directory matching can incorrectly include unrelated workspaces due to an overly broad prefix check and an imprecise “outside home” test.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR extends the existing Pi session analyzer to also recognize Oh My Pi (OMP) session evidence by supporting OMP’s home-relative session directory naming and its JSONL preamble format, and updates the documentation to list OMP as an adapter-supported host.
Changes:
- Updated Pi session directory discovery to include OMP home-relative directory variants and fixed cross-platform path normalization behavior.
- Updated Pi transcript probing/reading to tolerate OMP’s leading
titlerecord and to capture fork metadata for skipping inherited pre-fork entries. - Documented OMP support across the READMEs and host adapter matrix docs.
File summaries
| File | Description |
|---|---|
| scripts/session-analysis/platforms/pi.mjs | Adds OMP directory variants, preamble handling, and fork-aware event filtering. |
| README.md | Adds OMP to the “More adapters” list with a pointer to the matrix. |
| README.zh-CN.md | Adds OMP to the Chinese “More adapters” list with a pointer to the matrix. |
| docs/docs/hosts/adapter-matrix.md | Adds OMP to the public adapter matrix and documents OMP-specific session details. |
| docs/adapters/README.md | Adds OMP to the canonical adapter matrix and discovery/lifecycle notes. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…nce-safe Follow-up on the OMP compatibility work. The home-relative prefix boundary was already tightened in the preceding commit; this adds the regression tests that lock it, including a home child whose name merely begins with "..", and fixes the two remaining defects. Moving the slug normalizer from `path.win32` to `path` broke Windows-shaped workspace strings on POSIX hosts by resolving them against the host cwd, so `C:\workspace\project` produced a cwd-prefixed slug. The existing substring assertion passed straight through that regression, so it is now an equality check. The genuine `path.win32` problem was elsewhere: normalizing a POSIX path through `path.win32` backslashes it, which defeated the home-relative derivation, so that derivation now reads the host-native path instead of the slug form. Fork handling dropped inherited entries even when the parent session was absent from the discovery result, losing evidence with no coverage marker, while still reporting a session range that covered entries the session no longer yielded. Deduplication now runs after every transcript is probed, applies only when the parent is discovered as well, stores the cutoff on the source ref rather than the session so a second transcript cannot inherit a foreign cutoff, and shares one predicate with the reader so the reported range always matches the events. OMP is documented as a session layout of the `pi` platform rather than a new host, per the bounded host-adapter policy: the duplicated adapter-matrix rows, the unverified `pi` manifest install-shell claim, and the lifecycle row are removed, both READMEs attach OMP to the Pi entry, and the zh-Hans mirror gains the missing section. Acceptance scenarios and boundaries are recorded in docs/specs/2026-09-04-omp-session-format-compat.md. Validated with the provider suite and the full run. Each new assertion was mutation-checked: reverting the prefix boundary, the `path.win32` slug handling, or the parent-existence condition fails exactly the test that covers it. Co-authored-by: QoderAI (Qwen 3.8 Max) <qoder_ai@qoder.com>
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.
Why
Oh My Pi (OMP) is a popular open-source coding agent CLI that shares Pi's session infrastructure but has diverged in two ways:
Directory naming: OMP v17.2.9+ uses home-relative directory names for sessions under
~/.omp/agent/sessions/(e.g.-src-dotaifor~/src/dotai), while the Pi adapter only recognizes the legacy absolute format (--Users-ooxx-src-dotai--).JSONL preamble: OMP emits a
titlerecord as the first line of session JSONL files, before thesessionheader. The Pi adapter'sprobeTranscriptrejects any file whose first record is not asessionheader.macOS bug:
path.win32.isAbsolute("/Users/...")returnstrueon macOS, causingpath.win32.normalizeto convert forward slashes to backslashes. This silently corrupted the slug generation.What changed
scripts/session-analysis/platforms/pi.mjs(core fix)workspaceToPiSessionDirVariants: AddedhomeExactandhomePrefixfields for OMP's home-relative directory naming. Also fixedpath.win32.isAbsolute→path.isAbsoluteandpath.win32.normalize→path.normalizeto avoid backslash corruption on macOS.listSessionDirectories: Extended the filter to match againsthomeExact/homePrefixvariants in addition to the existingexact/prefixfields.probeTranscript: Skip leadingtitlerecords before the session header. Other non-session record types before the header still cause fail-closed rejection.Documentation
README.mdandREADME.zh-CN.mdmore-adapters sectionsHow to use
Testing
exact/prefixfields are unchanged, so all existing Pi users are unaffected