Repository navigation
feat(native-chat): render omp transcripts - #11523
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds OMP as a native-chat transcript agent. OMP session files resolve from configured or default session directories, including suffixed session IDs while excluding artifact subdirectories. OMP JSONL records decode into native-chat messages and blocks for text, thinking, tools, executions, file mentions, custom turns, errors, and cancellations. Static and live transcript readers select the OMP decoder. Mobile and renderer view logic now applies local-transcript requirements to OMP and Grok. Tests cover resolution, decoding, eligibility, and view selection. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR wires omp (pi-agent) transcripts into the native chat view by adding a
Confidence Score: 5/5Safe to merge — the change adds a new decoder and resolver path that did not previously exist; no existing claude/codex/grok behaviour is modified. Every changed file follows the established pattern for claude, codex, and grok exactly. The decoder, session resolver, and reader/tail-reader updates are all additive; the shared allowlist change is a one-field addition. walkSessionFiles already handles missing directories gracefully, OMP_CODING_AGENT_DIR override logic mirrors the AI Vault scanner, and the test suite covers all decoder branches against real transcript data. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/shared/native-chat-agent-support.ts | Adds 'omp' to the NativeChatTranscriptAgent union, the NATIVE_CHAT_SUPPORTED_AGENTS set, and the resolver switch — minimal, consistent with the existing claude/codex/grok entries. |
| src/main/native-chat/transcript-line-decoders-omp.ts | New decoder for omp JSONL lines: skips non-message records, routes toolResult separately, maps thinking blocks to text, and falls back unknown/null roles to 'system'. Pattern mirrors claude/codex/grok decoders. |
| src/main/native-chat/transcript-record-blocks.ts | Adds ompContentBlocks and ompContentBlock alongside the existing claude equivalents. Drops images (blob handles), maps thinking to text blocks, passes toolCall arguments through as input — all consistent with claudeContentBlock semantics. |
| src/main/native-chat/session-file-resolver.ts | Adds ompSessionsDir() mirroring the AI Vault scanner's OMP_CODING_AGENT_DIR logic, and resolveOmpSessionFile() using suffix-based file matching (timestamp_sessionid.jsonl) via walkSessionFiles — consistent with Codex rollout file resolution. walkSessionFiles already returns [] for missing dirs, so no ENOENT risk. |
| src/main/native-chat/transcript-reader.ts | Adds the omp branch alongside claude/codex/grok in readNativeChatTranscript — straightforward one-liner routing to the new decoder. |
| src/main/native-chat/transcript-tail-reader.ts | Mirrors the transcript-reader change in nativeChatLineDecoderForAgent — adds the omp branch returning decodeOmpTranscriptLine. |
| src/main/native-chat/transcript-line-decoders.omp.test.ts | Thorough unit tests: skips, user/assistant turns, thinking-only turns, mixed turns, tool results (success + error), developer channel, blob-image drops, and fallback id. All exercised paths match the described omp format. |
| src/main/native-chat/session-file-resolver.test.ts | New tests verify suffix-based session ID matching for omp transcripts and that OMP_CODING_AGENT_DIR overrides the default sessions root, with proper env-var restoration in finally. |
| src/main/native-chat/transcript-line-decoders.ts | Barrel export updated to include decodeOmpTranscriptLine — one-line addition. |
| src/shared/native-chat-agent-support.test.ts | Test updates covering omp in resolveNativeChatTranscriptAgent, isNativeChatSupportedAgent, and shouldStepNativeChatAskAnswer (correctly false for omp). |
Reviews (2): Last reviewed commit: "feat(native-chat): render omp transcript..." | Re-trigger Greptile
omp already ships as a first-class launchable agent with session_id resume, but
its transcripts had no decoder, so native chat could not render it — the agent
runs and the conversation stays a raw terminal. This adds the decoder and wires
it through the same path Claude, Codex and Grok use.
omp writes one envelope per line, `{ type, id, parentId, timestamp, … }`, where
conversation turns are `type: 'message'` and the rest is session bookkeeping.
Reasoning arrives as a `thinking` content block inside the assistant turn, so
the mapping follows Claude rather than Codex: thinking becomes a text block on
an assistant message, where Codex and Grok emit a separate reasoning role only
because their transcripts carry dedicated reasoning records.
- toolCall -> tool-call, arguments passed through as the object omp writes
- toolResult -> tool role, isError preserved
- developer -> system, matching the Codex non-user/non-assistant fallback
- blob-handle images drop, as the Claude mapper drops an image record with
neither path nor url
- bookkeeping and unrecognized types skip rather than throw
Session files are `<ISO timestamp>_<session id>.jsonl` under a per-cwd directory,
so the resolver matches the id as a base-name suffix the way Codex rollout files
are matched, and honors OMP_CODING_AGENT_DIR through normalizeAgentSessionsDir
so it stays consistent with the AI Vault scanner.
omp records no interruption or abort event, so unlike Claude and Codex there is
no NATIVE_CHAT_INTERRUPTED_STATUS_TEXT path.
Verified against 94,603 lines of real omp transcripts across four sessions:
50,546 records decoded, zero malformed, zero thrown.
8f20f78 to
633baa2
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/native-chat/transcript-line-decoders-omp.ts (1)
1-4: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCondense the duplicated decoder documentation.
These multi-line comments largely restate control flow and record filtering visible below; keep one short schema-oriented note instead. As per coding guidelines, “Comments must be concise, limited to non-obvious information, and preferably one line.”
Proposed cleanup
-// omp (pi-agent) JSONL line → NativeChatMessage decoder. -// -// Conversation turns are `type: 'message'`; every other record type is session -// bookkeeping. Turn order is file order, so `parentId` is not consulted here. - @@ -/** - * omp session rows: `type: 'message'` turns carrying user/assistant/toolResult/ - * developer records with text, thinking, toolCall and image content blocks. - * Session bookkeeping rows (session_init, mode_change, compaction, custom) are - * skipped, as are records of an unrecognized type. - */ +/** Decodes OMP JSONL message records into native-chat messages. */Also applies to: 15-20
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 056dba43-de50-4f5a-ad91-8988ad7e6a87
📥 Commits
Reviewing files that changed from the base of the PR and between 8f20f78bb6ecc8e6a7a39eb2922d130ee26b4ccc and 633baa2.
📒 Files selected for processing (10)
src/main/native-chat/session-file-resolver.test.tssrc/main/native-chat/session-file-resolver.tssrc/main/native-chat/transcript-line-decoders-omp.tssrc/main/native-chat/transcript-line-decoders.omp.test.tssrc/main/native-chat/transcript-line-decoders.tssrc/main/native-chat/transcript-reader.tssrc/main/native-chat/transcript-record-blocks.tssrc/main/native-chat/transcript-tail-reader.tssrc/shared/native-chat-agent-support.test.tssrc/shared/native-chat-agent-support.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/main/native-chat/transcript-line-decoders.ts
- src/main/native-chat/transcript-reader.ts
- src/main/native-chat/transcript-line-decoders.omp.test.ts
|
@coderabbitai review Docstrings were added in 633baa2 after the last pass; re-running so the coverage check reflects them. |
|
✅ Action performedReview finished.
|
…ripts Review fixes on the omp transcript decoder. omp writes several record types with no `content` field, so they decoded to zero blocks and disappeared from the chat view entirely: - `bashExecution` / `pythonExecution`: TUI `!command` runs, now a tool turn - `fileMention`: `@path` attachments, listed by path (never `files[].content`, which is an auto-read dump) - `custom_message` and legacy `custom` / `hookMessage` rows, gated on `display` the way omp's own renderer gates them Also: - `stopReason: 'aborted'` turns now surface as the interrupted row, matching the Claude and Codex decoders. An abort carrying partial content keeps it. - A cancelled command cell now reads as errored. Every omp cancel path emits `exitCode: undefined`, which JSON drops, so an `exitCode !== 0` check read a cancelled run as a clean success. - omp joins Grok in requiring a locally readable transcript. Its hook reports no transcript path, so under Model-A SSH the chat view opened against a disk this process cannot read and never loaded. Applies on mobile too, which shares the same allowlist. - The session-file walk prunes omp's per-session subagent artifact directories, matching the AI Vault scanner. It was returning a subagent transcript instead of the parent session, and cost a full recursive readdir on every resolve.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Thanks for this — the direction is right, and following the The theme: omp writes several record types with no
Other fixes:
On the corpus check — 94k lines is good evidence, but it has a blind spot worth naming: it can only cover record types your sessions happened to produce. Every gap above only appears if you run a Verified against a real omp 17.0.5 session driven end-to-end inside the app, plus revert-checks on every fix (each guarding test goes red when the behavior is removed). Deliberately left, all consistent with the other decoders: errored assistant turns and abandoned Follow-ups, not blocking: omp's hook could disclose |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/native-chat/transcript-line-decoders-omp.ts (1)
1-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCondense the file header comment.
Keep the branch-history limitation in one short comment. Move the detailed decoder comparison out of this implementation file.
As per coding guidelines, comments must be concise, limited to non-obvious information, and preferably one line.
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 055bbdbd-e8cc-4a78-a152-bf9db4992fe9
📒 Files selected for processing (20)
mobile/src/session/mobile-native-chat-eligibility.test.tsmobile/src/session/mobile-native-chat-eligibility.tssrc/main/native-chat/session-file-resolver.test.tssrc/main/native-chat/session-file-resolver.tssrc/main/native-chat/transcript-line-decoders-omp.tssrc/main/native-chat/transcript-line-decoders.omp.test.tssrc/main/native-chat/transcript-line-decoders.tssrc/main/native-chat/transcript-reader.tssrc/main/native-chat/transcript-tail-reader.tssrc/renderer/src/components/native-chat/native-chat-availability.test.tssrc/renderer/src/components/native-chat/native-chat-availability.tssrc/renderer/src/lib/native-chat-initial-view-mode.test.tssrc/renderer/src/lib/native-chat-initial-view-mode.tssrc/renderer/src/lib/native-chat-supported-agent.tssrc/renderer/src/lib/worktree-creation-agent-seeds.test.tssrc/renderer/src/lib/worktree-creation-agent-seeds.tssrc/renderer/src/lib/worktree-draft-startup-view-mode.test.tssrc/renderer/src/lib/worktree-draft-startup-view-mode.tssrc/shared/native-chat-agent-support.test.tssrc/shared/native-chat-agent-support.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- src/main/native-chat/transcript-line-decoders.ts
- src/main/native-chat/transcript-tail-reader.ts
- src/main/native-chat/transcript-reader.ts
- src/main/native-chat/session-file-resolver.ts
| const blocks = ompContentBlocks(message.content) | ||
| if (blocks.length === 0) { | ||
| // Why: omp stamps an aborted turn onto the assistant message itself | ||
| // (`stopReason: 'aborted'`), and when nothing streamed before the abort the | ||
| // content is empty — so the turn would silently vanish. Surface it as the | ||
| // same interrupted row Claude and Codex emit for their own aborts. | ||
| return role === 'assistant' && message.stopReason === 'aborted' | ||
| ? { | ||
| id, | ||
| role: 'system', | ||
| blocks: [{ type: 'text', text: NATIVE_CHAT_INTERRUPTED_STATUS_TEXT }], | ||
| timestamp, | ||
| source: 'transcript' | ||
| } | ||
| : null | ||
| } | ||
| const messageRole = role === 'assistant' ? 'assistant' : role === 'user' ? 'user' : 'system' | ||
| return { id, role: messageRole, blocks, timestamp, source: 'transcript' } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Keep the interruption status for partial aborted turns.
When stopReason === 'aborted' and content exists, Line 117 falls through to a normal assistant message. The user cannot identify truncated content. Preserve the partial blocks and add the interrupted status. Update the test to require that status.
src/main/native-chat/transcript-line-decoders-omp.ts#L111-L128: represent a partial aborted turn as interrupted while retaining its content.src/main/native-chat/transcript-line-decoders.omp.test.ts#L247-L255: assert the interruption marker with the partial content.
📍 Affects 2 files
src/main/native-chat/transcript-line-decoders-omp.ts#L111-L128(this comment)src/main/native-chat/transcript-line-decoders.omp.test.ts#L247-L255
Mobile CI gates `oxfmt --check`; the two root files were unformatted too, just ungated there. Line wrapping only, no behavior change.
brennanb2025
left a comment
There was a problem hiding this comment.
Approving. Verified the decoder against real omp 17.0.5 records rather than fixtures alone — including a cancelled bash cell (which omp writes with no exitCode key at all), an interrupted turn carrying partial content, and a fileMention. CI green across desktop and mobile.
* feat(native-chat): render omp transcripts
omp already ships as a first-class launchable agent with session_id resume, but
its transcripts had no decoder, so native chat could not render it — the agent
runs and the conversation stays a raw terminal. This adds the decoder and wires
it through the same path Claude, Codex and Grok use.
omp writes one envelope per line, `{ type, id, parentId, timestamp, … }`, where
conversation turns are `type: 'message'` and the rest is session bookkeeping.
Reasoning arrives as a `thinking` content block inside the assistant turn, so
the mapping follows Claude rather than Codex: thinking becomes a text block on
an assistant message, where Codex and Grok emit a separate reasoning role only
because their transcripts carry dedicated reasoning records.
- toolCall -> tool-call, arguments passed through as the object omp writes
- toolResult -> tool role, isError preserved
- developer -> system, matching the Codex non-user/non-assistant fallback
- blob-handle images drop, as the Claude mapper drops an image record with
neither path nor url
- bookkeeping and unrecognized types skip rather than throw
Session files are `<ISO timestamp>_<session id>.jsonl` under a per-cwd directory,
so the resolver matches the id as a base-name suffix the way Codex rollout files
are matched, and honors OMP_CODING_AGENT_DIR through normalizeAgentSessionsDir
so it stays consistent with the AI Vault scanner.
omp records no interruption or abort event, so unlike Claude and Codex there is
no NATIVE_CHAT_INTERRUPTED_STATUS_TEXT path.
Verified against 94,603 lines of real omp transcripts across four sessions:
50,546 records decoded, zero malformed, zero thrown.
* fix(native-chat): complete omp record coverage and gate remote transcripts
Review fixes on the omp transcript decoder.
omp writes several record types with no `content` field, so they decoded
to zero blocks and disappeared from the chat view entirely:
- `bashExecution` / `pythonExecution`: TUI `!command` runs, now a tool turn
- `fileMention`: `@path` attachments, listed by path (never `files[].content`,
which is an auto-read dump)
- `custom_message` and legacy `custom` / `hookMessage` rows, gated on
`display` the way omp's own renderer gates them
Also:
- `stopReason: 'aborted'` turns now surface as the interrupted row, matching
the Claude and Codex decoders. An abort carrying partial content keeps it.
- A cancelled command cell now reads as errored. Every omp cancel path emits
`exitCode: undefined`, which JSON drops, so an `exitCode !== 0` check read a
cancelled run as a clean success.
- omp joins Grok in requiring a locally readable transcript. Its hook reports
no transcript path, so under Model-A SSH the chat view opened against a disk
this process cannot read and never loaded. Applies on mobile too, which
shares the same allowlist.
- The session-file walk prunes omp's per-session subagent artifact
directories, matching the AI Vault scanner. It was returning a subagent
transcript instead of the parent session, and cost a full recursive readdir
on every resolve.
* style(native-chat): apply oxfmt to the omp review fixes
Mobile CI gates `oxfmt --check`; the two root files were unformatted too,
just ungated there. Line wrapping only, no behavior change.
---------
Co-authored-by: plotarmordev <[email protected]>
Co-authored-by: Brennan Benson <[email protected]>
Summary
Orca already ships
omp(pi-agent) as a first-class launchable agent — it appears in the agent list and resumes bysession_id— but its transcripts have no decoder.resolveNativeChatTranscriptAgentreturnsnullfor it, soisNativeChatSupportedAgent('omp')is false and the native chat view never opens. The agent runs; the conversation stays a raw terminal.This adds
decodeOmpTranscriptLineand wires it through the existing path (barrel, reader, tail reader, session-file resolver, shared allowlist), soomprenders as chat likeclaude,codexandgrok.omp writes one envelope per line,
{ type, id, parentId, timestamp, … }. Conversation turns aretype: 'message'; everything else is session bookkeeping. Order is file order, soparentIdis not consulted.Reasoning follows Claude, not Codex. omp carries reasoning as a
thinkingcontent block inside the assistant turn, exactly like Claude — so it becomes a text block on an assistant message. Codex and Grok emit a separatereasoningrole only because their transcripts carry dedicated reasoning records. A thinking-only turn therefore staysassistant.toolCalltool-call;argumentspassed through as the object omp writes, mirroring Claude'sinput: record.inputtoolResulttoolrole,isErrorpreserveddevelopersystem, matching the Codex non-user/non-assistant fallbackimage(blob:sha256:…)compaction,mode_change,session_init,custom, unknownSession files are
<ISO timestamp>_<session id>.jsonlunder a per-cwd directory, so the resolver matches the id as a base-name suffix the way Codex rollout files are matched. It resolves the root throughnormalizeAgentSessionsDirand honoursOMP_CODING_AGENT_DIR, matchingsession-scanner-source-discovery.ts— without that, a user with the override set gets sessions in AI Vault but a dead native chat view.Screenshots
No visual change — this populates the existing native chat view for one more agent; no UI was added or modified.
Testing
pnpm lint— passes for all files in this PR. One pre-existing failure unrelated to it:src/main/daemon/daemon-pty-router.ts:381 max-lines (304 > 300), which reproduces identically on pristineorigin/mainand is not touched here.pnpm typecheck— clean (tsconfig.node,tsconfig.tc.cli,tsconfig.tc.web).pnpm test—src/main/native-chat/+src/shared/: 3,602 passed, 16 skipped, 0 failed. Full-repopnpm testadditionally failsdaemon/browser/automationssuites in this environment becausenode-ptyhas noprebuilds/linux-arm64/pty.node; those failures reproduce on pristineorigin/mainand are unrelated.pnpm build— could not complete in this environment, for a reason unrelated to the diff:[email protected]ships prebuilds only fordarwin-arm64/x64andwin32-arm64/x64, so on aarch64 Linux it must compile from source, and these deps were installed with--ignore-scripts. The failure is theplain-node-entry-guardstep loadingdaemon-entry.js(Failed to load native module: pty.node … prebuilds/linux-arm64), which this PR does not touch.pnpm build:webdoes complete cleanly, andpnpm run build:electron-vitegets as far as that guard with no errors attributable to these files.isError,developerchannel, blob-image drop, id fallback, bookkeeping and unknown types skipping) plus 2 resolver cases (suffix match,OMP_CODING_AGENT_DIRoverride) and allowlist coverage.Additionally verified against 94,603 lines of real omp transcripts across four sessions:
That corpus check is not committed — it depends on private session data.
AI Review Report
Two independent AI review passes were run against the sibling decoders as the style bar, plus CodeRabbit and Greptile on the PR itself.
Risks checked: consistency with the
claude/codex/grokdecoders; invented behaviour with no precedent; comments that narrate rather than justify; dead or speculative code; test coverage of the resolver and of every record type.Flagged and fixed:
ompSessionsDir()ignoredOMP_CODING_AGENT_DIRwhile the AI Vault scanner honours it — a real behaviour gap, now routed throughnormalizeAgentSessionsDir.resolveOmpSessionFilehad no test. Added, plus one for the env override.ompToolCallInputhelper existed to repair "Python-style reprs". Measuring the raw transcripts showedargumentsis always already a JSON object; the belief was an artifact of the sampling tool. Helper deleted, nowinput: record.argumentslike Claude.existsSyncguard that could not fire (walkSessionFilesalready returns[]on a failed readdir). Removed.reasoningrole for thinking-only turns,compactionsurfaced as asystemmessage, and aturnIdno other decoder sets — all removed in favour of matching Claude and Codex exactly.The decoder went from 101 to 65 lines as a result.
Cross-platform: reviewed for macOS, Linux and Windows. All path handling uses
node:path(join,basename,extname) andnode:oshomedir(); no string concatenation of separators, no shell invocation, no platform-conditional logic, no Electron API use. The resolver is pure path matching over a directory walk, so behaviour is identical on all three. No shortcuts, labels, or UI strings are touched.Security Audit
parseJsonObject, which catches parse errors and returns null; unknown record and block types return null rather than throwing, so a malformed or hostile line degrades to a skipped record and cannot fail the whole read. Noeval, no dynamicrequire, no prototype-mutating merges.name.endsWith('_' + sessionId)). It is never concatenated into a path, so a crafted id cannot traverse outside the sessions root. The root itself comes fromnormalizeAgentSessionsDir, the same helper the existing scanner uses.NativeChatMessageshape the other agents already produce.Follow-up: none identified.
Notes
NATIVE_CHAT_INTERRUPTED_STATUS_TEXTsystem message. omp records no interruption or abort event — I checked the corpus for abort/cancel/interrupt markers and found only prose — so there is no equivalent here. If omp adds one,decodeOmpTranscriptLineis where it would hook in.blob:sha256:…handles rather than a path or URL. Rendering them would need a blob-resolution step that does not exist yet for any agent.