Skip to content

fix(native-chat): save every chat reply and tool output whole; bound only the copy sent to clients - #29982

Merged
brennanb2025 merged 43 commits into
mainfrom
brennanb2025/chat-full-payload
Oct 20, 2026
Merged

brennanb2025 merged 43 commits into
mainfrom
brennanb2025/chat-full-payload

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 43 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1021 $\color{#cf222e}{\Huge{\mathbf{−}}}$​235 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​786
Prod 69 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1188 $\color{#cf222e}{\Huge{\mathbf{−}}}$​443 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​745

ELI5

Long agent replies and tool results could stop mid-sentence because Orca discarded content after 16 KiB while saving the chat. Reopening the chat could not recover it. This change keeps completed content in the journal and shortens the copy delivered to a screen. Desktop and phone tool rows can load more output; shortened phone messages can load more text.

Review path: full. The change spans saved journal data, queues, provider shutdown and a version-negotiated RPC. The light-path criteria do not apply.

What Changed

  • Completed replies, reasoning, plans, tool inputs, tool outputs and diffs keep their supplied content in the existing journal fields. There is no new saved-text ceiling or database format.
  • Every history and live reader uses the same bounded outgoing form. Tool outputs and diffs retain the 16 KiB head older clients understand. Other item content uses the existing full desktop page allowance; oversized items are fitted and marked as shortened.
  • Show full output on desktop and phone and Show full message on phone request the original item from the host that owns its journal. Requests are capability-gated and tied to the source revision, client and session. Late responses cannot replace newer content. Unavailable and still-shortened replies remain clearly limited.
  • Received bytes are fully charged and pause further provider input; byte weight no longer rejects an already-received body. Existing operation-count limits, write ordering and failure handling remain. Completed large content can enter the journal behind a pending write.
  • Running Grok, OpenCode, OMP and Pi tool calls keep bounded saved previews and one accounted full current value for their closing row. An update that omits a field reuses its previous preview. Pi transfers its sealed final work before the host's write barrier.

Previously cut saved content stays cut; this change cannot recover discarded bytes. Imported legacy chats keep their existing bounded blocks and retained message selection, with the original transcript remaining the source.

Why

A client delivery limit had become a storage limit shared by many agent writers. Keeping the original journal item and fitting a client copy separates those responsibilities without adding an overflow store, schema change or another lifecycle. Loading an item uses the existing permission and host-routing mechanism. Keeping familiar output heads also preserves older clients instead of hiding their tool results.

Differences from the common pattern:

  • Intended: older clients continue receiving 16 KiB tool-output and diff heads. Detail replies fit the existing response allowance of approximately 4 MiB and can still be partial; desktop history keeps its full page allowance.
  • Intended: desktop reasoning, including grouped thoughts, receives complete text only while it fits the roughly 1.94 MiB history-page content allowance. Reasoning beyond that allowance stays shortened on desktop because desktop has no full-message recovery control. Phone shortened messages retain their full-message action.
  • Intended: prompt details retain their 128 KiB bound; dispatch reasons and unmodelled provider diagnostics retain their named 16 KiB bounds. Existing provider frame limits remain.
  • Intended: running tool snapshots and legacy transcript imports retain their existing bounded presentation. An interrupted call with no terminal payload retains its saved preview. Completed full content increases journal and snapshot residency; this PR does not claim a global memory ceiling.
  • Temporary: operation-count refusal and its shutdown ownership gap remain as on main, tracked in STA-10949 for a separate lane after this PR lands. This PR removes the byte-refusal failures made reachable by storing larger content; it does not promise lossless capture beyond the existing count limits.
  • Temporary: the diff card still displays at most 120 lines, and the older transcript-backed phone path retains its separate display caps. These remain the data-limits audit follow-ups for diff display and older phone history.
  • Temporary: while a Codex reply, command output or diff is still streaming, Orca saves a new copy of the whole text so far each time it grows by about an eighth, and keeps every copy. Main already did this but capped each copy at 16 KB; now each copy is whole, so a large streamed Codex output takes roughly ten times its final size on disk (about 10 MB for a 1 MB command output). The common pattern saves streamed output once: either not at all until it finishes, or as pieces that are removed once the finished copy is saved. perf(native-chat): share saved text across journal revisions #29132 (store only the new text in each saved copy) and Native chat: retire superseded saved revisions and reclaim space #28958 (remove superseded saved copies) each remove this extra.

Linked Issue

Tracked in the native-chat data-limits audit for saved content and full-content retrieval. Supersedes #19717. Count-cap follow-up: STA-10949.

Visual Proof

Admitted native Android QA on 73f8ba9d20ef4882347b0b9a1ffcd63e77461d83 used a fresh real Codex conversation through its configured provider. One Show full output tap recovered all 47,526 bytes / 700 numbered rows, matching the saved text’s SHA256 a275f757198a61404aa8840a2f7d94e4cdbe5d921263108cb4eb342ba727d474 and unique final tail. Scrolling inside the output kept the conversation still; scrolling beside it moved the conversation. Collapse/reopen and navigating away/back reset the preview and recovered the same complete text again. A second tool row started at the top, and an ordinary follow-up reply completed on desktop and phone.

A fresh run on incoming main a201eacd0673a9fb62c5f0f7b5467c06d29d3b54 used the same input and settings: main saved only 16,384 tool bytes and its native preview stopped within row 60 without a full-output action. Both runs used the real native app. The installed APK retained its original bb39669 build identity; the admitted native build succeeded and its checksum matched. Native/dependency inputs were identical between the two tested heads, while the host, served page and native shell JavaScript came from each pinned checkout. Shell source was verified through launch/build records, rather than an independent hash of the delivered shell request. All 128 recorded owned process identities exited and assigned ports were clear.

Current head: native preview and Show full output
Current head: complete native tool-output tail
Fresh incoming main: native output stops within row 60

Earlier admitted Windows Electron QA at a63e3a4d6df used genuine Codex in a folder workspace. Show full output recovered all 36,436 bytes / 700 rows with matching saved/rendered SHA256 d5a77b5f3c2c7c8c0af10e8eba45336ecf566733b1f6051f95aa71a0b252a816; an adjacent ordinary send and recovery after navigation passed. The same reader reopened an earlier dbe2e3c884d8 saved chat and recovered its original complete bytes. These are historical writer/reader identities, not an application run on 73f8ba9.

Earlier a63e desktop: complete output tail and adjacent answer
Earlier dbe2 saved chat reopened by a63e reader

Earlier same-input main/PR comparison (main b331710, PR dbe2e3c): main saved only16,384 bytes and had no recovery action; the PR recovered all36,436 bytes/700rows. Ordinary sends after Stop displayed Interrupted and worked on both heads. Saved output reopened successfully; seamless automatic dev restart was not established.

Earlier main: cut tool output
Earlier PR: recovered full tool tail

Earlier native readerf1fb, writerbb39669 and APKbb39669 with then-unchanged native inputs recovered40,626 real tool bytes. A separately labelled synthetic100,000-byte grouped thought between tools passed one-action full-message recovery under the accepted review ruling; no genuine long-thought inference is claimed. These earlier results retain their original provenance.

Testing

All eight workflows and all 58 jobs completed on 73f8ba9d20ef4882347b0b9a1ffcd63e77461d83: 35 success and 23 intentional skips, with no failures, cancellations or pending jobs. The full PR workflow and its PR checks passed aggregate succeeded, as did all five unit shards, static analysis/typechecks, Mobile, packaging, cross-version compatibility, both managed SSH shards and the separate WSL2 run. The workflow tested GitHub’s synthetic merge; the reviewed parameter/test files and executed workflow files match the recorded source. This is CI evidence, separate from real phone QA.

The final source integration retained full-content recovery inside main’s phone scroll ownership. Its two narrow CI corrections leave the product behavior and large test fixtures unchanged. The received-content journal cases and full test suite passed, including the unchanged history serialization-count contract, composed phone failure/retry/collapse/cache fixture and complete-content retention fixture. Focused earlier Windows runs passed49cleanup/provider cases and31wire/provider cases. No timing, CPU, memory or resource ceiling is claimed. Native shell request bytes were not independently hashed, and live request counts were not captured. Navigation supplied the remount check; forced row recycling, induced failures, old peers, SSH and iOS were not exercised in this narrow runtime refresh.

  • Current-head real native phone full-output and scrolling QA passed
  • Regression tests updated; full PR workflow green on73f8ba9

Review

Five general rounds are complete; later merge resolutions received a narrow source check. No open confirmed behavioral finding remains from that check. Current-head native QA passed. The PR is out of draft, has no unresolved review threads and is conflict-free. The existing status comment records the reviewed head, evidence and accepted limits; the final readiness checker is run after that update.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material is copied.

Notes

The journal's execution host serves item detail for local, WSL, SSH and paired sessions. Older hosts do not receive the new call unless they advertise its capability. No minimum server version changes.

Author: @BrennanKB5

…only the copy sent to clients

Orca cut Codex replies, every agent's reasoning, plans, prompts and all tool
output to a 16 KB head when it saved them, and threw the rest away. The
limit existed so a reconnecting client is not replayed a huge row, but it
was applied at save time, so every transport limit became permanent data
loss.

The journal now keeps what the agent said. One outbound form, applied to
every history page, live batch and catch-up, sends a client the same 16 KB
head of each tool output and diff it always got, and marks the item
`shortened`. A new capability-gated `agentSession.item` RPC returns the
whole item, and the desktop and phone show "Show full output" / "Show full
message" when the copy was cut. Items past half a page are shortened and
marked instead of replaced with "too large to show".

Two bounds stay, both named: a 4 MiB ceiling per text (head and tail),
applied where every provider's rows enter the write queue so one write can
never stall a chat, and a preview on Grok/OpenCode/OMP/Pi calls while they
run, whose closing row is built from the whole value the translator held.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 17, 2026 06:36
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

The change retains complete journal content while applying separate bounds to running previews and client wire copies. It adds an item-detail RPC and renderer and mobile controls for loading full tool output or shortened messages. ACP and Pi timelines retain tool input and output across partial updates. Timeline lanes also change how they queue refused events, retry work, and finalize sessions.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 36594

Large completed payloads can accumulate in memory when journal writes stall, and retired ACP tool snapshots can outlive their turn. Address these retention paths before merging to reduce the risk of memory pressure or process failure.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 36.99% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 73 functions across 67 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
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.
Title check Passed The title clearly summarizes the primary change: retain complete chat replies and tool output in storage while bounding client copies.
Description check Passed The pull request description is complete and follows the repository template. It includes the ELI5 summary, scope, rationale, linked tracking issues, visual proof, testing evidence, review status, com…
Full details: Description check

Explanation

The pull request description is complete and follows the repository template. It includes the ELI5 summary, scope, rationale, linked tracking issues, visual proof, testing evidence, review status, compatibility notes, and checklist updates. The Linked Issue section does not use the exact Fixes #... format, and the AI Disclosure section is not filled out, but these omissions are non-critical given the otherwise detailed description.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@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: 5


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 86e6b9b0-c284-49f0-9fe2-87e5e1bf326c
📥 Commits

Reviewing files that changed from the base of the PR and between 8612588 and 9533770.

⛔ Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing: 92
  • mobile/src/session/MobileNativeChatFullContent.tsx
  • mobile/src/session/MobileNativeChatMessage.tsx
  • mobile/src/session/MobileNativeChatOverlay.tsx
  • mobile/src/session/MobileNativeChatToolRun.tsx
  • mobile/src/session/mobile-native-chat-controller-contract.ts
  • mobile/src/session/mobile-native-chat-item-read.ts
  • mobile/src/session/mobile-native-chat-merged-snapshot-parity-hooks.test.tsx
  • mobile/src/session/mobile-native-chat-message-styles.ts
  • mobile/src/session/mobile-structured-agent-session-host-support.test.ts
  • mobile/src/session/mobile-structured-agent-session-host-support.ts
  • mobile/src/session/use-mobile-native-chat-controller.ts
  • mobile/src/session/use-mobile-native-chat-message-detail.test.tsx
  • mobile/src/session/use-mobile-native-chat-message-detail.ts
  • mobile/src/session/use-mobile-structured-agent-session-prompt-cancel.test.tsx
  • mobile/src/session/use-mobile-structured-agent-session-queued.test-fixture.ts
  • mobile/src/session/use-mobile-structured-turn-indicator.test.tsx
  • src/main/acp/acp-background-task-timeline.ts
  • src/main/acp/acp-session-update.ts
  • src/main/acp/acp-subagents.ts
  • src/main/acp/acp-timeline-generic.test.ts
  • src/main/acp/acp-timeline-requests.ts
  • src/main/acp/acp-tool-timeline.ts
  • src/main/claude/claude-informational-row.ts
  • src/main/claude/claude-structured-item-translation.ts
  • src/main/claude/claude-structured-journal-translation.test.ts
  • src/main/claude/claude-structured-provider-fallback.ts
  • src/main/claude/claude-thread-goal.ts
  • src/main/codex/codex-child-work-translation-retention.test.ts
  • src/main/codex/codex-collab-agent-item-translation.ts
  • src/main/codex/codex-collab-call-delegation.test.ts
  • src/main/codex/codex-image-item-translation.ts
  • src/main/codex/codex-provider-retry-row.ts
  • src/main/codex/codex-structured-item-translation.test.ts
  • src/main/codex/codex-structured-item-translation.ts
  • src/main/codex/codex-structured-journal-translation-settlement.test.ts
  • src/main/codex/codex-structured-journal-translation-turn-lifecycle.test.ts
  • src/main/codex/codex-structured-notification-retry.ts
  • src/main/codex/codex-structured-prompt-items.test.ts
  • src/main/codex/codex-structured-prompt-items.ts
  • src/main/jsonl-rpc/timeline-final-tail.test.ts
  • src/main/jsonl-rpc/timeline-lane.ts
  • src/main/native-chat/agent-session-journal/journal-completed-content.test.ts
  • src/main/native-chat/agent-session-journal/journal-dispatch-legacy-reason.test.ts
  • src/main/native-chat/agent-session-journal/journal-dispatch-reason-bound.spec.ts
  • src/main/native-chat/agent-session-journal/journal-dispatch-reducer.ts
  • src/main/native-chat/agent-session-journal/journal-legacy-import.test.ts
  • src/main/native-chat/agent-session-journal/journal-legacy-import.ts
  • src/main/native-chat/agent-session-journal/journal-payload-bounds-retention.test.ts
  • src/main/native-chat/agent-session-journal/journal-payload-bounds.ts
  • src/main/native-chat/agent-session-journal/journal-prompt-body-bounds.ts
  • src/main/native-chat/agent-session-journal/journal-reasoning-row.ts
  • src/main/native-chat/agent-session-journal/journal-row-builders.ts
  • src/main/native-chat/agent-session-journal/journal-store.spec.ts
  • src/main/native-chat/agent-session-timeline/provider-timeline-text-streams.ts
  • src/main/native-chat/agent-session-wire/agent-session-bounded-frame-item.ts
  • src/main/native-chat/agent-session-wire/agent-session-bounded-frames.ts
  • src/main/native-chat/agent-session-wire/agent-session-history-page-bounds.ts
  • src/main/native-chat/agent-session-wire/agent-session-history-page.test.ts
  • src/main/native-chat/agent-session-wire/agent-session-history-page.ts
  • src/main/native-chat/agent-session-wire/agent-session-item-wire-form.test.ts
  • src/main/native-chat/agent-session-wire/agent-session-item-wire-form.ts
  • src/main/native-chat/agent-session-wire/hook-failure-provider-frame.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-event-sink-queue.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-final-tail-reservation.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-final-tail-reservation.ts
  • src/main/native-chat/agent-session-wire/unhandled-provider-frame.test.ts
  • src/main/native-chat/agent-session-wire/unhandled-provider-frame.ts
  • src/main/pi/rpc-messages.ts
  • src/main/pi/rpc-session.ts
  • src/main/runtime/rpc/methods/structured-agent-session-gate-classification.test-fixture.ts
  • src/main/runtime/rpc/methods/structured-agent-session-item.ts
  • src/main/runtime/rpc/methods/structured-agent-session-wire-contracts.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session.ts
  • src/main/runtime/runtime-rpc/runtime-rpc-mobile-agent-session-methods.ts
  • src/renderer/src/components/native-chat/NativeChatToolLine.tsx
  • src/renderer/src/components/native-chat/NativeChatToolOutput.test.tsx
  • src/renderer/src/components/native-chat/NativeChatToolOutput.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/runtime/structured-agent-session-client.ts
  • src/shared/agent-session-journal-schemas.ts
  • src/shared/agent-session-journal-types.ts
  • src/shared/native-chat-types.ts
  • src/shared/protocol-version.ts
  • src/shared/rpc-contract/structured-agent-session-params.ts
  • src/shared/runtime-capability-constants.ts
  • src/shared/structured-agent-session-projection.ts
💤 Files with no reviewable changes: 1
  • src/main/acp/acp-background-task-timeline.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Comment thread src/main/jsonl-rpc/timeline-lane.ts Resolved

@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: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 95d27e1a-aad8-425d-9a6f-bdb11c5bdb57
📥 Commits

Reviewing files that changed from the base of the PR and between 9533770 and bdb49ab.

📒 Files selected for processing: 10
  • src/main/claude/claude-stream-json-connection-close.test.ts
  • src/main/claude/claude-stream-json-connection.ts
  • src/main/claude/claude-structured-event-delivery.ts
  • src/main/claude/claude-structured-session-acquisition.ts
  • src/main/claude/claude-structured-session-close.ts
  • src/main/claude/claude-structured-session-test-support.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-event-sink-queue.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-event-sink.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-input-capture.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-input-capture.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Release retired whole snapshots when a turn ends. · acp-tool-timeline.ts:218

src/main/acp/acp-tool-timeline.ts:218
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Release retired whole snapshots when a turn ends.

remember can retire a tool without deleting its whole snapshot. end(turn) only cleans snapshots for tools still in this.tools. The turns map is also bounded, so it can evict the association before end(turn) runs.

Store the turn with each whole snapshot and clean whole directly. Use entries() because BoundedMap is not directly iterable.

🐛 Suggested fix
   private readonly whole = new BoundedMap<string, {
-    input?: unknown; output?: string; inputBytes: number; outputBytes: number
+    input?: unknown; output?: string; turn?: string; inputBytes: number; outputBytes: number
   }>({
...
     const suppliedOutput = outputText(update)
     const output = suppliedOutput ?? held?.output
+    const turn = join.turn ?? this.turn(update.toolCallId) ?? held?.turn
...
       if (!this.whole.set(update.toolCallId, {
-        input, output,
+        input, output, turn,
...
-    const turn = join.turn ?? this.turn(update.toolCallId)
     this.turns.delete(update.toolCallId)
...
   end(turn: string): void {
     for (const [key, snapshot] of this.tools) {
       if (snapshot.turn === turn) {
         this.bytes -= this.size(key, snapshot)
         this.retire(key, snapshot)
         this.whole.delete(key)
       }
     }
+    for (const [key, snapshot] of this.whole.entries()) {
+      if (snapshot.turn === turn) {
+        this.whole.delete(key)
+      }
+    }
   }

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5f897c32-2919-45e7-9df8-99e96baf2e04
📥 Commits

Reviewing files that changed from the base of the PR and between bdb49ab and 130ff37.

📒 Files selected for processing: 14
  • mobile/src/session/MobileNativeChatFullContent.test.tsx
  • mobile/src/session/MobileNativeChatFullContent.tsx
  • mobile/src/session/MobileNativeChatOverlay.tsx
  • mobile/src/session/use-mobile-native-chat-message-detail.test.tsx
  • mobile/src/session/use-mobile-native-chat-message-detail.ts
  • src/main/acp/acp-tool-timeline.ts
  • src/main/codex/codex-structured-journal-exit-convergence.test.ts
  • src/main/codex/codex-structured-notification-retry.ts
  • src/main/jsonl-rpc/timeline-final-tail.test.ts
  • src/main/native-chat/agent-session-journal/journal-completed-content.test.ts
  • src/main/native-chat/agent-session-journal/journal-received-content.test.ts
  • src/main/native-chat/agent-session-wire/agent-session-item-wire-form.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-event-sink-queue.ts
  • src/main/pi/rpc-messages.ts
🚧 Files skipped from review as they are similar to previous changes: 3
  • src/main/native-chat/agent-session-wire/agent-session-item-wire-form.test.ts
  • src/main/jsonl-rpc/timeline-final-tail.test.ts
  • mobile/src/session/use-mobile-native-chat-message-detail.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · Add a bounded retention policy for completed… · structured-agent-session-event-sink-queue.ts:173-193

src/main/native-chat/agent-session-wire/structured-agent-session-event-sink-queue.ts:173-193
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Add a bounded retention policy for completed operations.

The soft byte watermark correctly pauses provider reading, but submit() still accepts operations until the 1,024-operation limit. Completed payloads retain their full bodies without a fixed per-operation limit. A stalled journal writer can therefore retain materially more than the configured byte budget. Add a separate bounded retention or overflow policy. Do not restore raw byte rejection without handling already-received oversized bodies.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cd4fdd73-6bdd-45a5-8dd2-a169746adced
📥 Commits

Reviewing files that changed from the base of the PR and between b258506 and 3659455.

📒 Files selected for processing: 4
  • src/main/native-chat/agent-session-journal/journal-completed-content.test.ts
  • src/main/native-chat/agent-session-journal/journal-legacy-import.test.ts
  • src/main/native-chat/agent-session-timeline/provider-timeline-assembler-test-support.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-event-sink.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@brennanb2025

brennanb2025 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Long replies and tool results could stop mid-sentence because Orca discarded content after 16 KiB while saving a chat. This PR keeps completed content in the journal and bounds the copy sent to screens. Desktop and phone can retrieve full tool output; shortened phone messages can retrieve their original text.

Five general review rounds remain complete. The final narrow integration review preserves main’s status-word messages, extracted Pi test fixtures, phone scroll ownership, row identities and reused folded rows alongside full-content retrieval. Two CI integration corrections reuse the existing strict subscription schema to meet the file limit and open the Codex test session through its existing ready-session helper. The original large payload and persistence assertions remain intact. No new behavioral finding remains from that check; all 39 structured methods and compatible peer-version floors are preserved.

CI: All eight workflows and all 58 jobs completed on 73f8ba9d20ef4882347b0b9a1ffcd63e77461d83: 35 success and 23 intentional skips, with no failures, cancellations or pending jobs. The full PR workflow and its PR checks passed aggregate succeeded, as did all five unit shards, static analysis/typechecks, Mobile, packaging, cross-version compatibility, both managed SSH shards and the separate WSL2 run. The workflow tested GitHub’s synthetic merge; the reviewed parameter/test files and executed workflow files match the recorded source. This is CI evidence, separate from real phone QA.

Admitted native Android QA on 73f8ba9d20ef4882347b0b9a1ffcd63e77461d83 used a fresh real Codex conversation through its configured provider. One Show full output tap recovered all 47,526 bytes / 700 numbered rows, matching the saved text’s SHA256 a275f757198a61404aa8840a2f7d94e4cdbe5d921263108cb4eb342ba727d474 and unique final tail. Scrolling inside the output kept the conversation still; scrolling beside it moved the conversation. Collapse/reopen and navigating away/back reset the preview and recovered the same complete text again. A second tool row started at the top, and an ordinary follow-up reply completed on desktop and phone.

A fresh run on incoming main a201eacd0673a9fb62c5f0f7b5467c06d29d3b54 used the same input and settings: main saved only 16,384 tool bytes and its native preview stopped within row 60 without a full-output action. Both runs used the real native app. The installed APK retained its original bb39669 build identity; the admitted native build succeeded and its checksum matched. Native/dependency inputs were identical between the two tested heads, while the host, served page and native shell JavaScript came from each pinned checkout. Shell source was verified through launch/build records, rather than an independent hash of the delivered shell request. All 128 recorded owned process identities exited and assigned ports were clear.

Earlier admitted Windows Electron QA at a63e3a4d6df used genuine Codex in a folder workspace. Show full output recovered all 36,436 bytes / 700 rows with matching saved/rendered SHA256 d5a77b5f3c2c7c8c0af10e8eba45336ecf566733b1f6051f95aa71a0b252a816; an adjacent ordinary send and recovery after navigation passed. The same reader reopened an earlier dbe2e3c884d8 saved chat and recovered its original complete bytes. These are historical writer/reader identities, not an application run on 73f8ba9.

Earlier a63e desktop: complete output tail and adjacent answer

Accepted boundaries remain: operation-count refusal and its shutdown ownership gap (STA-10949); desktop thoughts beyond roughly 1.94 MiB stay shortened without a desktop full-message action; existing diff/older phone transcript display caps; interrupted calls without a terminal payload retain previews; detail replies can be partial; phone reasoning disclosure and retrieval remain separate; discarded historical bytes cannot be recovered. Temporary: streamed Codex content still saves repeated whole copies, roughly ten times the final size, pending #29132 and #28958. No global losslessness, timing, CPU or memory guarantee is claimed. This narrow runtime refresh did not capture live request counts or exercise forced row recycling; navigation supplied the remount check.

Earlier native QA at f1fb1d893e58 recovered genuine Codex output (40,626 bytes / 700 rows). Its separate labelled 100,000-byte grouped-thought fixture supplemented unavailable genuine long reasoning; it is not real model reasoning or a new current-head result. Induced failure/retry, partial replies, older hosts, SSH full-content retrieval and iOS are not an exhaustive live QA matrix; their source/CI checks are separate evidence.

For Brennan’s review

Earlier same-input desktop comparison (main b331710b316, PR dbe2e3c884d8):

Earlier incoming main: cut output without recovery
Earlier PR: complete real tool tail

Current head: native preview and Show full output
Current head: complete native tool-output tail
Fresh incoming main: native output stops within row 60

Three deliberate boundaries:

…l-payload

# Conflicts:
#	mobile/src/session/MobileNativeChatToolRun.tsx
#	mobile/src/session/mobile-native-chat-message-styles.ts
#	src/main/pi/rpc-session.ts
…l-payload

# Conflicts:
#	mobile/src/session/MobileNativeChatOverlay.tsx
#	mobile/src/session/mobile-native-chat-merged-snapshot-parity-hooks.test.tsx
#	mobile/src/session/mobile-structured-agent-session-host-support.test.ts
#	mobile/src/session/mobile-structured-agent-session-host-support.ts
#	mobile/src/session/use-mobile-structured-agent-session-prompt-cancel.test.tsx
#	mobile/src/session/use-mobile-structured-agent-session-queued.test-fixture.ts
#	mobile/src/session/use-mobile-structured-turn-indicator.test.tsx
#	src/main/runtime/runtime-rpc/runtime-rpc-mobile-agent-session-methods.ts
…l-payload

# Conflicts:
#	src/main/pi/rpc-session.ts
…l-payload

# Conflicts:
#	mobile/src/session/MobileNativeChatMessage.tsx
#	mobile/src/session/MobileNativeChatOverlay.tsx
#	mobile/src/session/MobileNativeChatToolLine.tsx
#	src/main/claude/claude-structured-provider-fallback.ts
#	src/main/pi/rpc-session-adapter.test.ts
@brennanb2025
brennanb2025 merged commit 6c7a6dd into main Oct 20, 2026
58 checks passed
brennanb2025 added a commit that referenced this pull request Oct 22, 2026
…fore it is sent (#30398)

* fix(native-chat): attach a long paste as a text file, and say a message is too large before it is sent

A paste of 32 KB or more (or one that would push the message past the 256 KB
send limit) into a structured chat is saved as a file the agent reads, through
the same pending-chip and @path route a dropped file takes: Orca's paste folder
here, or the chat's attachment store on its paired server. Claude gets the paste
folder as an allowed directory. A message still over the limit is handed back
before it is sent, on desktop and the phone, with words naming the limit instead
of the generic 'not sent, send it again'.

* test: Claude launch parity snapshot grants the paste folder

* fix(native-chat): a long paste replaces the selection at once and settles in place

A long paste now puts an inline Pasted text pill where it went, replacing any
selected text immediately, and the saved file (or inline text, or the original
selection on failure) replaces that same pill when the save finishes, in its own
chat's draft. Nothing reads the caret later, so order and position hold. The
paste never joins the image row, so image numbers are unchanged. The size check
measures the real message body with the selection replaced and images included.
A server that keeps no files takes the paste inline when the message still fits.
A pending paste a restart lost shows Paste not saved, and Send says so.

* fix(native-chat): type the pasted-text parser and the composer's missing draft scope

* fix(native-chat): admit paste references before goals and commands

* fix(native-chat): resolve staged paste paths without editing the draft

* fix(native-chat): consolidate paste imports for code quality checks

* fix(native-chat): retain checked string types for saved paste paths

* fix(native-chat): retain completed paste facts through history and delimit paths

* fix(native-chat): keep structured question rendering within file limit

* fix(native-chat): pasted or inserted text that looks like a paste token stays literal

* fix(web): keep the browser's UI bridge under the file length limit

* style: format the files #29982 merged unformatted

* fix(native-chat): retain oversized drafts before send admission

* fix(native-chat): keep the composer handle's merge resolution to main's destructure
AmethystLiang added a commit that referenced this pull request Oct 28, 2026
…nal (#35226)

A long Codex command in a multi-agent chat could write gigabytes to the
agent-session journal and freeze Orca on the next launch while it replayed
them. One 16 MiB `rg` was saved 661 times in 163 s, 8.3 GB for one tool call.

Two things compounded:

- Every event from any Codex thread force-saved every other thread's
  in-flight stream, bypassing its x1.125 checkpoint cadence. The command's
  own thread wrote nothing else during that span; other sub-agents' events
  drove all 661 saves.
- Since #29982 a running Codex command saved its whole output on each
  revision, though the journal's contract (and ACP/Pi) keep a running call
  to a 16 KiB preview and save it whole only on the closing revision.

Forced flushes now re-save only the event's own thread. flushAll still
writes every other stream's first row first, so nothing is journaled ahead
of the text it follows. The journal enforces the running-preview contract
where item rows are built, so it holds for every provider; completed,
failed and interrupted rows stay whole.

Replaying the incident's shape (an 8 MiB command while another thread is
active) through the real translator and row builder: 354 command rows and
1,370 MiB before, 51 rows and 1.8 MiB after (1 MiB of it the completed
output), with translator time down from 1,043 ms to 47 ms.
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.

1 participant