Repository navigation
fix(ai-vault): re-read a transcript rewritten to its previous size - #20261
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe change adds Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Transcript rewrites are reread from the beginning, while normal append parsing remains incremental. No actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description is mostly complete and explains the fix, rationale, tests, scope, and checklist status. However, the required Linked Issue section contains N/A, while the template requires an issue link.
✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Same-size rewrite detection —
readResumableTranscriptrecords the observedmtimeMsand full filesizeByteson the in-memory resume point and declines to resume when the timestamp moved but the file did not grow past its previously observed size, forcing a whole-filereplace. - Separate size from consumed offset — storing full file size alongside
byteOffsetis what keeps the guard correct when the prior read ended on a trailing partial line (byteOffset < sizeBytes); comparing tobyteOffsetalone would misread the rewrite as growth. - Regression coverage — a parameterized
rewrite/truncate then regrowtest asserts a same-size rewrite re-reads from zero and publishes the replacement text, and the existing append test now advances mtime explicitly.
I verified the new test is not theatre: reverting only the guard makes both cases fail with expected 'append' to be 'replace', and the full src/main/ai-vault suite (122 files, 1056 tests) plus check:code-quality:changed pass. The remote/SSH cache is unaffected — its reuse already requires mtimeMs equality and size equality, so it reparses on any mtime change.
openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

ELI5
If a transcript is replaced with different text of exactly the same length, Orca now reads the new text instead of keeping the old sidebar preview and search content.
What Changed
Record the observed mtime and file size in the in-memory resume point. Resume only when mtime has not moved backward and the existing size/newline checks pass; a changed mtime also requires growth beyond the previously observed size. Recording file size separately from the consumed offset covers unfinished final lines.
Why
A same-size rewrite can leave the old cursor at EOF immediately after a newline. The old guard accepted that cursor and published an empty append. Checking only
mtime >= previous mtimewould still accept a newer same-size rewrite, so growth is required when mtime changes. Normal appends retain incremental parsing.Linked Issue
N/A: standalone fix requested in the supplied reader bug brief; no issue number supplied.
Visual Proof
N/A: reader logic
Testing
On macOS, using only temporary synthetic transcripts and
ORCA_BACKGROUND_LAUNCH=1:replace, receivedappend.pnpm tcpnpm test src/main/ai-vaultpnpm run check:code-quality:changedpnpm run check:react-doctor:changedAI Disclosure
Review
Self-reviewed the resume guard, cache producer, native/WSL stat discovery, and separate SSH parse cache.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Native and WSL reader candidates already require mtime; no missing-mtime fallback is needed. SSH uses a separate mtime/size cache and reparses changed transcripts. Resume points are in-memory only, so there is no persisted or remote wire format change. Folder workspaces and git worktrees use the same reader.
As before, a rewrite preserving both mtime and size cannot be detected by these stats, and a growing rewrite retaining the old newline boundary can resemble an append. Linux, Windows, WSL, and SSH were not exercised live.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Local checks are the four scoped gates above; CI covers full lint, the remaining tests, and build.