[Fix] Sandbox tasks cannot connect or stop on LAN-hosted deployments - #1096
Conversation
|
1 issue outstanding. See task
Reviewed 41ed554 |
|
The approach makes sense to me. Local preview domains fundamentally can't resolve from a second device, so routing sandbox traffic through the app origin via the existing A few things I'd like resolved before this merges:
Happy to run the LAN end-to-end validation locally. |
|
Addressed the rollout-skew concern in 74d65df: the self-hosting guide now explicitly requires The other checks resolved as follows:
@daniel-lxs, taking you up on the offered LAN validation would close the remaining pre-merge evidence gap. If that exposes routing trouble, the API cancellation fallback remains independently shippable and the routing commit can be split out. |
crypto.randomUUID is only available in secure contexts (https or localhost), so prompt submission, task tools, terminal tabs, and attachment handling all threw on plain-http LAN deployments. Route them through a shared helper with a getRandomValues-based v4 fallback.
The dev Caddyfile hardcoded the preview proxy at host.docker.internal:18081 with the roomotepreview.localhost host suffix, so dev environments that override ROOMOTE_PREVIEW_PROXY_PORT or the preview domain lost the same-origin sandbox route once the controller prefers app-origin URLs for local preview domains. Defaults are unchanged.
A dead transport does not always reject quickly: an unresponsive upstream can hold the live cancelTask request open for minutes, and the API fallback only ran on a thrown error. Race the live cancellation against a 10s timeout so Stop degrades to the authenticated cancellation API instead of hanging.
|
Ran the LAN end-to-end validation on a local deployment: stack on one machine, browser reaching it via the machine's LAN IP origin ( Routing: works as designed.
Three fixes pushed to this branch based on what the validation surfaced:
Also ran Known follow-up (not blocking): when the sandbox transport never connects at all, the task page shows "Could not reach the live task" and disables the prompt area, so no Stop control is rendered and the disconnected-client fallback branch has no UI entry point in that state. Surfacing a DB-backed Stop (or a cancel action on the error banner) would close that last gap; the fast-failing-transport case from the original report is covered. |
daniel-lxs
left a comment
There was a problem hiding this comment.
LAN E2E validated end to end (details in comments); CI green.
What changed
Local Docker sandbox-server traffic now uses the app's same-origin
/_roomote-sandbox/<taskId>route when the configured preview domain is local. Caddy forwards that route to the preview proxy for both HTTP and WebSocket traffic instead of allowing it to fall through to the Roomote web app.The task Stop action also falls back to the authenticated task-run cancellation API when the live sandbox client is unavailable or its cancellation request fails. Successful sandbox cancellation continues to use the immediate live path without making a duplicate API request.
Regression coverage verifies local-domain URL selection and disconnected, failed-sandbox, and successful-sandbox cancellation paths. Deployment validation also protects the Caddy route and sandbox-server host rewrite.
Why this change was made
On LAN-hosted deployments,
.localhostsandbox URLs could reach the main web listener instead of the sandbox server. The resulting sign-in redirect failed browser CORS checks, broke the WebSocket connection, and left no working live cancellation path.Impact
Sandbox HTTP and WebSocket requests stay on the browser-reachable app origin for local preview domains, while production wildcard preview domains keep their existing routing. If the live transport still fails, users can stop the active task through the API fallback.
Self-hosting guidance now requires
roomote upgraderather than image-only updates so the controller and Caddy routing configuration roll out together.The deployment configuration shape and route assertions passed locally; Caddy's final
adaptcheck could not run because the sandbox does not expose a Docker socket.