Skip to content

perf(headless-computer): skip checks on a computer just seen running - #7420

Open
reachjalil wants to merge 1 commit into
devfrom
perf/computer-calls-skip-repeat-lookups
Open

reachjalil wants to merge 1 commit into
devfrom
perf/computer-calls-skip-repeat-lookups

Conversation

@reachjalil

Copy link
Copy Markdown
Member

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.
  • In computer.ts, vm() and startDesktop skip the lookup and the health check meanwhile; desktopViewer looks up at most once.
  • If the computer was paused or removed since, the refused call is sent once more after the usual resume; never after a timeout or this runner's own pause.
  • The view still answers "paused" without waking the computer; the idle check always asks the provider.

What else changed?

  • A paused computer whose desktop start fails is no longer replaced as unresponsive.
  • desktop-timing.ts: comment on before, 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.

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>
@vercel
vercel Bot temporarily deployed to Preview – openwork-den November 14, 2026 01:33 Inactive
@vercel

vercel Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
openwork-app Skipped Skipped Nov 14, 2026 1:33am UTC
openwork-den Skipped Skipped Nov 14, 2026 1:33am UTC
openwork-landing Skipped Skipped v0 Nov 14, 2026 1:33am UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – openwork-app November 14, 2026 01:33 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing November 14, 2026 01:33 Inactive

This branch was previously deployed

3 inactive deployments
Preview – openwork-landing — 47643506 Deployed Nov 14, 2026 by vercel[bot]
Preview – openwork-den — 47643506 Deployed Nov 14, 2026 by vercel[bot]
Preview – openwork-app — 47643506 Deployed Nov 14, 2026 by vercel[bot]
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.

1 participant