perf(parser): incremental parse of append-grown session files#749
Merged
Conversation
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.
CLI half of the desktop-slowness fix: the session cache computed an incremental resume offset for append-grown files (
reconcileFile→action: 'appended'), but the parser ignored it and re-parsed from byte 0 — so machines with live agents constantly appending to session JSONL paid a full re-parse of those files on every warm run.msg.id, or the re-read torn line) collapse to the last occurrence keeping the first timestamp (mergeBoundaryCalls, mirroringdedupeStreamingMessageIds), scan-wide dedup keys are re-seeded so cross-file dedup is unchanged.reconcileFile: never resume past current EOF (truncate-then-regrow falls back to a full re-parse).Verified: new integration suite proves the incremental result deep-equals a cold full re-parse (incl. torn-line, inode-change, and offset-beyond-EOF cases) and that the offset path actually activates; full root suite 2178 passed. Real-data check on a 21MB live session file: incremental output byte-identical to cold parse; append-between-runs costs ~0ms extra vs a measurable re-parse penalty before.