[Improve] Always-on live previews with setup in the preview pane#495
Conversation
Removes the deployment-level and per-environment previews_enabled toggles: preview ports now publish whenever the preview runtime config is ready and the environment defines ports. The task page preview pane is always accessible and hosts the setup experience, including a CTA that launches an environment-setup agent to get previews working. Deletes the Settings > Live Previews page (admin runtime config moved into the pane).
|
1 issue outstanding; no new code issues found in the latest update. See task
Reviewed afc3f31 |
Non-admins now see ask-an-administrator copy in the preview pane's setup state instead of the agent CTA, and startPreviewSetupTaskCommand rejects non-admin callers server-side.
Repo-only tasks have no environment to preview, so showing the pane with a create-an-environment prompt was confusing, especially during environment setup tasks which are themselves repo-only. The button and command palette entry now render only for environment-backed runs; the pane's repo-only state remains as a fallback for direct /previews URLs.
Adds a help button in the preview pane header and a dismissible warning banner when the injected preview widget never reports a successful load within the retry window. Both open a help dialog where admins can launch a repair agent that diagnoses proxied-preview failures (host checks, CORS, frame-blocking headers, hardcoded localhost origins); members are pointed to an admin. The setup-task command gains a repair mode with a dedicated change request and task title.
Preview setup/repair tasks now run within the target environment (payload environmentId, like verification tasks) so the agent validates the actually running services. This also distinguishes them from the initial repo-only environment-creation task: taskStatus now classifies the active agent as 'preview' or 'environment', and the pane and help dialog say 'this environment is still being set up' instead of wrongly claiming a preview agent is running during initial environment setup.
While the run's environment setup (mirrored from the workspace .roomote/setup-status.json) is still running and the preview has not loaded, the pane shows a calm services-are-starting notice instead of the timeout warning. When setup finishes without a load, the retry window resets and the iframe reloads so freshly started services get a fair chance. When setup failed or completed with warnings, the timeout warning says so.
…epair prompt - taskStatus now nulls the active agent taskId for non-admin viewers, and the pane and help dialog only render task links when the id is present. Setup/repair task descriptions embed the full environment YAML, so linking members to them would bypass the admin-only environment boundary. - The repair change request no longer asks the agent to modify application code, which the environment-setup workflow prohibits. It now fixes what the environment definition can express and reports required app changes as the blocker outcome; the help dialog copy matches.
|
Addressed both review findings in ed1e354:
|
Repair mode no longer invokes the $environment-setup skill, which prohibits application source changes. It now launches a standalone coding-task brief (buildEnvironmentPreviewRepairPrompt) that reproduces the failure through the public preview origin, fixes environment-definition problems via the manage_environments MCP action, fixes app-level blockers (framing headers, CORS, allowed hosts) as code changes with a PR, restarts the affected service, and re-verifies through the preview origin before declaring success. Workflow and payload markers are unchanged, so dedup and the preview/environment agent classification still apply.
|
Update on the Medium finding: rather than permanently narrowing repair scope, a1f8358 makes repair mode a standalone coding-task brief that skips the |
What
Live previews no longer have an enabled/disabled state. Preview availability is now simply: preview runtime config is ready AND the environment defines
ports. The task page's preview pane is always accessible and hosts the whole setup experience, including launching an agent (admins) to get previews working.Removed the enabled/disabled notion
previews_enabled !== falseterm are gone (apps/controller/src/utils.ts).previews_enableddeployment-control helpers from@roomote/feature-flagsand stopped seedingpreviews_enabled: falsefor new deployments.previews_enabledfield is deprecated, ignored, and removed from the public docs. It stays parseable so stored configs remain valid, and the setup agent removes it from configs when it encounters it.Preview pane is always accessible
/task/[id]/previewsis now routable.PreviewSetupStatecovers: repo-only tasks reached via direct URL, an in-flight setup agent (links to it), runtime not configured (admins get the origin/DNS/validation setup inline; non-admins see "ask an administrator" with no infra details), environment without ports (agent CTA + manual link for admins, "ask an administrator" for members), and runs that predate ports (sleep/wake attaches a preview, which snapshot restore genuinely does).Broken-preview help flow
environmentSetupState(mirrored from the workspace.roomote/setup-status.json): while setup is still running it shows a calm "services are still starting" notice instead of a warning; when setup finishes without a load, the retry window resets and the iframe reloads; when setup failed or completed with warnings, the timeout warning says so.X-Frame-Options/frame-ancestors, websocket/HMR bypass); members see ask-an-administrator copy.$environment-setupskill (which prohibits app source changes). Its standalone brief reproduces the failure through the sandbox's own public preview origin (ROOMOTE_<PORT>_HOST), fixes environment-definition problems via themanage_environmentsMCP action, fixes app-level blockers as code changes with a PR, restarts the affected service, and re-verifies through the preview origin before declaring success. Workflow and payload markers are unchanged, so dedup and agent classification still apply.Agent kickoff (admin-only)
previewSettings.startSetupTaskmutation (admin-gated server-side) derives the environment from the task and launches an$environment-setuptask with a preview-focused change request; amode: 'configure' | 'repair'input picks between the add-ports prompt and the diagnose-broken-preview prompt, and reuses the environment verification advisory lock so repeat clicks return the in-flight task instead of launching duplicates.environmentId, like verification tasks) so the agent validates the actually-running services. That also makes them distinguishable from the initial repo-only environment-creation task:taskStatusclassifies the active agent as'preview'vs'environment', and the pane/help dialog say "this environment is still being set up" during initial setup instead of wrongly claiming a preview agent is running.previewSettings.taskStatusquery (no DNS probe, matches the controller gate exactly) drives the pane.Settings page deleted
apps/web/src/components/previews/PreviewRuntimeSetup.tsx)./settings/previewsredirects to environment settings for old bookmarks.apps/docs,SELF_HOSTING.md, and the coolify/fly/railway/render deploy READMEs.Notes
previews_enabledmetadata/config keys are never rewritten, and the new release never writes the key. Rolling back restores the old gate against unchanged data.Testing
pnpm lint,pnpm check-types,pnpm knipall pass.taskStatus,startSetupTaskdedup, and the non-admin rejection; component tests cover the setup-state matrix for both admins and members.