Repository navigation
fix(native-chat): save every chat reply and tool output whole; bound only the copy sent to clients - #29982
Conversation
…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.
… limit, update method count and tests
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 5
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
86e6b9b0-c284-49f0-9fe2-87e5e1bf326c
⛔ Files ignored due to path filters: 1
src/shared/rpc-contract/rpc-params-catalog.generated.tsis excluded by!**/*.generated.*
📒 Files selected for processing: 92
mobile/src/session/MobileNativeChatFullContent.tsxmobile/src/session/MobileNativeChatMessage.tsxmobile/src/session/MobileNativeChatOverlay.tsxmobile/src/session/MobileNativeChatToolRun.tsxmobile/src/session/mobile-native-chat-controller-contract.tsmobile/src/session/mobile-native-chat-item-read.tsmobile/src/session/mobile-native-chat-merged-snapshot-parity-hooks.test.tsxmobile/src/session/mobile-native-chat-message-styles.tsmobile/src/session/mobile-structured-agent-session-host-support.test.tsmobile/src/session/mobile-structured-agent-session-host-support.tsmobile/src/session/use-mobile-native-chat-controller.tsmobile/src/session/use-mobile-native-chat-message-detail.test.tsxmobile/src/session/use-mobile-native-chat-message-detail.tsmobile/src/session/use-mobile-structured-agent-session-prompt-cancel.test.tsxmobile/src/session/use-mobile-structured-agent-session-queued.test-fixture.tsmobile/src/session/use-mobile-structured-turn-indicator.test.tsxsrc/main/acp/acp-background-task-timeline.tssrc/main/acp/acp-session-update.tssrc/main/acp/acp-subagents.tssrc/main/acp/acp-timeline-generic.test.tssrc/main/acp/acp-timeline-requests.tssrc/main/acp/acp-tool-timeline.tssrc/main/claude/claude-informational-row.tssrc/main/claude/claude-structured-item-translation.tssrc/main/claude/claude-structured-journal-translation.test.tssrc/main/claude/claude-structured-provider-fallback.tssrc/main/claude/claude-thread-goal.tssrc/main/codex/codex-child-work-translation-retention.test.tssrc/main/codex/codex-collab-agent-item-translation.tssrc/main/codex/codex-collab-call-delegation.test.tssrc/main/codex/codex-image-item-translation.tssrc/main/codex/codex-provider-retry-row.tssrc/main/codex/codex-structured-item-translation.test.tssrc/main/codex/codex-structured-item-translation.tssrc/main/codex/codex-structured-journal-translation-settlement.test.tssrc/main/codex/codex-structured-journal-translation-turn-lifecycle.test.tssrc/main/codex/codex-structured-notification-retry.tssrc/main/codex/codex-structured-prompt-items.test.tssrc/main/codex/codex-structured-prompt-items.tssrc/main/jsonl-rpc/timeline-final-tail.test.tssrc/main/jsonl-rpc/timeline-lane.tssrc/main/native-chat/agent-session-journal/journal-completed-content.test.tssrc/main/native-chat/agent-session-journal/journal-dispatch-legacy-reason.test.tssrc/main/native-chat/agent-session-journal/journal-dispatch-reason-bound.spec.tssrc/main/native-chat/agent-session-journal/journal-dispatch-reducer.tssrc/main/native-chat/agent-session-journal/journal-legacy-import.test.tssrc/main/native-chat/agent-session-journal/journal-legacy-import.tssrc/main/native-chat/agent-session-journal/journal-payload-bounds-retention.test.tssrc/main/native-chat/agent-session-journal/journal-payload-bounds.tssrc/main/native-chat/agent-session-journal/journal-prompt-body-bounds.tssrc/main/native-chat/agent-session-journal/journal-reasoning-row.tssrc/main/native-chat/agent-session-journal/journal-row-builders.tssrc/main/native-chat/agent-session-journal/journal-store.spec.tssrc/main/native-chat/agent-session-timeline/provider-timeline-text-streams.tssrc/main/native-chat/agent-session-wire/agent-session-bounded-frame-item.tssrc/main/native-chat/agent-session-wire/agent-session-bounded-frames.tssrc/main/native-chat/agent-session-wire/agent-session-history-page-bounds.tssrc/main/native-chat/agent-session-wire/agent-session-history-page.test.tssrc/main/native-chat/agent-session-wire/agent-session-history-page.tssrc/main/native-chat/agent-session-wire/agent-session-item-wire-form.test.tssrc/main/native-chat/agent-session-wire/agent-session-item-wire-form.tssrc/main/native-chat/agent-session-wire/hook-failure-provider-frame.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-event-sink-queue.tssrc/main/native-chat/agent-session-wire/structured-agent-session-final-tail-reservation.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-final-tail-reservation.tssrc/main/native-chat/agent-session-wire/unhandled-provider-frame.test.tssrc/main/native-chat/agent-session-wire/unhandled-provider-frame.tssrc/main/pi/rpc-messages.tssrc/main/pi/rpc-session.tssrc/main/runtime/rpc/methods/structured-agent-session-gate-classification.test-fixture.tssrc/main/runtime/rpc/methods/structured-agent-session-item.tssrc/main/runtime/rpc/methods/structured-agent-session-wire-contracts.test.tssrc/main/runtime/rpc/methods/structured-agent-session.test.tssrc/main/runtime/rpc/methods/structured-agent-session.tssrc/main/runtime/runtime-rpc/runtime-rpc-mobile-agent-session-methods.tssrc/renderer/src/components/native-chat/NativeChatToolLine.tsxsrc/renderer/src/components/native-chat/NativeChatToolOutput.test.tsxsrc/renderer/src/components/native-chat/NativeChatToolOutput.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/runtime/structured-agent-session-client.tssrc/shared/agent-session-journal-schemas.tssrc/shared/agent-session-journal-types.tssrc/shared/native-chat-types.tssrc/shared/protocol-version.tssrc/shared/rpc-contract/structured-agent-session-params.tssrc/shared/runtime-capability-constants.tssrc/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.
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
95d27e1a-aad8-425d-9a6f-bdb11c5bdb57
📒 Files selected for processing: 10
src/main/claude/claude-stream-json-connection-close.test.tssrc/main/claude/claude-stream-json-connection.tssrc/main/claude/claude-structured-event-delivery.tssrc/main/claude/claude-structured-session-acquisition.tssrc/main/claude/claude-structured-session-close.tssrc/main/claude/claude-structured-session-test-support.tssrc/main/native-chat/agent-session-wire/structured-agent-session-event-sink-queue.tssrc/main/native-chat/agent-session-wire/structured-agent-session-event-sink.tssrc/main/native-chat/agent-session-wire/structured-agent-session-input-capture.test.tssrc/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.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 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 winRelease retired
wholesnapshots when a turn ends.
remembercan retire a tool without deleting itswholesnapshot.end(turn)only cleans snapshots for tools still inthis.tools. Theturnsmap is also bounded, so it can evict the association beforeend(turn)runs.Store the turn with each
wholesnapshot and cleanwholedirectly. Useentries()becauseBoundedMapis 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
📒 Files selected for processing: 14
mobile/src/session/MobileNativeChatFullContent.test.tsxmobile/src/session/MobileNativeChatFullContent.tsxmobile/src/session/MobileNativeChatOverlay.tsxmobile/src/session/use-mobile-native-chat-message-detail.test.tsxmobile/src/session/use-mobile-native-chat-message-detail.tssrc/main/acp/acp-tool-timeline.tssrc/main/codex/codex-structured-journal-exit-convergence.test.tssrc/main/codex/codex-structured-notification-retry.tssrc/main/jsonl-rpc/timeline-final-tail.test.tssrc/main/native-chat/agent-session-journal/journal-completed-content.test.tssrc/main/native-chat/agent-session-journal/journal-received-content.test.tssrc/main/native-chat/agent-session-wire/agent-session-item-wire-form.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-event-sink-queue.tssrc/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.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟠 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 liftAdd 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
📒 Files selected for processing: 4
src/main/native-chat/agent-session-journal/journal-completed-content.test.tssrc/main/native-chat/agent-session-journal/journal-legacy-import.test.tssrc/main/native-chat/agent-session-timeline/provider-timeline-assembler-test-support.tssrc/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.
|
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 Admitted native Android QA on A fresh run on incoming main Earlier admitted Windows Electron QA at 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 For Brennan’s review Earlier same-input desktop comparison (main 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
…2025/chat-full-payload
…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
…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
…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.






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
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:
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
73f8ba9d20ef4882347b0b9a1ffcd63e77461d83used 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 SHA256a275f757198a61404aa8840a2f7d94e4cdbe5d921263108cb4eb342ba727d474and 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
a201eacd0673a9fb62c5f0f7b5467c06d29d3b54used 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 originalbb39669build 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
a63e3a4d6dfused genuine Codex in a folder workspace. Show full output recovered all 36,436 bytes / 700 rows with matching saved/rendered SHA256d5a77b5f3c2c7c8c0af10e8eba45336ecf566733b1f6051f95aa71a0b252a816; an adjacent ordinary send and recovery after navigation passed. The same reader reopened an earlierdbe2e3c884d8saved chat and recovered its original complete bytes. These are historical writer/reader identities, not an application run on73f8ba9.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 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.
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
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