Skip to content

fix(server): typing lag over TCP in client/server mode - #3433

Open
meowgorithm wants to merge 2 commits into
mainfrom
slow-typing
Open

fix(server): typing lag over TCP in client/server mode#3433
meowgorithm wants to merge 2 commits into
mainfrom
slow-typing

Conversation

@meowgorithm

Copy link
Copy Markdown
Member

Oof. When crush is run in client/server mode, and the server was remote over TCP, typing became unbearably slow. This is because all sorts of Bubble Tea events were hitting the server…synchronously.

This revision fixes the behavior and a bunch of other associated behavior like this. Typing will now happens on the client, and does not ping the server.

Workspace probes (agent state, LSP states, diagnostics) were running
synchronously on every render frame. In client mode each probe is an
HTTP round-trip, so typing became unusably slow. Cache this state
off-thread and read from the cache during render.

The sidebar, landing view, and compact header each probed
independently, so a single frame could trigger 3+N round-trips
(N = number of LSP servers). Over TCP that compounded quickly.

💘 Generated with Crush
Follow-up to the typing-lag fix: the "rebuild then invalidate the
memoized model" edge lived at four UpdateAgentModel call sites by
convention, and the MCP state-change handler had already missed it.
updateAgentModelCmd now owns the sequencing so the edge can't be
forgotten; handleStateChanged routes through it too.

Also document the constructor's synchronous cache seed in the
workspace_cache header comment and justify the 5s LSP TTL against the
500ms busy TTL.
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