Repository navigation
perf(headless-computer): skip checks on a computer just seen running - #7420
Open
reachjalil wants to merge 1 commit into
Open
reachjalil wants to merge 1 commit into
reachjalil wants to merge 1 commit into
Conversation
Every computer call asked the provider whether the computer was running, and every desktop call also asked the desktop for its health, even when the previous call had confirmed both a second earlier. Opening the computer view looked the computer up twice (three times on a process that had not used it yet), and the view renews its ticket every 45 seconds. What this process saw of a computer is now kept for 15 seconds (seen-running.ts): - vm() returns without a lookup when the provider showed the computer running within that time; a command that comes back counts too. - startDesktop returns without a health check when the desktop was found current on that computer within that time. - desktopViewer asks nothing when the computer was seen running, and otherwise looks it up once. A computer found running by that lookup is kept, so vm() does not look it up again. Any provider call that throws, and any pause, stop or removal made by this process, forgets what was seen, so the next call asks again. A desktop operation that exits non-zero forgets that the desktop was current. When a lookup was skipped and the computer had been paused or removed since, the first call on it is refused. That call is sent once more after vm() has resumed or recreated the computer, but only when it failed within five seconds, did not time out, a lookup shows the computer is not running, and this process did not pause or remove it itself. The idle check and pauseIdle keep reading the provider directly and never receive a handle that skipped a lookup. A view never wakes a computer: when its skipped lookup turns out wrong it looks the computer up and answers paused. A paused computer whose desktop start fails is no longer replaced as unresponsive, which would have deleted it. Signed-off-by: Jalil <reachjalil@gmail.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this about?
Fewer round trips per call to a Workbot computer: calls a few seconds apart no longer each ask whether the computer is running and its desktop is current.
What problem does it solve?
Every command, desktop step and view first asked the provider for the computer's state, and desktop calls also asked the desktop for its health. In a hosted runner's logs those two questions were most of a warm view request, which repeats every 45 seconds.
What was the situation before?
Opening the view looked the computer up twice (three times on a process new to it), checked health, then fetched the ticket. Each command looked it up again.
How is this implemented?
seen-running.ts(new) keeps for 15 seconds that a computer was running and its desktop current. A failed call, pause, stop or removal forgets it.computer.ts,vm()andstartDesktopskip the lookup and the health check meanwhile;desktopViewerlooks up at most once.What else changed?
desktop-timing.ts: comment onbefore, empty when nothing was looked up.Release note
Workbot's computer view and its steps on the computer respond faster while a chat is working.
Evidence
No E2E; typecheck, plus a unit test no CI lane runs.
ee/packages/headless-computer/src/seen-running.test.ts— before: every call looked the computer up and checked desktop health; after: calls within 15 seconds do neither, and a computer paused meanwhile is resumed by the next command, which runs once.