Skip to content

fix: terminal content duplication on WebSocket reconnect (v0.35.50)#382

Merged
jpelaez-23blocks merged 1 commit into
mainfrom
fix/terminal-reconnect-duplication-v0.35.50
Jun 4, 2026
Merged

fix: terminal content duplication on WebSocket reconnect (v0.35.50)#382
jpelaez-23blocks merged 1 commit into
mainfrom
fix/terminal-reconnect-duplication-v0.35.50

Conversation

@jpelaez-23blocks
Copy link
Copy Markdown
Contributor

Summary

  • Terminal reconnect fix: Clear terminal buffer on WebSocket reconnect before fresh history arrives. Prevents content duplication that made high-output agents (jarvis) unusable — history was appended on top of existing content every 30-40s.
  • Chat paste-probe delivery: sendChatMessage() uses tmux buffer paste with poll-based verification instead of send-keys -l. Blocks sending at permission prompts.
  • Chat sending vs thinking state: "Sending..." (blue) and "Thinking..." (amber) are now distinct activity states in both desktop and mobile chat views.
  • Tab validation: localStorage active tab validated against known tabs on load, preventing blank content from stale values.

Root Cause (Terminal)

When a WebSocket disconnects (heartbeat timeout, network blip), the server sends 5000 lines of tmux capture-pane history on reconnect. The client never cleared the terminal buffer first — history was appended to existing content. For jarvis (Claude Opus thinking animation producing dense ANSI output), this caused a full visual re-render every ~35 seconds.

Test plan

  • Open jarvis terminal — should no longer duplicate content on reconnect
  • Disconnect network briefly, reconnect — terminal shows clean history without duplication
  • Chat: send message while agent is at permission prompt — should show error
  • Chat: send message — should show "Sending..." then "Thinking..."
  • Remove aimaestro-active-tab from localStorage, set to invalid value, reload — should default to chat

🤖 Generated with Claude Code

When a WebSocket disconnected and reconnected, the server sent 5000 lines
of tmux history that was appended to the existing terminal buffer, causing
visible content duplication every reconnect cycle. For high-output agents
like jarvis (Claude Opus thinking animation), this created a devastating
re-render every 30-40 seconds. Now clears the terminal buffer on reconnect
before fresh history arrives.

Also includes: chat paste-probe delivery, sending/thinking state split,
and tab validation on localStorage restore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jpelaez-23blocks jpelaez-23blocks merged commit 1bfdc99 into main Jun 4, 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.

1 participant