Skip to content

perf(web): defer draft saves and preserve reloaded annotations - #330

Merged
rynfar merged 2 commits into
pylonfrom
upstream/2026-09-06-deferred-composer-save
Sep 6, 2026
Merged

perf(web): defer draft saves and preserve reloaded annotations#330
rynfar merged 2 commits into
pylonfrom
upstream/2026-09-06-deferred-composer-save

Conversation

@rynfar

@rynfar rynfar commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

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.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

t3dotgg and others added 2 commits September 6, 2026 11:41
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)
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Sep 6, 2026
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.6 KiB 13.8 KiB +177 B (+1.3%) 15.1 KiB
Codex Thread snapshot wire 7.1 KiB 7.1 KiB −8 B (−0.1%) 7.3 KiB
Codex Live turn WebSocket wire 6.5 KiB 6.7 KiB +185 B (+2.8%) 7.8 KiB
Codex Live turn WebSocket decoded 56.5 KiB 57.4 KiB +910 B (+1.6%) 66.4 KiB
Codex Live turn messages 8 10 +2 (+25.0%) 21
Claude Total thread wire 13.7 KiB 13.8 KiB +151 B (+1.1%) 15.1 KiB
Claude Thread snapshot wire 7.1 KiB 7.1 KiB −4 B (−0.1%) 7.3 KiB
Claude Live turn WebSocket wire 6.6 KiB 6.7 KiB +155 B (+2.3%) 7.8 KiB
Claude Live turn WebSocket decoded 57.4 KiB 58.2 KiB +884 B (+1.5%) 66.4 KiB
Claude Live turn messages 9 10 +1 (+11.1%) 21

Baseline: 3e87857 · PR result: 7082702 · Source CI: success

Scenario and decoded snapshot size

10 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.

  • Codex decoded thread snapshot: 111.2 KiB
  • Claude decoded thread snapshot: 111.9 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@rynfar
rynfar merged commit ce92b37 into pylon Sep 6, 2026
17 checks passed
@rynfar
rynfar deleted the upstream/2026-09-06-deferred-composer-save branch September 6, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants