Repository navigation
fix(parser): index current OMP sessions (title slot, non-message tree nodes) - #175
Open
materemias wants to merge 1 commit into
Open
materemias wants to merge 1 commit into
materemias wants to merge 1 commit into
Conversation
… nodes)
Current Oh My Pi transcripts open with a fixed-width {type:"title"} slot
before the {type:"session"} header, so detectConversationHarness fell
through to the Claude parser and indexed zero exchanges.
The active-path walk also only followed message entries, but OMP parents
messages on model_change / thinking_level_change / custom / compaction
entries, so the leaf->root walk stopped at the first non-message parent and
kept only the tail of each session. Walk every id-bearing entry and keep
the messages on the path; same fix for the show/read renderer.
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The reviewed changes include regression coverage and have no unresolved blocking issues.
Review effort: Lite
Findings: None
What changed in this PR
Fixes OMP session indexing and rendering for title-prefixed transcripts and ancestry paths containing non-message nodes.
Changes:
- Handles title slots during OMP detection.
- Traverses all ID-bearing parent links.
- Adds parser and renderer regression tests.
- Updates compiled and bundled outputs.
| File | Changes |
|---|---|
test/omp-transcripts.test.ts |
Adds indexing regression coverage. |
test/omp-show.test.ts |
Adds rendering regression coverage. |
src/show.ts |
Traverses complete OMP ancestry paths. |
src/parser.ts |
Updates OMP detection and active-path parsing. |
dist/show.js |
Compiled renderer update. |
dist/parser.js |
Compiled parser update. |
dist/mcp-server.js |
Bundled renderer update. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Fixes #174.
Current Oh My Pi sessions index zero exchanges, or only the last one. There are two causes.
detectConversationHarnessnow skips the{"type":"title"}slot that OMP writes before the{"type":"session"}header. Before this, those files fell through to the Claude parser.parseOmpConversationandformatOmpConversationAsMarkdownnow recordid -> parentIdfor every entry that has anid. They walk from the last message through that map and keep the message entries on the path. OMP parents messages onmodel_change,thinking_level_change,customandcompactionentries, and the old message-only walk stopped at the first one of those.The active-leaf rule, branch exclusion and line numbering stay the same, so the #152 high-water mark still holds.
Tests
omp-transcripts.test.tsadds a case with a title slot first, amodel_changeroot, and athinking_level_change/custompair between turns. It fails onmainand passes here.omp-show.test.tsadds the same layout for the renderer. It fails onmainand passes here.codex-transcriptsdiscovery test, which picks up a real~/.ompbecause it doesn't isolateOMP_HOME. It passes withOMP_HOME=/nonexistent, and it's unrelated to this change.Note on
dist/mcp-server.jsThe repo has no lockfile, and a fresh
npm installresolves newer zod/fast-uri/ajv. Rebuilding the bundle from that tree produced about 3000 lines of unrelated churn. I compiledformatOmpConversationAsMarkdownwithnpm run bundleand put only that function into the committed bundle, which leaves a 12-line diff.dist/parser.jsanddist/show.jsare plaintscoutput. If you'd rather regenerate the bundle from your own lockfile, a normalnpm run buildgives the same function.