Repository navigation
Show a starting computer calmly, and tell a Bot to try again when a cold start runs long - #842
Closed
guidovizoso wants to merge 17 commits into
Closed
guidovizoso wants to merge 17 commits into
guidovizoso wants to merge 17 commits into
Conversation
…a cold start outlasts the wait
… tell the Bot to try again
…ealth wait runs out The supervisor answers a container that is up but not yet healthy with a 503 after 60s, which is well inside the server's 120s ensure timeout, so the docker and desktop paths never reached the gentle still-starting answer. The supervisor now marks that 503 as starting and the provider maps it to ComputerStillStartingError. Also awaits a rejects assertion that was never checked.
…not ready Docker says running as soon as the process exists, so status called a booting container ready, the screenshot route went on to /ensure, and the poll was held for up to a minute on the health wait. The supervisor now passes the healthcheck verdict through its list, and running with a starting healthcheck reads as starting. An older supervisor sends no verdict and reads as before.
…timeout locate waited up to 120s inside the person's request. Behind an ALB's default 60s idle timeout the browser got a bare gateway error, and the action could still land once the pod came up after the model had been told it failed. locate now gives up at 45s with the still-starting answer while the pod keeps coming up; update's background restart keeps the full resume budget.
A screenshot failure after an 'absent' answer kept the old state, so the side panel went on calling a failing computer off, and an off computer is never timed out, so the failure was never shown. A failure now clears the polled state and the status read resumes. A not-ready answer also drops the last frame, which showed a sleeping computer as live and kept its stream reconnecting.
…e assertion-shape allow-list
Collaborator
Author
|
Landed in #847. |
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 this changes
A Bot's computer takes about a minute to start the first time (an image pull, a pod, a browser), and everything around that minute read as a fault. The Computer panel opened on "Can't show the screen right now… ask an admin", an action that waited on the start was marked "didn't work" in amber, and the model was handed something that looked like a broken computer and gave up on one seconds from ready. Looking at the panel was also enough to wake a sleeping computer.
The panel
Looking no longer wakes it.
GET /api/computers/:botId/screenshotasks the provider's status first, which touches nothing, and answers 200 with{ ready: false, state }for a computer that is not ready. Only a ready one is screenshotted. The panel also polls the status route until the first frame.A cold start that runs long is a wait, not a failure
ComputerStillStartingError(aComputerUnavailableError, so existing catches still apply), thrown only before anything reached the computer. Its message tells the model the call was not performed and to try again in a moment.starting: true, notPerformed: true) instead of throwing; the routes mark the error body the same way; the browser draws the line as "…, not done yet".locateanswers within 45 seconds instead of 120, under a load balancer's usual 60-second idle timeout. Behind an ALB the browser used to get a bare gateway error while the action could still land once the pod came up. The resume keeps going; the next call waits again.starting, and passes Docker's healthcheck verdict through its list, so a container that is running but still booting its browser reads as starting rather than ready.locatethrough to the attempt instead of forgetting it, so one click on a sleeping computer no longer waits through two cold starts.Saying what it is about to do. The computer guidance gains one line: before its first computer action in a turn, the Bot says in one sentence what it is about to do and where, so the wait has a reason on screen.
Where it runs
locateis picked up by the next call wherever it lands./ensureand list answers gain astartingflag and ahealthfield. Server and supervisor can be upgraded in either order: an older supervisor sends no verdict and reads as before, and an older server ignores the new fields.Boundary and audit
Changelog
Unreleased, including the supervisor note.Merge notes
The search-routing PR removes the
COMPUTER_GUIDANCEexport in favour ofcomputerGuidance({ search }), and splits the guidance into line lists; the line this PR adds belongs in itsACTING_LINES. The new test inshared/bot-prompt.test.tshere referencesCOMPUTER_GUIDANCE, so whichever of the two merges second has to switch that test tocomputerGuidance, checking both{ search: true }and{ search: false }.How it was checked
app/tests/computer-calm-start.test.tsx: a starting computer says so with no problem shown; failed screenshots during a start are not a problem until the grace runs out; an unreachable computer is a problem at once; an off computer in the side panel says it starts when the Bot uses it; a dropped stream shows the badge, not the Retry panel; a computer that was off and then fails is not called off for ever; a computer that goes to sleep stops showing its last frame.app/tests/computer-tool-refusals.test.tsandscreen-connection.test.ts: a still-starting call reads as not done yet; a retried drop reports reconnecting and no problem until the retries run out.server/tests/computer-routes.test.ts: the not-ready screenshot answer, including an unreachable computer's reason; an action whose cold start ran out is marked starting and not performed.server/tests/computer-sandbox.test.ts,computer-supervisor.test.ts,headless-tools.test.ts,supervisor/tests/health.test.ts: the 45-secondlocate, the supervisor's timeout and 503 read as starting while its other faults stay faults, the healthcheck verdict, and the headless answer.shared/bot-prompt.test.ts: the one-sentence line.computer-supervisorandcomputer-sandboxlines), and one Mastra test that needs a package not installed locally. The app suite: 1,675 pass.