Skip to content

fix(desktop): restore Markdown workers and prevent streaming parse starvation - #564

Merged
huichen merged 2 commits into
mainfrom
claude/desktop-stream-lag
Sep 12, 2026
Merged

huichen merged 2 commits into
mainfrom
claude/desktop-stream-lag

Conversation

@huichen

@huichen huichen commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix production Markdown worker startup: Vite selected the DOM-only decode-named-character-reference browser export, which throws document is not defined in workers and silently moves all parsing back to the UI thread after three failures.
  • Accept useful prefix-compatible worker results even when they trail the latest text, preventing streaming block starvation under sustained input.
  • Reset the busy flag when StrictMode tears down a worker so its replacement can actually start work.
  • Add hook regressions and a DOM-free smoke test of the actual production worker bundle, automatically run by npm run build.

Reproduction evidence

  • The original production bundle fails the new startup check; the fixed bundle passes.
  • Controlled Chrome test with 54,816 characters and worker delivery two input ticks behind: latest-only acceptance leaves one 54,816-character mutable block; prefix acceptance advances to 116 blocks with a 2,290-character mutable tail. Both preserve exact content.
  • Read-only inspection of recent DeepSeek runs did not establish buffer overflow. This is a frontend mechanism reproduction, not a claim that all native WebView2/model end-to-end latency is resolved.
  • Details: docs/verification/desktop-stream-lag-20260912.md.

Validation

  • Synced with origin/main immediately before push
  • Desktop ESLint and TypeScript (npm run lint)
  • Full desktop Vitest suite: 101 files, 873 tests
  • Production build and actual worker startup/parsing smoke check
  • Regression tests fail on the old behavior and pass with the fix
  • Installed native desktop + live DeepSeek follow-up (existing agent/desktop were not replaced)

No Rust implementation changes or buffer-size changes.

@huichen
huichen enabled auto-merge (squash) September 12, 2026 03:58
@huichen
huichen merged commit 84fb84a into main Sep 12, 2026
12 checks passed
@huichen
huichen deleted the claude/desktop-stream-lag branch September 12, 2026 04:00
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