Skip to content

feat(native-chat): render omp transcripts - #11523

Merged
brennanb2025 merged 4 commits into
stablyai:mainfrom
plotarmordev:feat/omp-native-chat
Aug 7, 2026
Merged

brennanb2025 merged 4 commits into
stablyai:mainfrom
plotarmordev:feat/omp-native-chat

Conversation

@plotarmordev

@plotarmordev plotarmordev commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Orca already ships omp (pi-agent) as a first-class launchable agent — it appears in the agent list and resumes by session_id — but its transcripts have no decoder. resolveNativeChatTranscriptAgent returns null for it, so isNativeChatSupportedAgent('omp') is false and the native chat view never opens. The agent runs; the conversation stays a raw terminal.

This adds decodeOmpTranscriptLine and wires it through the existing path (barrel, reader, tail reader, session-file resolver, shared allowlist), so omp renders as chat like claude, codex and grok.

omp writes one envelope per line, { type, id, parentId, timestamp, … }. Conversation turns are type: 'message'; everything else is session bookkeeping. Order is file order, so parentId is not consulted.

Reasoning follows Claude, not Codex. omp carries reasoning as a thinking content block inside the assistant turn, exactly like Claude — so it becomes a text block on an assistant message. Codex and Grok emit a separate reasoning role only because their transcripts carry dedicated reasoning records. A thinking-only turn therefore stays assistant.

omp native chat
toolCall tool-call; arguments passed through as the object omp writes, mirroring Claude's input: record.input
toolResult tool role, isError preserved
developer system, matching the Codex non-user/non-assistant fallback
image (blob:sha256:…) dropped — a content-addressed handle is neither path nor url, and the Claude mapper drops a sourceless image the same way
compaction, mode_change, session_init, custom, unknown skipped, never thrown

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. It resolves the root through normalizeAgentSessionsDir and honours OMP_CODING_AGENT_DIR, matching session-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 pristine origin/main and 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-repo pnpm test additionally fails daemon/browser/automations suites in this environment because node-pty has no prebuilds/linux-arm64/pty.node; those failures reproduce on pristine origin/main and are unrelated.
  • pnpm build — could not complete in this environment, for a reason unrelated to the diff: [email protected] ships prebuilds only for darwin-arm64/x64 and win32-arm64/x64, so on aarch64 Linux it must compile from source, and these deps were installed with --ignore-scripts. The failure is the plain-node-entry-guard step loading daemon-entry.js (Failed to load native module: pty.node … prebuilds/linux-arm64), which this PR does not touch. pnpm build:web does complete cleanly, and pnpm run build:electron-vite gets as far as that guard with no errors attributable to these files.
  • Tests added. 12 decoder cases (both roles, thinking-only turns, tool results with and without isError, developer channel, blob-image drop, id fallback, bookkeeping and unknown types skipping) plus 2 resolver cases (suffix match, OMP_CODING_AGENT_DIR override) and allowlist coverage.

Additionally verified against 94,603 lines of real omp transcripts across four sessions:

decoded 50,546   malformed 0   thrown 0
roles: assistant 24,716 · tool 25,280 · user 534 · system 16
tool-call 25,284 / tool-result 25,280   (gap = calls still open at session end)

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/grok decoders; 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:

  • A comment copied from the Claude mapper claimed the role marks reasoning — false here, and contradicted by this PR's own test. Removed.
  • ompSessionsDir() ignored OMP_CODING_AGENT_DIR while the AI Vault scanner honours it — a real behaviour gap, now routed through normalizeAgentSessionsDir.
  • resolveOmpSessionFile had no test. Added, plus one for the env override.
  • A ompToolCallInput helper existed to repair "Python-style reprs". Measuring the raw transcripts showed arguments is always already a JSON object; the belief was an artifact of the sampling tool. Helper deleted, now input: record.arguments like Claude.
  • An existsSync guard that could not fire (walkSessionFiles already returns [] on a failed readdir). Removed.
  • Three behaviours with no precedent in the siblings — a reasoning role for thinking-only turns, compaction surfaced as a system message, and a turnId no other decoder sets — all removed in favour of matching Claude and Codex exactly.
  • Resolver helper reordered to match the dispatch chain; duplicated comments removed.

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) and node:os homedir(); 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

  • Input handling — the decoder parses untrusted JSONL. Every record goes through 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. No eval, no dynamic require, no prototype-mutating merges.
  • Path handling — the session id is used only as a suffix comparison against base names produced by the directory walk (name.endsWith('_' + sessionId)). It is never concatenated into a path, so a crafted id cannot traverse outside the sessions root. The root itself comes from normalizeAgentSessionsDir, the same helper the existing scanner uses.
  • Command execution — none added.
  • Auth / secrets — none touched. Transcripts may contain user content but nothing is logged or transmitted; this PR only maps records into the existing in-process chat model.
  • Dependencies — none added.
  • IPC — no new IPC surface; the decoder runs in main and returns the same NativeChatMessage shape the other agents already produce.

