Repository navigation
perf(native-chat): flush send transactions without flushing every streamed revision - #28966
Conversation
|
Saving every streamed reply update used to force a disk flush on Orca’s main thread, delaying the app on slow or busy disks. This change reduces that blocking for revisions of existing reply text while sends, approvals, Stop and other actions keep their existing save guarantees. The review loop finished on Accepted limit: after an operating-system crash or power loss on the machine running the agent, recent reply text can be missing from the saved chat. A second device that stayed connected can keep extra text or miss the recovered ending until the chat is reopened. There is no new time limit on possible text loss. An app crash or force-quit preserves committed updates. Intended difference from the common pattern: Orca keeps the strongest save setting, FULL, for sends and control facts. Thinking updates, tools, first saves and existing checkpoint pauses retain their current cost. Windows high spec (native Node 24, Samsung NVMe) compared main
Total production append time improved 88.1–91.1% by mean. These tight-loop measurements on a shared machine do not measure visible UI latency. Send, pending dispatch and pending/resolved approval controls all remained FULL; streamed revision controls used FULL on main and the lighter setting, NORMAL, here. Both targeted files passed, 87 tests. All 125 evidence hashes and eight timing/control cells were verified after collection. The full PR workflow passed on this exact head, including its PR checks passed aggregate, all five test shards, Windows packaging and cross-version compatibility. Main was merged once after review fixes. The PR is out of draft, has no unresolved review threads, and GitHub reports CLEAN. Real signed-in Claude Electron QA passed on M4Air, with Codex driving hidden renderers after Grok was unavailable. The same main/final prompts covered streaming, sending while streaming, an actual Write approval, Stop, restart, setup/default tabs and a plain folder workspace. No functional difference was observed in those flows. Main retained all 69 saved rows unchanged across restart; final retained all 72. The final app recorded 30 lighter reply-text saves and 53 FULL saves; all 80 observed main saves were FULL. These counts are evidence from this Claude run, not a prediction for other agents or workloads. Test isolation kept real Claude settings and Codex hook hashes unchanged. All recorded test apps and transfer processes exited; both remote worktrees and this run’s scratch profiles were removed after evidence collection. One initial final-head launch incorrectly continued at load 55.26 because the scratch preflight only printed resources; it was stopped before any final flow and contributed no saved rows. A rejecting guard was added before the valid launch (load 11.42, 64% memory free) and restart (5.96, 48% free). Preparation notices and existing naming/notification warnings were recorded; no unrelated source change was made. No open blocking review finding remains. Deferred: performance of thinking updates and periodic database flushes, plus measuring how often real Codex output qualifies for the lighter save setting. These keep their existing behavior. Not measured: power loss, real Codex eligible-save fraction, reasoning-heavy or many-block workloads, or Linux timing. The shared Linux box had memory headroom but no prepared dependencies for one light run; no installation or timing job was added. Thinking and checkpoint performance are unchanged and remain outside this change. For Brennan’s review Whole-window main/final comparisons. Generated wording and elapsed labels differ naturally; the final run also shows an existing education prompt in some frames.
Judgment points:
|
…ant text Every chat-journal commit ran a full fsync on the main thread. Replace the earlier allowlist of FULL rows (which missed control facts riding generic rows) with the inverse: FULL stays the default, and a transaction commits at NORMAL only when every row is a later revision of an assistant message that changes nothing but its content. An OS crash can lose only that streamed text; the next FULL commit makes it durable.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
19ba9cfa-eb16-48f9-a922-f70334c83ef1
📒 Files selected for processing: 5
src/main/native-chat/agent-session-journal/journal-host-database.tssrc/main/native-chat/agent-session-journal/journal-row-writer.tssrc/main/native-chat/agent-session-journal/journal-store-collaborators.tssrc/main/native-chat/agent-session-journal/journal-streamed-text-revision.test.tssrc/main/native-chat/agent-session-journal/journal-streamed-text-revision.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 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:
94d52911-df91-4812-9b2b-1eb716a1b683
📒 Files selected for processing: 3
src/main/native-chat/agent-session-journal/journal-store-collaborators.tssrc/main/native-chat/agent-session-journal/journal-streamed-text-revision.test.tssrc/main/native-chat/agent-session-journal/journal-streamed-text-revision.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
main's #28966 lets a journal transaction commit streamed rows without the per-commit fsync; this PR's background writes ride the same transaction. The two are one options object (`{ background?, streamed? }`), so a background streamed write is both.


















ELI5
Every saved update to a streamed reply currently forces a disk flush on Orca’s main thread. On a slow or busy disk, that work delays the app while the agent is writing. This change lets existing reply text update with less main-thread blocking. Sends, approvals, Stop and other actions keep their existing protection against a crash.
What Changed
The chat database keeps SQLite’s strongest save setting, FULL, by default. A save uses NORMAL only to revise existing assistant reply text, with text-only content both before and after the change. Changing who owns the reply, which turn or agent it belongs to, or saving an action alongside it keeps the strongest setting. The next FULL save also makes earlier reply text durable. No saved format or message exchanged between devices changes.
Accepted crash case: after an operating-system crash or power loss on the machine running the agent, recent reply text can be missing from the saved chat. A second device that stayed connected can keep that extra text or miss the turn’s recovered ending until the chat is reopened. There is no new time limit on how much text can be lost. An app crash or force-quit preserves committed updates.
Why
The same flush policy previously covered both replaceable reply text and actions that must be saved before an agent acts. Keeping the strong setting by default and allowing only verified text updates to use the lighter setting reduces repeated flushes without another queue, background process or recovery mechanism.
The common pattern uses NORMAL for every save. Intended difference: Orca keeps the strongest setting for sends, approvals, Stop and other actions, preserving their current guarantees. Intended scope limit: first saves, thinking updates, images and tools keep their existing flushes, and existing periodic database flushes stay as before. This change reduces one source of disk stalls. The existing crash-recovery mechanism remains in use.
Linked Issue
Maintainer work from the native-chat performance investigation; no separate issue.
Visual Proof
Main-versus-final signed-in Claude Electron screenshots on M4Air are attached to the review status comment: streamed reply, send while streaming, approval, Stop, restart and a folder workspace. Codex drove the hidden app after Grok was unavailable.
Testing
c527fefe8a2, including thePR checks passedaggregate.Linux timing was not run: the shared Linux box had memory available but no prepared checkout and dependencies for one light job. No power-loss test or real Codex eligibility measurement is claimed.
Review
The journal runs on the machine executing the agent, including SSH hosts. Folder workspaces use the same implementation. Existing clients and servers exchange unchanged saved rows and messages. The accepted crash case for a paired device is described above. Replies with much thinking and pauses during periodic database flushes can retain their current cost.
Agent skill upstream boundary
Notes
Author: @BrennanKB5
Checklist