From b41c6cb81341731d58d315fd35fb8340f3c8668f Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sat, 23 May 2026 05:43:06 -0400 Subject: [PATCH] Fix workflow environment snapshots in web UI --- .../app/routes/automation-detail.tsx | 45 ++++++++++--------- apps/fabro-web/app/routes/run-settings.tsx | 36 ++++++++------- 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/apps/fabro-web/app/routes/automation-detail.tsx b/apps/fabro-web/app/routes/automation-detail.tsx index ba0d51e1f..c87f8e182 100644 --- a/apps/fabro-web/app/routes/automation-detail.tsx +++ b/apps/fabro-web/app/routes/automation-detail.tsx @@ -1,5 +1,6 @@ import { ChevronRightIcon } from "@heroicons/react/20/solid"; import type { + EnvironmentSettings, WorkflowDetailResponse as ApiWorkflowDetail, WorkflowSettings as WorkflowSettingsSnapshot, } from "@qltysh/fabro-api-client"; @@ -40,6 +41,26 @@ function sampleSettings({ diskGb: number; prepareCommands?: string[]; }): WorkflowSettingsSnapshot { + const environmentId = labels.project ?? snapshot; + const environment = { + provider: "daytona", + image: { ref: snapshot, dockerfile: null }, + resources: { + cpu, + memory: `${memoryGb}GB`, + disk: `${diskGb}GB`, + }, + network: { mode: "allow_all", allow: [] }, + lifecycle: { + preserve: false, + stop_on_terminal: true, + auto_stop: `${autoStopInterval}m`, + }, + labels, + volumes: [], + env: {}, + } satisfies EnvironmentSettings; + return { project: { name: null, @@ -52,6 +73,9 @@ function sampleSettings({ graph: "", metadata: {}, }, + environments: { + [environmentId]: environment, + }, run: { goal: { type: "inline", value: goal }, working_dir: null, @@ -65,26 +89,7 @@ function sampleSettings({ clone: { enabled: true }, run_branch: { enabled: true, push: true }, meta_branch: { enabled: true, push: true }, - sandbox: { - provider: "daytona", - preserve: false, - stop_on_terminal: true, - devcontainer: true, - env: {}, - docker: null, - daytona: { - auto_stop_interval: autoStopInterval, - labels, - snapshot: { - name: snapshot, - cpu, - memory_gb: memoryGb, - disk_gb: diskGb, - dockerfile: null, - }, - network: null, - }, - }, + environment: { id: environmentId, ...environment }, notifications: {}, interviews: { provider: null, slack: null }, agent: { permissions: null, mcps: {} }, diff --git a/apps/fabro-web/app/routes/run-settings.tsx b/apps/fabro-web/app/routes/run-settings.tsx index d1d2d9139..9b69183e6 100644 --- a/apps/fabro-web/app/routes/run-settings.tsx +++ b/apps/fabro-web/app/routes/run-settings.tsx @@ -56,7 +56,7 @@ export default function RunSettingsPage() { ) : view === "settings" ? ( <> - + @@ -135,32 +135,34 @@ function WorkflowPanel({ snapshot }: { snapshot: WorkflowSettings }) { ); } -function SandboxPanel({ snapshot }: { snapshot: WorkflowSettings }) { - const sandbox = getObject(getObject(snapshot, "run"), "sandbox"); - const provider = getString(sandbox, "provider"); - const docker = getObject(sandbox, "docker"); - const dockerImage = getString(docker, "image"); +function EnvironmentPanel({ snapshot }: { snapshot: WorkflowSettings }) { + const environment = getObject(getObject(snapshot, "run"), "environment"); + const provider = getString(environment, "provider"); + const environmentId = getString(environment, "id"); + const image = getObject(environment, "image"); + const imageRef = getString(image, "ref"); + const lifecycle = getObject(environment, "lifecycle"); return ( - - + + + {environmentId ? {environmentId} : Default} + + {provider ? {provider} : Unknown} - {provider === "docker" && dockerImage ? ( - - {dockerImage} + {imageRef ? ( + + {imageRef} ) : null} - - - - + - + - + );