Skip to content

Engine: keep 12 chats' documents warm again (fixes switch freezes and skeletons in 0.3.8) - #1508

Merged
wingleeio merged 1 commit into
mainfrom
zeron/warm-docs-12
Nov 18, 2026
Merged

wingleeio merged 1 commit into
mainfrom
zeron/warm-docs-12

Conversation

@wingleeio

@wingleeio wingleeio commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Reverts the cap from #1500 (3 → 12).

Why: in 0.3.8, opening any chat other than the last three makes the engine reopen its document from SQLite. Real chat documents are big. Wing's recent ones are 4–80 MB, with up to 24M operations. Reopening reads the whole state:

Document import state read cold open (M5 Max)
15 MB, 3.3M ops 5 ms 40 ms ~45 ms
80 MB, 24M ops 26 ms 252 ms ~280 ms

That's the 50–100 ms switch freeze, and the skeleton once it passes 400 ms (sooner on an M1, which is ~2.5× slower). #1500's measurement used small mock chats and missed it.

The real fix is making reopening cheap regardless of how many documents are kept (compacting chat history). This restores 0.3.7's behaviour until then.

Engine doc_host tests: 81 passed.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

0.3.8 kept 3, and switching among more chats froze for 50-100 ms or showed
a skeleton: a real chat's document is 15-80 MB, and reopening one from its
snapshot reads its whole state (45 ms for 15 MB, 280 ms for 80 MB on an
M5 Max; the M1 is about 2.5x that). The 3-doc measurement used small mock
chats and missed it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wingleeio
wingleeio merged commit 4e86e6b into main Nov 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant