[Bug]: Agent TUI redraws can block remote runtime RPCs
- Dominant language
- TypeScript
- Stars
- 69.7k
- Forks
- 4.5k
- Avg merge
- 15h 28m
- Merged PRs (30d)
- 471
Description
### Operating system
Linux
### Orca version
1.4.180
### Details
Short summary:
Agent TUI redraws can make the remote runtime stop answering RPCs while TCP remains healthy.
What happened?
A Linux remote runtime repeatedly appeared offline and reconnected. During an affected session:
- ping and TCP connections to the runtime succeeded continuously
- `orca status` timed out repeatedly
- Electron's main process used one full core
- a CPU profile attributed 86.8% of samples to retained terminal-row finalization
The observed redraw row contained about 4,001 internal spaces followed by status text. The finalizer used `/[ \t]+$/g` to remove trailing whitespace. When internal whitespace is followed by text, this end-anchored regex repeatedly rescans the run before rejecting it.
How can we reproduce it?
1. Run an agent TUI that redraws a status line about 36 times per second.
2. Emit a retained partial row containing about 4,000 spaces followed by text.
3. Process each redraw through retained terminal-tail finalization.
4. Observe Electron main-process CPU and runtime RPC latency.
Additional evidence:
- observed row arrays contained only four or nine rows, ruling out tail-array size as the cause
- replacing the regex with the existing backward scanner changed a follow-up profile to 99.1% idle
- status calls recovered from repeated approximately 73-second timeouts to 0.23–0.34 seconds in the affected session
- output behavior remained unchanged
Contributor guide
Research direction
Start by locating the retained terminal-tail finalization used by Agent TUI redraws and compare its trailing-whitespace handling with the existing backward scanner. Reproduce a retained partial row with about 4,000 spaces followed by text, then verify that redraws no longer delay remote runtime RPCs, CPU usage falls, and output remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- api, cli, performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100