Skip to content

fix(parser): index current OMP sessions (title slot, non-message tree nodes) - #175

Open
materemias wants to merge 1 commit into
obra:mainfrom
materemias:fix/omp-current-session-format
Open

materemias wants to merge 1 commit into
obra:mainfrom
materemias:fix/omp-current-session-format

Conversation

@materemias

Copy link
Copy Markdown

Fixes #174.

Current Oh My Pi sessions index zero exchanges, or only the last one. There are two causes.

  • detectConversationHarness now skips the {"type":"title"} slot that OMP writes before the {"type":"session"} header. Before this, those files fell through to the Claude parser.
  • parseOmpConversation and formatOmpConversationAsMarkdown now record id -> parentId for every entry that has an id. They walk from the last message through that map and keep the message entries on the path. OMP parents messages on model_change, thinking_level_change, custom and compaction entries, 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.ts adds a case with a title slot first, a model_change root, and a thinking_level_change/custom pair between turns. It fails on main and passes here.
  • omp-show.test.ts adds the same layout for the renderer. It fails on main and passes here.
  • Full suite: 351/352 pass. The one failure is the existing codex-transcripts discovery test, which picks up a real ~/.omp because it doesn't isolate OMP_HOME. It passes with OMP_HOME=/nonexistent, and it's unrelated to this change.
  • I checked it against my real corpus of 994 OMP sessions. Before the fix, 664 user turns sat on indexable active paths. After it, 4509 do.

Note on dist/mcp-server.js

The repo has no lockfile, and a fresh npm install resolves newer zod/fast-uri/ajv. Rebuilding the bundle from that tree produced about 3000 lines of unrelated churn. I compiled formatOmpConversationAsMarkdown with npm run bundle and put only that function into the committed bundle, which leaves a 12-line diff. dist/parser.js and dist/show.js are plain tsc output. If you'd rather regenerate the bundle from your own lockfile, a normal npm run build gives the same function.

… 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.
Copilot AI lite review requested due to automatic review settings September 23, 2026 15:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

OMP: current session files index zero or only the last exchange (title slot, non-message tree nodes)

2 participants