Follow-up: none identified.

Notes

  • No interruption path. Claude and Codex surface aborts as a NATIVE_CHAT_INTERRUPTED_STATUS_TEXT system 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, decodeOmpTranscriptLine is where it would hook in.
  • Compaction is skipped, not surfaced. This matches how the Claude decoder drops compact summaries. It does mean that on a heavily-compacted session the rendered history begins at the newest compaction. Surfacing a summary line would be a reasonable follow-up, but it would be new behaviour for all agents rather than something omp should do alone.
  • Blob images are dropped. omp stores images as 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.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 346a10e8-0042-4d28-bcaa-7fc5291e77c2

📥 Commits

Reviewing files that changed from the base of the PR and between 3c5cf20 and 992df9a.

📒 Files selected for processing (3)
  • mobile/src/session/mobile-native-chat-eligibility.test.ts
  • src/main/native-chat/transcript-line-decoders.omp.test.ts
  • src/renderer/src/components/native-chat/native-chat-availability.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/components/native-chat/native-chat-availability.ts
  • src/main/native-chat/transcript-line-decoders.omp.test.ts

📝 Walkthrough

Walkthrough

Adds 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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: rendering OMP transcripts in native chat.
Description check ✅ Passed The description covers the required summary, screenshots, testing, AI review, security audit, and notes with clear verification details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR wires omp (pi-agent) transcripts into the native chat view by adding a decodeOmpTranscriptLine decoder and threading it through the existing resolver/reader/tail-reader pipeline — no new abstractions, just filling the same slot that claude, codex, and grok already occupy.

  • Decoder (transcript-line-decoders-omp.ts, transcript-record-blocks.ts): skips all non-message record types, maps thinking content blocks to text on the assistant role (matching Claude, not Codex), routes toolResult messages through toolResultOutput, and maps unknown/developer roles to system. Blob-handle images are dropped with a clear comment.
  • Session resolver (session-file-resolver.ts): resolves omp transcripts by suffix-matching <ISO timestamp>_<session id>.jsonl via walkSessionFiles, with ompSessionsDir() delegating to normalizeAgentSessionsDir to honour OMP_CODING_AGENT_DIR overrides — keeping the resolver consistent with the AI Vault scanner.
  • Coverage: unit tests exercise all decoder paths (94k real-transcript lines confirmed), resolver tests cover the suffix match and the env-var override, and all existing suite assertions pass.

Confidence Score: 5/5

Safe 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.

Important Files Changed

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.
@plotarmordev
plotarmordev force-pushed the feat/omp-native-chat branch from 8f20f78 to 633baa2 Compare July 30, 2026 09:38

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/main/native-chat/transcript-line-decoders-omp.ts (1)

1-4: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Condense 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.ts
  • src/main/native-chat/session-file-resolver.ts
  • src/main/native-chat/transcript-line-decoders-omp.ts
  • src/main/native-chat/transcript-line-decoders.omp.test.ts
  • src/main/native-chat/transcript-line-decoders.ts
  • src/main/native-chat/transcript-reader.ts
  • src/main/native-chat/transcript-record-blocks.ts
  • src/main/native-chat/transcript-tail-reader.ts
  • src/shared/native-chat-agent-support.test.ts
  • src/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

