You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
desktop: desktop_type fails closed under CPU contention because of the 250 ms grab bound #222
With vitest pinned to one CPU and 7 busy-loop burners on that core, desktop_type fails closed with "Desktop text preparation failed; no text was sent" in most runs. It failed in 8 of 8 runs on main and 9 of 10 runs with #221. The failure happens in prepareText while the X server is grabbed. X11Wire.check() throws once the grab deadline from boundGrab has passed. X11_GRAB_MS is 250 ms in packages/desktop-linux/src/x11-wire.ts.
When the bound was raised to 2500 ms locally, 6 of 6 loaded runs passed. Raising X11_SETUP_MS alone did not help.
The short bound is deliberate, because a held server grab freezes the display. CI has not shown this failure yet. A loaded runner could still hit it in desktop-input-captures-live.test.ts, and so could real agent use on a busy machine. We need to decide whether the bound should scale, whether preparation should retry before the grab, or whether the limit should stay and be documented.
Decide the intended desktop_type behavior under CPU contention
PR #248 keeps the 250 ms grab bound and retries the grabbed preparation up to 3 times on a fresh connection, within the 3 s preparation budget. Only a grab-bound expiry retries. With vitest and 10 busy loops on one CPU, desktop-input-captures-live.test.ts passed 5 of 6 with the retry and 2 of 6 without it. With 15 busy loops it still fails closed in every run.
The main cost while the server is grabbed is the target liveness check. X11Wire.check() reads /proc/<pid>/stat about 1,500 times during planning. The grabbed phase takes about 38 ms idle, 165 ms with 7 loops and over 250 ms with 15. Two options would cut it further. One is to throttle the liveness check, for example to once per reply or every few milliseconds. That weakens a safety check, so it needs an owner decision. The other is to read the keymap before the grab, then grab, re-read, change and verify. This issue stays open for that decision.
Activity
ElbertePlinio commentedon Oct 5, 2026
PR #248 keeps the 250 ms grab bound and retries the grabbed preparation up to 3 times on a fresh connection, within the 3 s preparation budget. Only a grab-bound expiry retries. With vitest and 10 busy loops on one CPU,
desktop-input-captures-live.test.tspassed 5 of 6 with the retry and 2 of 6 without it. With 15 busy loops it still fails closed in every run.The main cost while the server is grabbed is the target liveness check.
X11Wire.check()reads/proc/<pid>/statabout 1,500 times during planning. The grabbed phase takes about 38 ms idle, 165 ms with 7 loops and over 250 ms with 15. Two options would cut it further. One is to throttle the liveness check, for example to once per reply or every few milliseconds. That weakens a safety check, so it needs an owner decision. The other is to read the keymap before the grab, then grab, re-read, change and verify. This issue stays open for that decision.