Skip to content

Prevent chat renderer hangs on long sessions - #8

Merged
enowdev merged 1 commit into
enowdev:mainfrom
nvdorman:fix/chat-renderer-hang
Aug 1, 2026
Merged

enowdev merged 1 commit into
enowdev:mainfrom
nvdorman:fix/chat-renderer-hang

Conversation

@nvdorman

@nvdorman nvdorman commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • stop re-downloading and re-hydrating the entire transcript on every idle chat attachment poll
  • coalesce text/reasoning deltas in the browser patch queue and group patches per message
  • coalesce replay backlog server-side and expose absolute cursors so reconnects do not replay or duplicate old deltas
  • add frontend regression tests to make check

Root cause

The backend remained healthy while the browser renderer stalled. Idle /chat/attach polls returned done, and each response fetched and rebuilt the full transcript every 1.5 seconds. Reconnects also always used cursor=0, replaying up to 4,000 token-sized events. Long sessions therefore repeatedly discarded memoized message objects and performed thousands of growing-string operations on the main thread.

Verification

  • make check
  • CHROME=/opt/brave-bin/brave make smoke (15 routes clean)
  • isolated runtime against a snapshot of a 131-message / ~205 KiB session: title rendered, 399 DOM nodes, 0 exceptions, transcript detail requests stopped after initial load + sidebar + one race-closing refresh
  • regression: 4,001 retained live-run events replay in 2 frames with correct absolute cursors
  • frontend regression: 4,000 adjacent deltas coalesce to 1 queue item

@enowdev
enowdev merged commit fb58a64 into enowdev:main Aug 1, 2026
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.

2 participants