Done

Main process pinned at 100% CPU: per-session JSON polled about 1,000 times a second, and the agent-mail folder relisted constantly

From AzyraDone 1 day agovia agent-mcp

Desktop app (Linux/WSL2) becomes laggy when typing after about a day of heavy multi-agent use (about 30 live agents, Claude and Codex). The Electron main process sits at 97–100% of one core, with V8 GC threads at about 10% each, and IPC calls from agents start timing out ("bridge rpc timeout after 15000ms").

Observed by sampling the main process's open file descriptors for 4 seconds (names only):

  1. Three Claude session status files (the per-PID JSON in a Claude profile's sessions folder) were each opened about 4,600 times in 4 s, roughly 1,150 opens per second per file. All three belong to live consoles started on the same Claude profile. That profile's organization had Claude Code access disabled and re-enabled earlier in the day. Other profiles' session files were not being polled like this.
  2. The agent-mail messages directory was listed about 1,960 times in 4 s (about 490 per second). That folder holds about 73,600 message files (300 MB); the events folder holds about 248,000 files.

The main process read about 200 MB/s with about 3,700 read syscalls per second, mostly from these. Closing about 100 finished terminal tabs did not change it.

Expected: status files polled at a modest interval (or watched), and the mail store indexed instead of relisted, so the main thread stays responsive.

AgentsRoom diagnostics

  • App version: 1.223.0
  • OS: linux 6.18.33.2-microsoft-standard-WSL2 (x64)
  • Agent CLI: claude
  • App language: system

Expected behavior

The main process stays responsive with about 30 agents: session status checked at a modest interval, and mail lookups that don't relist a 70k-file folder hundreds of times a second.

Actual behavior

The main thread is at 97–100% CPU, with about 200 MB/s of reads. Three session JSON files are each opened about 1,150 times per second, and the agent-mail messages folder is listed about 490 times per second. Typing lags, and agent MCP calls time out after 15 s.

Steps to reproduce

Run about 30 agents (Claude and Codex) that exchange agent mail heavily for about a day (about 70k messages). Have three Claude consoles on one profile whose org access was disabled and then restored. Watch the main process CPU and its transient open files.

Errors and logs

Per-thread: main 97.5%, V8Worker x3 about 10% each. Over 5 s: read 208 MB/s, 3,724 read syscalls/s, write 0.1 MB/s. In a 4 s transient-fd sample: sessions/<pid>.json x3 at about 4,600 opens each; agent-mail/messages listed 1,959 times; runtime.json.tmp written 18 times.

Replies

The team1 day ago

Thank you for the detailed sampling, it pointed straight at the cause. The fix will be available in the next version.

What happened: every time an agent read or sent mail, or reported its status, the app re-listed and re-sorted the whole agent-mail message folder on its main thread, and every change made all the open readers do it again. With about 73,000 messages that alone kept the main process at 100% CPU, which is also why your agents' calls timed out. The session status files were not the cause: they are read at a modest cadence, but while the main thread was saturated each read stayed open long enough to be counted thousands of times by the sampler. The app now keeps the list of recent messages in memory and only checks the folder's modification time before using it, so reading a mailbox no longer scales with your mail history.

One known limit remains: at the first mailbox access after a restart, the app still reads every acknowledgement file once (you have about 248,000), which can freeze it for a few seconds that one time. If the app is still slow after this fix, please reopen the ticket with as much detail as possible (a screenshot or a video helps a lot).

Up to 3 images, or paste one straight from your clipboard. Big screenshots are shrunk in your browser before they are sent.

Sent automatically with your message

Your browser sent this along so the team can reproduce what you saw. Nothing here was typed by you.

Browser
Linux