perf(web): defer draft saves and preserve reloaded annotations - #330
Merged
Conversation
Defer the draft walk and JSON serialization until the storage write flushes. Preserve hydration, migrations, attachment verification, and final flushes. Continues the web portion of [#9049](pingdotgg/t3code#9049). The mobile storage migration remains separate. Created with GPT-6 Astra (preview) in Codex. Co-authored-by: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> (cherry picked from commit dab5f6e6e02e78675655e69503aa89654e5b8050)
Contributor
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
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.
Typing in one composer serialized every saved draft and attachment before the storage debounce ran. Draft reload also dropped preview annotations, despite writing them to storage.
Adopt upstream #9695 (
dab5f6e6e02e78675655e69503aa89654e5b8050) to defer the draft walk and serialization until the save flushes. Preserve Pylon’s version-10 draft schema, explicit provider choices, binding-conflict barrier and synchronous flush before navigation. Restore valid preview annotations during normalization and retain annotation-only drafts.Pylon’s two existing conflict-recovery tests accidentally read current memory. They now flush storage, clear memory and rehydrate. That stronger check exposed the annotation loss and fails without the normalization fix. A new case covers annotation-only drafts and malformed saved annotations.
Validation: all 107 composer tests, web typecheck, changed-file lint and formatting passed. Tests cover deferred serialization, canceled saves, final flushes, legacy migration, attachments, citations, provider conflicts and complete draft transfers. No stored-version change or mobile persistence change. Rendering and debounce duration are unchanged; no browser performance benchmark is claimed.
Model: GPT-6 Astra. Harness: Codex.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.