Skip to content

[FIX] Freezing on CPU loads - #10

Merged
redrick merged 1 commit into
mainfrom
fix/performance
Nov 25, 2026
Merged

redrick merged 1 commit into
mainfrom
fix/performance

Conversation

@redrick

@redrick redrick commented Nov 25, 2026

Copy link
Copy Markdown
Owner

margin-gui froze (no clicks, no scrolling) while the agent was writing output and the machine was busy.

Cause: every Wails event runs JS on the GTK UI thread, and Wails v3 keeps draining its event queue until it's empty. We emitted one agent:data event per PTY read, so a busy agent kept the queue full faster than the UI thread could empty it.

Fix: batch agent output and send it at most every 33ms. The first output after a pause still goes out immediately, so typing echoes right away. Reading from the agent pauses while 1 MiB is waiting to be sent, so memory stays bounded.

Tests: new coalesce tests cover batching, immediate first output and reading pausing; they pass under -race. The full suite passes.

@redrick
redrick merged commit 92e8241 into main Nov 25, 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