You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A reboot no longer makes Orca re-read the old chat journal - #44208
Tracked in #42783. Narrowed from #43442 to the part that helps people who never downgrade.
Problem
On launch, Orca checks whether the old chat journal (agent-session-journal.db) changed since the new store last read it. If the check says "changed", the writer re-reads every chat in the old journal before chats are ready: tabs, claims and a revision comparison per chat. Two parts of that check were wrong:
It compared the volume's device number. That number can change across a reboot or remount while the file stays the same (same inode, size and times), so a launch after one re-ran the whole pass for nothing.
A receipt saved by early internal builds recorded a nonempty WAL by its size alone. Reused WAL frames keep the size after a write, so that receipt could call a changed journal unchanged.
User-facing change
No visible change. After a reboot, startup no longer repeats the old-journal pass, which on large profiles delays the moment saved chats appear. Profiles that still hold a size-only WAL receipt (Nov 14-15 internal builds) run the pass once, and its success saves a full receipt.
How
sameJournalLegacySource ignores main.dev on both sides when the file's times have a sub-second part, and compares the WAL exactly as recorded, so a size-only WAL receipt is no longer taken as proof. Nothing else changes: the inode, size and both times still have to match.
Known limits
A different file with every other fact the same: the device number is ignored only when both times have a sub-second part. On filesystems with whole-second times (FAT, HFS+), a same-sized file on another volume could share the inode and both times, so a device change there still means a re-read, as before. With nanosecond times, a different file would have to match the inode, size and both nanosecond times.
The one extra pass on internal stores: a size-only WAL receipt exists only in stores whose last launch was a Nov 14-15 internal build. Any later launch that finished a pass already saved a full receipt. For such a store, this build runs the full pass once. That pass also takes in the old journal's attachment claims, so a claim released here can come back and keep that upload until its chat is gone. A converted chat rewound since the copy can get one copy.
Verification
journal-legacy-source.test.ts: a receipt with a different device number matches, unless the times are whole seconds; a size-only WAL receipt does not.
Typecheck, lint and tests: CI on this head stood in for the usual off-CI remote-check, because the Linux check machine was down.
…journal
The receipt that proves the old journal unchanged compared the volume's device number, which can change at reboot or remount, so the full older-Orca pass ran again. It also accepted a receipt that recorded a nonempty WAL by size alone, which reused WAL frames can keep after a write.
…l WAL receipt
A receipt with its WAL identity stripped is now a reason to read, so the contract keeps the identity and drops only the baselines. The WAL check starts from the current receipt so it tests the WAL alone.
No actionable comments were generated in the recent review.
Walkthrough
The receipt comparison ignores the main file’s device number. It compares WAL receipts exactly, including identity fields. The test checks that a changed main-file device number still matches and that a size-only receipt for a nonempty WAL does not match.
Merge Risk: Low · up to 23286
Device-number changes after a reboot no longer trigger a re-read of the legacy chat journal. Stores last launched on the Nov. 14-15 internal build will run one extra pass, which could restore removed attachment claims. The scope is narrow and the effect self-limits, so the merge risk is low.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title states the main change: a reboot no longer makes Orca re-read the old chat journal. The changeset ignores main.dev in sameJournalLegacySource and compares the WAL exactly, which targets that…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description follows the repository template closely. It covers the problem, the user-facing change, the mechanism, known limits, and verification. Its section headings differ from the template: it…
Full details: Title check
Explanation
The title states the main change: a reboot no longer makes Orca re-read the old chat journal. The changeset ignores main.dev in sameJournalLegacySource and compares the WAL exactly, which targets that re-read after reboot. The title is specific and matches the objectives.
Full details: Description check
Explanation
The description follows the repository template closely. It covers the problem, the user-facing change, the mechanism, known limits, and verification. Its section headings differ from the template: it uses Problem, User-facing change, How, Known limits, and Verification instead of ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Risk, AI Disclosure, Review, Notes, and Checklist. It lacks several template sections: ELI5, a formal Linked Issue (it cites #42783 as tracking, and the template requires a 'Fixes #' link), Visual Proof (the change has no UI change, so it should say N/A with a reason), a Risk section with a level and back-out plan, the Testing checkboxes, and the Agent skill upstream boundary checkbox. The Known limits section covers part of the risk, and the Testing section partially covers verification, but neither follows the template's format. The description is mostly complete on substance, so the status is PASS with no remediation strictly required; the missing headings are noted for the author.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
…cond times
With whole-second times (FAT, HFS+), a same-sized file on another volume can share the inode and both times, so a device change there still means a re-read.
Verdict: clean. No P0/P1. The PR changes only the receipt comparison. The comparison's own cost stays constant. Two populations change path: one does a single full walk and then settles, the other no longer walks after every reboot.
Census
Work
Trigger
Population
Bound
Price (10k / 100k chats)
sameJournalLegacySource: one more JSON.parse/sameJson over a ~6-field receipt, BigInt % 1e9 on 2 times
every launch where the old journal still exists, called twice in reconcileJournalLegacySource (pre-check and post-check), writer worker
1 per store
constant, independent of chat count
~µs / ~µs
Newly triggered full walk (absorbChats(walk=true)): readAdoption(null) scans source claims, source tabs and this file's tabs (O(N)); per chat 3 indexed point reads (journalLegacyChatRevision) + 1 readMeta, all statements cached
next launch, only for stores whose saved receipt predates WAL identity (#42783) and recorded a nonempty WAL, and that never launched a build from #42783 to #43007.
est. ~0.1–0.3 s / ~1–3 s on the writer worker, once, before chats are ready (estimate)
Removed repeat walk: a device-number change at reboot/remount no longer fails the match when both main-file times have sub-second precision
each launch after a dev change
stores on volumes whose dev is unstable
O(N) walk per reboot becomes 0
saves the row above on every reboot
Settles: yes. After the walk, captured (new shape, with WAL ino/mtimeNs) is written as the receipt when the pass completes and the post-check matches. The next launch takes unchanged && kept && forced.size === 0 and returns after 2 statSync + 3 meta reads. It walks again only where base already did: storage failure, an older Orca writing mid-pass, or a dev change on whole-second times.
Installed base on next launch:
New-shape receipt, same dev: same as base (skip).
New-shape receipt, dev changed, sub-second times: base walks, PR skips.
New-shape receipt, dev changed, whole-second times: walks, same as base.
Old-shape receipt with empty WAL: same as base (skip).
Old-shape receipt with nonempty WAL: base skips, PR walks once (above), then skips.
No old journal: returns early, same as base.
Regression classes
Re-reading unchanged input: matched. Disproved: the walk is gated by the receipt, runs once per legacy store, and its completion rewrites the gate. Overall the PR removes repeat walks.
Eager startup imports: no new imports.
Sync fs/SQLite on Electron main: not applicable. Runs on the writer worker (initializeJournalDomainDatabase). No new sync calls are added.
Six questions: (1) constant work before the gate; (2) one pass per store, no new owners; (3) writer worker, indexed reads; (4) one-time O(chats) walk that settles; (5) dev stability varies by filesystem, not exercised on Windows/Linux; (6) synchronous bounded pass, nothing abandoned.
Limits: static review only; timings are estimates from query counts.
Problem. On launch, Orca checks a saved receipt to see whether the old chat journal changed since the new store last read it. The receipt compared the volume's device number, which can change across a reboot or remount while the file stays the same. When it changed, the writer re-read every chat in the old journal before chats were ready. The receipt also accepted a nonempty WAL recorded by size alone, which can stay the same size after a write.
User-facing change. None visible. After a reboot or remount, startup no longer repeats the old-journal pass. Stores that still hold a size-only WAL receipt run the pass once, then save a full receipt.
Narrowed from #43442 (closed): only the part that helps people who never downgrade.
Reviews.
First pass: Codex said NOT READY and listed four findings.
Its cross-volume finding (a different journal on another volume could match the inode, size and both times) was fixed in 88a28ac: the device number is ignored only when both times have a sub-second part, so whole-second filesystems (FAT, HFS+) still re-read after a device change.
Final pass: a fresh Claude reviewer (READY) and a fresh Codex reviewer (NOT READY on the cross-volume case, now fixed) read the whole PR at 232867e.
Repair check: a fresh pair on 88a28ac said READY. Both checked that the reviewer's failing input now reads as changed and that nanosecond-time volumes still skip the pass.
Deferred (P2, documented in the PR body): a store with a size-only WAL receipt takes one full pass, and that pass re-inserts the old journal's attachment claims, so a claim released here can keep its upload until the chat is gone. No desktop release wrote that receipt shape (only Nov 14-15 internal commits), so it reaches only internal profiles last opened by those builds.
Reference comparison: comparable file-identity checks in the reference apps are held in memory only, and some leave the device number out as well. This receipt persists across reboots, so it can't rely on the device number.
Perf. A full perf-scan by a fresh reviewer on 88a28ac is clean (comment above).
Before/after on the M4Air, 4,823-chat v1.4.259 journal converted by main, caps of 12 min app runtime per arm. Arms: main 06dece4 vs PR 232867e (before the whole-second repair; APFS times are nanosecond, so the repaired branch doesn't apply there).
Device-number change only: main re-ran the full pass and rewrote the receipt (2/2); the PR took the early return (2/2).
Size-only WAL receipt: main skipped the pass; the PR ran it once and saved the full WAL identity.
Counts: records, tabs and chat state were 4,823/4,823/4,823 with 0 claims in every launch. The session and title hashes were identical everywhere, and there were no new chats or copies.
Time to chats (28-33 s) showed no difference at this scale; the renderer dominates it.
Checks. remote-check passed on 88a28ac (27 checks); GitHub Actions is blocked org-wide, so CI hasn't run on this head yet. It passed on 232867e; its only failure there was the non-required WSL2 distro (debian-12) job, in the unrelated wsl-orcad-real-distro-idle-release-lane.test.ts.
Closing. A design council ruled that the device number check stays strict, because the receipt persists across reboots and ignoring the device number can let a different file on another volume pass as unchanged. Without that, all that remains is rejecting a WAL recorded by size alone, and no release ever wrote that receipt shape. On the M4Air, the every-reboot gain wasn't measurable at 4,823 chats (chats listed after 28-33 s on both main and this branch). Main's behavior stays as it is. The branch is kept.
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
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.
Tracked in #42783. Narrowed from #43442 to the part that helps people who never downgrade.
Problem
On launch, Orca checks whether the old chat journal (
agent-session-journal.db) changed since the new store last read it. If the check says "changed", the writer re-reads every chat in the old journal before chats are ready: tabs, claims and a revision comparison per chat. Two parts of that check were wrong:User-facing change
No visible change. After a reboot, startup no longer repeats the old-journal pass, which on large profiles delays the moment saved chats appear. Profiles that still hold a size-only WAL receipt (Nov 14-15 internal builds) run the pass once, and its success saves a full receipt.
How
sameJournalLegacySourceignoresmain.devon both sides when the file's times have a sub-second part, and compares the WAL exactly as recorded, so a size-only WAL receipt is no longer taken as proof. Nothing else changes: the inode, size and both times still have to match.Known limits
Verification
journal-legacy-source.test.ts: a receipt with a different device number matches, unless the times are whole seconds; a size-only WAL receipt does not.remote-check, because the Linux check machine was down.