@plotarmordev

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Docstrings were added in 633baa2 after the last pass; re-running so the coverage check reflects them.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

@plotarmordev: Re-running the review for PR #11523, including the docstrings added in 633baa2.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

…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.
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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.

@brennanb2025

Copy link
Copy Markdown
Contributor

Thanks for this — the direction is right, and following the claude/codex/grok decoder shape made it straightforward to review. I've merged latest main in (the branch was well behind) and pushed review fixes on top.

The theme: omp writes several record types with no content field. Those decoded to zero blocks and disappeared from the chat view entirely — silently, so nothing in the transcript looked wrong.

  • bashExecution / pythonExecution — TUI !command runs vanished; now a tool turn
  • fileMention — @path attachments vanished; now listed by path (deliberately not files[].content, which is an auto-read dump that would bury the conversation)
  • custom_message, and legacy custom/hookMessage rows — now decoded, gated on display the way omp's own renderer gates them

Other fixes:

  • stopReason: 'aborted' turns now surface as the interrupted row, matching the Claude and Codex decoders. Worth flagging: the description says omp records no interruption or abort event — it does, the corpus just never contained one. An abort carrying partial content keeps that content.
  • Cancelled command cells now read as errored. Every omp cancel path emits exitCode: undefined, which JSON.stringify drops, so an exitCode !== 0 check reads a cancelled run as a clean success.
  • omp now 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 the reading process can't reach and never loaded. This applied on mobile too, which shares the same allowlist — that surface was enabled silently by adding omp to it.
  • The session-file walk now prunes omp's per-session subagent artifact directories, matching the AI Vault scanner. It was returning a subagent transcript instead of the parent session on a delegating session, and cost a full recursive readdir on every resolve (~10,000 directory reads on a heavy tree, now ~50).

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 !command, use @file, interrupt a turn, or resume a pre-v3 session. A couple of the mappings also looked wrong when read from omp's serializer and only came out right when read from its renderer — the two disagree, and the renderer is what native chat mirrors.

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 parentId branches render the same way for Claude and Codex, so fixing them for omp alone would introduce exactly the inconsistency this PR otherwise avoids.

Follow-ups, not blocking: omp's hook could disclose session_file the way pi's does — that would drop the directory scan on every chat open and pagination page, and let the SSH gate narrow back to Grok only. Separately, unknown record types could render a visible placeholder instead of being dropped, so the next omp record type surfaces instead of silently disappearing.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/native-chat/transcript-line-decoders-omp.ts (1)

1-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Condense 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

📥 Commits

Reviewing files that changed from the base of the PR and between b81450f and 3c5cf20.

📒 Files selected for processing (20)
  • mobile/src/session/mobile-native-chat-eligibility.test.ts
  • mobile/src/session/mobile-native-chat-eligibility.ts
  • src/main/native-chat/session-file-resolver.test.ts
  • src/main/native-chat/session-file-resolver.ts
  • src/main/native-chat/transcript-line-decoders-omp.ts
  • src/main/native-chat/transcript-line-decoders.omp.test.ts
  • src/main/native-chat/transcript-line-decoders.ts
  • src/main/native-chat/transcript-reader.ts
  • src/main/native-chat/transcript-tail-reader.ts
  • src/renderer/src/components/native-chat/native-chat-availability.test.ts
  • src/renderer/src/components/native-chat/native-chat-availability.ts
  • src/renderer/src/lib/native-chat-initial-view-mode.test.ts
  • src/renderer/src/lib/native-chat-initial-view-mode.ts
  • src/renderer/src/lib/native-chat-supported-agent.ts
  • src/renderer/src/lib/worktree-creation-agent-seeds.test.ts
  • src/renderer/src/lib/worktree-creation-agent-seeds.ts
  • src/renderer/src/lib/worktree-draft-startup-view-mode.test.ts
  • src/renderer/src/lib/worktree-draft-startup-view-mode.ts
  • src/shared/native-chat-agent-support.test.ts
  • src/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

Comment on lines +111 to +128
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' }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 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 brennanb2025 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@brennanb2025
brennanb2025 merged commit 9e4e6dd into stablyai:main Aug 7, 2026
44 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* 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]>
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.

3 participants