Repository navigation
fix(native-chat): render compaction notices, plan documents, and images - #19228
Conversation
📝 WalkthroughWalkthroughThe change adds Codex image and plan item translation, canonical compaction handling, provider notice metadata, journal schema support, and native-chat notice rendering. It also adds tests for image validation, compaction deduplication, notice classification, metadata projection, renderer behavior, and compatibility. Merge Risk: 🟡 Moderate · up to This change adds distinct warning rendering, but warning text can be difficult to read in light theme. Use an accessible theme-aware warning color before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 23.53% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 23 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
There was a problem hiding this comment.
ℹ️ One minor dead-code cleanup inline; otherwise this is a clean, well-tested change.
Reviewed changes
- Compaction dividers —
notification:thread/compactedreclassified totimeline-substantiveand journaled as apresentation: 'compaction'status row, with the duplicateitem:contextCompactionleft suppressed. - Notice tones — warnings/guardian/config notices and errors now carry an optional
tone(warning/notice/error) and render tinted, withsummary+detailsjoined for config/deprecation notices. - Plan documents — a plan-only branch (streaming and completion) marks plans
presentation: 'plan-document', rendered as a Card with markdown at body size. - Images —
imageView/imageGenerationtranslate into assistant messages with operation text plusimage-refblocks, preferring saved paths and bounding inline data. - Wire plumbing — optional
presentation/tonestring fields added to the status/text schemas and types, propagated through the shared projection; old readers strip them and render the plain text (covered by tests).
The forward/backward compatibility story is solid: new fields are optional strings, never enums, and the tests exercise old-reader parsing and unknown metadata values. Image savedPath/path preservation across /- and \-style execution-host paths is covered.
The only remaining gap is the explicitly-deferred Electron visual validation and before/after screenshots (noted as coordinator-owned in the plan and PR checklist); the new NativeChatNoticeRow styling hasn't been exercised under a rendered app yet.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| handled: true | ||
| } | ||
| } | ||
| if (item.type === 'reasoning' || item.type === 'plan') { |
There was a problem hiding this comment.
This || item.type === 'plan' is now dead — the plan-only branch added above returns unconditionally, so a plan item never reaches this condition. Removing it also makes explicit a subtle behavior change: plan items now read only text and no longer fall back to summary/content, which the previous combined reasoning || plan branch did.
| if (item.type === 'reasoning' || item.type === 'plan') { | |
| if (item.type === 'reasoning') { |
There was a problem hiding this comment.
ℹ️ No new issues in the incremental commits. Approval is held only by one minor, previously-flagged cleanup that these commits did not touch.
Reviewed changes
- Compaction coalescing — extracted a dedicated
CodexJournalCompactionshandler that journals both the legacythread/compactednotification and the canonicalitem/completed(contextCompaction) form into onepresentation: 'compaction'status row per thread/turn, deduplicating by asha256of[threadId, turnId]with a 64-entry retention bound and history-restore support. - Canonical item reclassification —
contextCompactionmoved fromstatus-chrometotimeline-substantivein the item-disposition catalog (whileitem/startedstays explicitly suppressed), so the item form now reaches the journal's dedup instead of being dropped. - Shared completion predicate —
isCodexCompactionCompletenow recognizes the canonical item form and is reused by the wire-levelStructuredSessionCompactionreceipt tracker, so a compaction signaled viaitem/completedstill satisfies completion. - Notice disclosure dedup —
ProviderFrameRowgained an optionalsummaryprop so a notice's diagnostic disclosure no longer repeats the message text already shown in the row.
The dedup logic handles all delivery orders (item-then-legacy, legacy-then-item, duplicates) and the "canonical replaces legacy" case correctly relies on the journal's identity upsert, so the two events collapse to a single projected row rather than two dividers. The 59 focused tests across the changed suites pass.
The remaining item is the dead || item.type === 'plan' clause at src/main/codex/codex-structured-item-translation.ts:264: the plan branch added above it returns unconditionally, so no plan item reaches that condition, and removing it also makes explicit that plan items now read only text (no summary/content fallback). It predates this delta and is unchanged by it — a one-line cleanup whenever convenient.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No new issues in the incremental commits — this delta is a clean merge of
origin/main.
Reviewed changes
- Merge of
origin/main(subagent roster) — reconciled the branch with the upstream subagent-roster feature:settleOversizedNotificationandstartTurnnow accept typedExtract<CodexStructuredSessionEvent, …>event shapes, the rosterdispose()is wired intocreateCodexJournalTranslator's teardown, and provider-frame disposition comments align with roster rendering.
The merge resolution is clean: the compaction handler still runs before subagent item handling, so item/completed (contextCompaction) keeps coalescing with the legacy notification, and the PR's compaction, notice-tone, plan-document, and image translation paths are otherwise untouched.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Status: ready for reviewPlan reviewReviewed before any code was written. APPROVE WITH AMENDMENTS, all applied. The critical one prevented a subtle wire hazard: the plan typed the new The find that mattered mostDuring review the reviewer discovered the compaction divider was wired to a deprecated notification the current provider no longer sends — it now emits a Code review loopSame-model subagent review returned clean. Verification
Manual UI validationReal Orca dev build, hidden renderer over CDP. 6 screenshots attached above, dark and light. Compaction renders as exactly one centred divider ( Process deviations, stated plainly
Known-red, not caused by this PR
|
There was a problem hiding this comment.
ℹ️ No new issues in this delta — a clean third merge of
origin/main.
Reviewed changes
- Merge of
origin/main— reconciled the branch with upstream native-chat work (0b3af9ddbcmessage timestamps on hover/focus,d0506bf5deexecution details / tool row identity,ce4a3a4186rewind backend) plus unrelated relay/mobile-revert/browser/composer commits. - Clean overlapping-file resolution — the PR's optional
presentation/tonefields coexist with upstream'sToolMetadatatool annotations inagent-session-journal-schemas.tsand the shared projection, andNativeChatMessageRow.tsxkeeps its notice-row detection beside the newNativeChatMessageTimestamp. - Compaction ordering preserved —
compactions.handlestill runs before subagent item handling, so the canonicalitem/completed(contextCompaction) keeps coalescing with the legacythread/compactednotification.
The merge is clean and the PR's compaction, notice-tone, plan-document, and image translation paths are unchanged. Approval remains held only by the pre-existing dead || item.type === 'plan' cleanup flagged in the initial review — a one-line removal whenever convenient.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
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. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: a7a0782c-e44f-4693-a3ab-74ca797d4d95
📒 Files selected for processing (24)
src/main/codex/codex-image-item-translation.tssrc/main/codex/codex-notice-item-translation.test.tssrc/main/codex/codex-structured-item-translation.tssrc/main/codex/codex-structured-journal-compactions.test.tssrc/main/codex/codex-structured-journal-compactions.tssrc/main/codex/codex-structured-journal-items.tssrc/main/codex/codex-structured-journal-translation-streams.test.tssrc/main/codex/codex-structured-journal-translation.tssrc/main/native-chat/agent-session-wire/provider-frame-disposition.test.tssrc/main/native-chat/agent-session-wire/provider-frame-disposition.tssrc/main/native-chat/agent-session-wire/structured-session-compaction.tssrc/main/native-chat/agent-session-wire/unhandled-provider-frame.test.tssrc/main/native-chat/agent-session-wire/unhandled-provider-frame.tssrc/renderer/src/components/native-chat/NativeChatMessageRow.tsxsrc/renderer/src/components/native-chat/NativeChatNoticeRow.test.tsxsrc/renderer/src/components/native-chat/NativeChatNoticeRow.tsxsrc/renderer/src/components/native-chat/NativeChatTranscriptChrome.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/shared/agent-session-journal-schemas.test.tssrc/shared/agent-session-journal-schemas.tssrc/shared/agent-session-journal-types.tssrc/shared/native-chat-types.tssrc/shared/structured-agent-session-projection.test.tssrc/shared/structured-agent-session-projection.ts
🚧 Files skipped from review as they are similar to previous changes (16)
- src/shared/agent-session-journal-schemas.ts
- src/renderer/src/i18n/locales/en.json
- src/shared/agent-session-journal-schemas.test.ts
- src/renderer/src/components/native-chat/NativeChatNoticeRow.tsx
- src/main/codex/codex-notice-item-translation.test.ts
- src/shared/native-chat-types.ts
- src/main/native-chat/agent-session-wire/unhandled-provider-frame.test.ts
- src/main/native-chat/agent-session-wire/provider-frame-disposition.ts
- src/shared/structured-agent-session-projection.ts
- src/main/native-chat/agent-session-wire/provider-frame-disposition.test.ts
- src/main/codex/codex-structured-journal-translation-streams.test.ts
- src/renderer/src/components/native-chat/NativeChatMessageRow.tsx
- src/main/codex/codex-structured-item-translation.ts
- src/shared/structured-agent-session-projection.test.ts
- src/shared/agent-session-journal-types.ts
- src/main/native-chat/agent-session-wire/unhandled-provider-frame.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.
| ).toHaveLength(2) | ||
| }) | ||
| it.each([ | ||
| ['warning', 'text-[color:var(--warning,#f59e0b)]'], |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Use an accessible light-theme warning color.
Line 32 requires #f59e0b for warning text. This color has about 2.15:1 contrast against a white background. It makes warning text difficult to read in light theme. Use a theme-aware warning token with sufficient contrast, then update this expectation.







What this does, in plain terms
Four kinds of thing the agent tells you that the chat was rendering badly or not at all:
Before → After
One subtlety: newer agent versions announce compaction differently than older ones. Both are handled, and a provider that reports it both ways still produces exactly one divider.
Technical detail
ELI5
Compaction now leaves a quiet divider, warnings show their tone, plan documents get readable cards, and viewed/generated images use the existing previews.
What Changed
Why
These events were suppressed, flattened into small status text, or displayed as raw provider frames. Optional open-string fields preserve readable text for older desktop/mobile readers and tolerate future metadata values. Reasoning, checklist updates, token usage, and rate-limit classifications remain unchanged.
Linked Issue
Coordinator-dispatched notice-row task; no issue number supplied.
Visual Proof
Pending centralized Electron validation and before/after screenshots by the coordinator, as agreed during plan review. No desktop UI was activated by this lane.
Testing
Review
Independent same-model review returned clean after fixing repeated notice text and canonical compaction delivery. START and END readiness checklists include mobile compatibility, bounded state, shared projection, and unchanged reasoning contracts.
docs/native-chat-notices-plan.mdrecords the implementation and verification.Agent skill upstream boundary
Checklist