Repository navigation
Make SQLite the source of truth for native chats - #39256
Merged
Merged
Conversation
One entry (native-chat-4a-comparison.ts) seeds the 55k-history/310-chat profile once through the seed arm, clones it per arm at a fixed path, launches each built checkout in the background with an isolated home, and drives the same stub provider events through the host RPC surface both builds serve. Envelopes come from each arm's own source bundle. Rows cover send/queue, 1/8/16 MiB streams with a competing send, maintenance windows, open/reopen, history/detail, outline/fork, rewind, record operations, R3 retained-history admission and, reported separately, first-launch conversion (optional 20 GiB source). Output is one JSON and one markdown table keyed by both head SHAs.
…le-state wait timed out on
… smoke filler chats for the unopened-chat row
…rk copy's title row
One entry (native-chat-4a-comparison.ts) seeds the 55k-history/310-chat profile once through the seed arm, clones it per arm at a fixed path, launches each built checkout in the background with an isolated home, and drives the same stub provider events through the host RPC surface both builds serve. Envelopes come from each arm's own source bundle. Rows cover send/queue, 1/8/16 MiB streams with a competing send, maintenance windows, open/reopen, history/detail, outline/fork, rewind, record operations, R3 retained-history admission and, reported separately, first-launch conversion (optional 20 GiB source). Output is one JSON and one markdown table keyed by both head SHAs.
…le-state wait timed out on
… smoke filler chats for the unopened-chat row
…rk copy's title row
This was referenced Nov 15, 2026
Open
10 of 11 tasks
9 of 11 tasks
8 of 11 tasks
Merged
10 of 11 tasks
Closed
7 of 9 tasks
nwparker
added a commit
that referenced
this pull request
Nov 16, 2026
…orkers Since #39256 (first shipped in v1.4.260) a release's test journal opener spawns its SQL writer and reader from a bundle its worker-bundle fixture builds in a module-scope beforeAll. The harness imports release modules mid-test, so that hook never runs and the opener passes bare file names to new Worker (ERR_WORKER_PATH). Such releases also read a chat back asynchronously rather than through journal.snapshot(). Bundle the release's own SQL worker entries and stand them in for its fixture, and read each release's chat through its own reads.
11 tasks done
This was referenced Nov 16, 2026
Merged
Closed
This was referenced Nov 21, 2026
13 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #39221, which is folded into this PR so the whole change is reviewed and merged as one. Addresses native chat history growing to 20 GiB (STA-13374, tracked in #37802).
Problem and change
Native chats rebuild their whole history from an append-only journal and retain it in memory. Large histories become slow to open, and the journal keeps growing. This PR makes
agent-session-domain.dbthe source of truth: one background writer commits changes, and reader workers serve history pages, outlines and individual records. Database work stays off the Electron main thread.Existing chats convert while Orca is idle, or in the existing loading state when first opened. Sending, streaming, reopening and forking use the converted history. There is no new notice or control. The send/reconnect fix also prevents a message from remaining on “Sending…” after the agent has accepted it.
After every chat is proven converted, Orca waits seven days of time the app is open and a later launch before deleting the original journal and its empty companion files. If the original file changed or cannot safely be removed, it is kept. Background maintenance yields while chats are active.
Disclosures
config/main-blocking-sqlite-baseline.txtandconfig/main-sync-fs-baseline.txtare raised for worker-only code. These entries do not permit database or filesystem blocking on the Electron main thread.Performance measurements
The send repair was measured in Node with one synthetic chat. These are database acknowledgements and frame publication, with p50 values below; provider response time and Electron delivery time are outside the measurement.
Uncontended publication was 1.74× before (95% interval 1.61–1.83). Streaming acknowledgement p95 with one subscriber was 1.20× before (95% interval 1.08–2.84; tail estimates are less precise). These measured costs were accepted for the correctness repair.
The startup comparison used 20 saved chats × 30 turns, 16 paired rounds on a busy host. Values are branch-minus-base paired medians with 95% bootstrap intervals, measured from the headless server’s first startup phase mark (excluding process and bundle load). Watcher readiness is the first filesystem-watcher subscription reporting ready.
Validation
The final independent Claude/Codex reviews are complete. Head CI passed (82 successful checks, 19 skipped), with node/web typechecks, compatibility tests and static checks. Real Windows x64 Claude/Codex runs passed upgrade, history preservation, streaming, Stop followed by a new reply, send/reconnect, restart, and journal removal followed by another restart. Seven days of open time were simulated by seeded credit. The review status comment records screenshots, baseline behavior and limits, including the invalid TODO-strip scenario and one driver identity-check freshness gap. A targeted real Pi run also passed upgrade, restart, history/tool-row preservation and two new replies after each step, using the machine’s existing OpenAI sign-in and GPT-5.6 Sol. Main has moved since preparation and GitHub currently reports a merge conflict; the reviewed head is preserved for review.