Skip to content

fix(desktop): reconcile streaming lifecycle and accelerate Markdown updates - #570

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

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

Conversation

@huichen

@huichen huichen commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix first-session binding invalidating a live send's terminal refresh; bind watchdog reconciliation to the exact local send/run rather than the thread's previous terminal run.
  • Reconcile cancellation initiated outside the chat composer, preserve durable success/cancellation after late attach errors, and rebuild safely when a projection reset races an incremental read.
  • Return parsed Markdown ASTs from the worker so live blocks are not reparsed on the UI thread. Preserve stable block identities and bound fallback parsing after worker failures.
  • Incrementally parse append-only single GFM tables: retain completed rows and reparse only the header, mutable last row and new content; fall back to the full parser on shape/context changes.
  • Include reproducible browser benchmarks, raw samples and an impact/limitations report. Worker constructor failures are classified as defensive hardening, not observed production incidents.

Measured impact

Windows Chrome 153 headless, production bundle, identical inputs within each pair, five appended-row samples; initial mount excluded:

Table Formatting-ready median, baseline -> candidate Slowest formatting sample Main-thread push median
54KB / 1000 rows 134.8 -> 13.4ms (-90.1%) 161.5 -> 26.8ms 133.9 -> 2.5ms
109KB / 2000 rows 608.9 -> 24.2ms (-96.0%) 631.2 -> 43.6ms 597.7 -> 5.4ms

This is not native Tauri latency or a claim that every Markdown construct is accelerated. The earlier full-reparse-worker regression is retained in the report rather than hidden.

Details: desktop/DEV_MD/STREAMING_RENDERING_FIXES.md, streaming-rendering-benchmark*.json and desktop/scripts/streaming-markdown-benchmark.html.

Validation

  • Desktop TypeScript and shared Markdown package typechecks passed.
  • Desktop ESLint passed.
  • Desktop full Vitest: 105 files / 909 tests passed after syncing origin/main.
  • Production Vite build and real worker-bundle check passed (DOM-free startup, parsed AST, incremental 500+ row table, finalization).
  • Differential tests compare every partial prefix with the canonical parser, covering CRLF/CR, indentation, escapes, formulas, links/definitions, replacement and table termination.
  • No Rust code changes in this PR. Real OS sleep/network interruption and native Tauri platform matrix remain unverified locally.

@huichen
huichen enabled auto-merge (squash) September 12, 2026 06:55
@huichen
huichen merged commit 11fabb0 into main Sep 12, 2026
12 checks passed
@huichen
huichen deleted the claude/desktop-stream-fixes branch September 12, 2026 06:57
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