Boxlite boot treats any HTTP response as a healthy sandbox
In astrbot/core/computer/booters/boxlite.py, MockShipyardSandboxClient.wait_healthy() returns after any completed HTTP response. It logs success only for status 200, but the unconditional return also accepts 404/503 responses. During Boxlite startup, a server that is reachable but not ready can therefore pass the readiness gate and fail on the first shell/Python/filesystem request.
Please keep polling until the health endpoint returns 200 (or the existing timeout expires), and report timeout when it never becomes healthy.
Checked this against the code — the described behavior is accurate, but there's something worth confirming first: this file may not be on the runtime path.
The reported problem is real
In astrbot/core/computer/booters/boxlite.py (194 lines):
wait_healthy()(L113-129): thereturnat L126 is a sibling ofasync with, not a child ofif response.status == 200:(L124) — so any HTTP response returns immediately. Against a server that always answers 503, it returns after a single request.- The same function contains no
raise— when the 60 attempts are exhausted it falls through and returnsNone, so a timeout is indistinguishable from success. The caller at L173 is a bareawait. MockShipyardSandboxClient.__init__(L19-20) keeps thehttp://prefix (constructed at L152), butupload_file(L46) buildsf"http://{self.sb_url}/upload"→http://http://127.0.0.1:25000/upload, whose hostname parses ashttp.BoxliteBooterdoes not overrideavailable(), and the default inbooters/base.pyis...→ returnsNone, socomputer_client.py:571(if not await booter.available():) is always true.
But the runtime path looks different
The sandbox driver is distributed as a separate plugin, AstrBotDevs/astrbot_sandbox_boxlite (its requirements.txt is just boxlite). The plugin ships its own booters/boxlite.py — 790 lines, versus 194 here. It imports astrbot.core.computer.booters.base and astrbot.core.computer.olayer from core, but not astrbot.core.computer.booters.boxlite.
In that plugin implementation the same points are handled differently:
healthy()returnsbool(onlystatus == 200is true);wait_healthy()returns only when that is true, otherwiseraise RuntimeError(...)once the attempts are exhausted;_HEALTH_PROBE_TIMEOUT = ClientTimeout(total=5),_HEALTH_PROBE_INTERVAL = 1,_HEALTH_PROBE_MAX_ATTEMPTS = 60;upload_filebuildsf"{self.sb_url}/upload"(no duplicated scheme);available()is implemented and returns a bool.
So the fix you suggested is already the shape used there.
So
The behavior you described is real in the file you pointed at, and I'd expect any reachable copy of it to need the same change. The open question is whether this copy in core is still reachable at all: from a static reading it looks like a stale prototype superseded by the plugin, in which case the issue is really about removing or annotating dead code rather than fixing a live path.
I have not traced every entry point, so please treat that part as unconfirmed — if the copy in core/computer/booters/ is in fact reachable, then all four points above apply as reported.
The runtime-path question in the existing analysis can be resolved from current master@42972e9: this core implementation is reachable. It may be legacy/hidden in the UI, but it is still selected by the live computer client.
Reachability and confirmed cause
astrbot/core/computer/computer_client.py::get_booter()readsprovider_settings.sandbox.booterand has an explicitelif booter_type == "boxlite"branch importing and bootingastrbot.core.computer.booters.boxlite.BoxliteBooter.- The current config schema's visible options list only
shipyard_neo,shipyard, andcua, so a new Dashboard configuration cannot select Boxlite normally. A legacy or manually edited configuration containingboxlitenevertheless reaches this branch. BoxliteBooter.boot()awaitsMockShipyardSandboxClient.wait_healthy()before the booter is cached and skills are synchronized. Therefore the reported readiness result directly gates the first shell/Python/filesystem use.- In
wait_healthy(), the unconditionalreturnis outside thestatus == 200block. A 404/503 exits on attempt one. If every request raises, the loop eventually falls through without raising, which is also reported as a successful boot. get_booter()already catches a boot exception, callsshutdown(), removes idle state, and re-raises. Raising a timeout fromwait_healthy()therefore integrates with the existing cleanup path.
So this is not only dead prototype behavior: manual/legacy booter=boxlite → core BoxliteBooter.boot() → first non-200 (or 60 transport failures) returns normally → client logs “Sandbox booted successfully” and proceeds.
Suggested change
Keep one aiohttp.ClientSession for the polling window, give each probe a finite request timeout, sleep after both non-200 responses and ordinary transport errors, and raise an actionable timeout after the final attempt:
last_status = None
last_error = None
async with ClientSession(timeout=ClientTimeout(total=5)) as session:
for attempt in range(max_attempts):
try:
async with session.get(url) as response:
last_status = response.status
if response.status == 200:
return
except Exception as exc:
last_error = exc
if attempt + 1 < max_attempts:
await asyncio.sleep(interval)
raise TimeoutError(f"Boxlite health check timed out; status={last_status}, error={last_error}")
asyncio.CancelledError should continue to propagate; do not widen the catch to BaseException. Logging every one-second probe at INFO is noisy during startup, so log the start once, non-200 attempts at debug (or rate-limit them), and the final failure at error/warning through the caller.
There is also a product decision to make: either remove the boxlite branch/core booter if the separate plugin is now the only supported route, or keep the core branch and make it complete. Leaving a reachable but hidden implementation is the worst state. If it remains, the adjacent available() and upload-URL findings in the prior comment should be fixed or split into follow-up issues; otherwise cached Boxlite sessions are treated as unavailable and the upload path is malformed.
Observable result
A reachable-but-not-ready Boxlite server will no longer pass startup. A later 200 succeeds without recreating a session each attempt; a permanent 4xx/5xx or connection failure raises, triggers existing booter cleanup, and gives the operator the last status/error. Cancellation stops polling promptly.
Tests
Extend tests/unit/test_computer.py::TestBoxliteBooter beyond the current construction-only test:
- 503, 503, 200 → exactly three probes, then success;
- permanent 503 → timeout is raised and includes the last status;
- repeated connection errors → timeout is raised with the last exception;
- cancellation during request/sleep propagates and closes the session;
get_booter()withbooter=boxliteexecutes the core branch and calls shutdown on health timeout;- once the support decision is made, either test
available()reuse and upload URLs or remove the unreachable configuration/runtime branch together.
This supplements rather than repeats the existing comment: the open reachability question is answered by the explicit live import/boot branch in computer_client.py.