Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
fix: guard concurrent workflow replacements
Abdurrahman Fakhrulb5b5ac9305a1
diff --git a/docs/evidence/2026-11-04-final-agents.md b/docs/evidence/2026-11-04-final-agents.mdnew file mode 100644index 00000000..f2237daf--- /dev/null+++ b/docs/evidence/2026-11-04-final-agents.md@@ -0,0 +1,19 @@+# Final agent and collaboration audit follow-up++Base a2268f2b includes the earlier changes described in [frontend agent evidence](2026-11-04-frontend-agents.md). This follow-up is not browser or release acceptance.++| Finding | Current result and evidence / limit |+| --- | --- |+| AD-01 | Existing app keeps ChatPanel mounted under the form. Source inspection confirms the same instance is hidden; no live streaming, wire-history, thread restart, or shell remount test was run. |+| AD-02, AD-10, AC-01 | Existing editors hold their original revisions and latest-request guards; conflict retains the draft. A real GroupEditor component fixture modeled concurrent actor B, refreshed props to revision 11 and confirmed submission retained revision 10, conflict surfaced and actor B stayed intact. Existing earlier ChannelEditor fixture covered its revision 10/11 flow. Fixtures use mocked APIs; overlapping response, new-draft refresh and cancel need browser coverage. This follow-up also keeps the save error visible if the recovery refresh fails. |+| AD-03, WF-01, WF-02 | Existing duplicate saves dirty graph before clone; source copy and restore ask before mutation; delete names target and warns of dirty state. This follow-up puts source copy and restore under the per-window action lock, temporarily disables graph editing during pending actions, and retains a newer draft if replacement races an edit. A mounted VersionPanel fixture confirmed cancel sends no restore and two activations issue one pending restore using a modeled lock. Full app-level duplicate, source, delete, failure and pending-edit journeys remain untested. |+| AD-04, AD-11 | Existing Organization deletion confirmation, pending state and named controls inspected; no live mutation, focus or responsive accessibility proof. |+| AD-05 | Existing variable save/delete guards, confirmation and error state inspected; no mutation/error interaction fixture. |+| AD-06 | Existing form labels and associations; two tracked static form tests passed. No screen reader test. |+| AD-07, AD-08 | Existing memory keyboard selection, pan, zoom, fit and separate no-match state inspected; two tracked pure view tests passed. No browser keyboard, pointer or visual proof. |+| AD-09 | Existing Memory and Vault storage exception handling inspected; no throwing-storage fixture run. |+| AD-12 | Existing member fieldsets and labels inspected. Group CAS fixture mounted those controls; no narrow viewport or focus proof. |+| AD-13 | Investigation only; frame readiness remains unknown. No origin, CSP, service, or iframe success changes. |+| Managed install | Existing clipboard consumer awaits the boolean result; static Orca tests passed. No real clipboard or installation proof. |++Validation: Node 22, umask 077, VITEST_MAX_WORKERS=2. Two isolated component fixtures passed (GroupEditor CAS and VersionPanel cancellation/single-flight); they live in ignored .agent/evidence/final-agents and use the audit's external react-test-renderer installation, so are not portable CI tests. Five tracked test files passed 15 tests, including 2 form, 2 memory transform and 7 Orca static tests. TypeScript, targeted ESLint, and diff check passed. No full build, security scan, PR gates, real API, browser, assistive technology, actual device or remote CI was run; integration owner must run applicable gates and behavioral journeys on the final SHA.diff --git a/frontend/slices/agent-group/components/agent-group-editor.tsx b/frontend/slices/agent-group/components/agent-group-editor.tsxindex 90ace838..4d78245e 100644--- a/frontend/slices/agent-group/components/agent-group-editor.tsx+++ b/frontend/slices/agent-group/components/agent-group-editor.tsx@@ -83,7 +83,7 @@ export function AgentGroupEditor({await onSaved();onOpenChange(false);} catch (cause) {- await onSaved();+ await onSaved().catch(() => undefined);setError((cause instanceof Error ? cause.message : "Could not save the group.") + " Your draft is preserved; close and reopen to load the latest version.");} finally { saving.current = false; setBusy(false); }};diff --git a/frontend/slices/channels/components/channel-editor.tsx b/frontend/slices/channels/components/channel-editor.tsxindex ec2c3ea7..211ce2ea 100644--- a/frontend/slices/channels/components/channel-editor.tsx+++ b/frontend/slices/channels/components/channel-editor.tsx@@ -95,7 +95,7 @@ export function ChannelEditor({await onSaved();onOpenChange(false);} catch (cause) {- await onSaved();+ await onSaved().catch(() => undefined);setError((cause instanceof Error ? cause.message : "Could not save channel.") + " Your draft is preserved; close and reopen to load the latest version.");} finally { saving.current = false; setBusy(false); }};diff --git a/frontend/slices/workflows/app.tsx b/frontend/slices/workflows/app.tsxindex 30e11b66..b59d1115 100644--- a/frontend/slices/workflows/app.tsx+++ b/frontend/slices/workflows/app.tsx@@ -70,7 +70,10 @@ export default function WorkflowsApp(props: AppProps) {const [runExclusive] = useState(createActionLock);const wrap = async (fn: () => Promise<void>) => runExclusive(async () => { setBusy(true); setMessage(""); try { await fn(); } catch (error) { setMessage(error instanceof Error ? error.message : "Action failed"); } finally { setBusy(false); } });- const mutate = (next: WorkflowGraph) => { setGraph(next); setDirty(true); };+ const draftVersion = useRef(0), replacementVersion = useRef(0);+ const runReplacement = (fn: () => Promise<void>) => wrap(async () => { replacementVersion.current = draftVersion.current; await fn(); });+ const replacementStillCurrent = () => { if (replacementVersion.current === draftVersion.current) return true; setLibraryMode("automations"); setMessage("The action completed, but newer unsaved changes were kept. Refresh after saving or discarding them."); return false; };+ const mutate = (next: WorkflowGraph) => { draftVersion.current += 1; setGraph(next); setDirty(true); };const selectGraph = async (id: string) => { if (!confirmDiscard()) return; setLibraryMode("automations"); setGraph(await getGraph(id)); setSelected(null); setRun(null); setDirty(false); setPanel("inspector"); setLibraryOpen(false); };const selectSession = async (id: string) => { if (!confirmDiscard()) return; const next = await getSessionGraph(id); setLibraryMode("sessions"); setSessionView(next); setSessionSelected("session-root"); setGraph(null); setDirty(false); setLibraryOpen(false); setDetailsOpen(false); };const refreshSession = async () => { if (!sessionView) return; const next = await getSessionGraph(sessionView.session.id); setSessionView(next); if (sessionSelected && !next.graph.nodes.some((item) => item.id === sessionSelected)) setSessionSelected("session-root"); };@@ -125,8 +128,8 @@ export default function WorkflowsApp(props: AppProps) {const toggleDetails = () => overlayPane ? setDetailsOpen(true) : setShowDetails((value) => !value);const automationLibrary = <WorkflowLibrary graphs={graphs} activeId={graph?.id} search={search} onSearch={setSearch} onSelect={(id) => void wrap(() => selectGraph(id))} onBlank={async () => { await createBlank(); }} onTemplate={async (id) => { await createTemplate(id); }} onAI={async (definition) => { await createAI(definition); }} onImport={async (definition) => { await createImported(definition); }}/>;- const library = <div className="flex h-full min-h-0 flex-col"><div className="grid grid-cols-3 gap-1 border-b p-2">{(["automations", "sessions", "sources"] as const).map((mode) => <button key={mode} type="button" className={`rounded-md px-2 py-1.5 text-xs capitalize ${libraryMode === mode ? "bg-accent font-semibold" : "text-muted-foreground hover:bg-accent/60"}`} onClick={() => setLibraryMode(mode)}>{mode}</button>)}</div><div className="min-h-0 flex-1">{libraryMode === "sources" ? <WorkflowOwnerSources beforeCopy={confirmDiscard} onSelect={(id) => void wrap(() => selectGraph(id))} onCopied={(next) => void wrap(async () => { setLibraryMode("automations"); await load(next.id, true); setLibraryOpen(false); })}/> : libraryMode === "automations" ? automationLibrary : <WorkflowSessionLibrary activeId={sessionView?.session.id} onSelect={(id) => void wrap(() => selectSession(id))}/>}</div></div>;- const details = libraryMode === "sessions" && sessionView ? <WorkflowSessionDetails view={sessionView} node={sessionNode} onOpenTerminal={openSessionTerminal} onOpenCode={openSessionCode} onSaveDraft={saveSessionDraft} savingDraft={busy}/> : graph ? <WorkflowDetails graph={graph} graphs={graphs} node={node} run={run} panel={panel} onPanel={(next) => next === "optimizer" && dirty ? void openOptimizer() : setPanel(next)} onNode={updateNode} onDeleteNode={(id) => deleteNodes([id])} onGraph={mutate} onRunSelect={(selectedRun) => { setRun(selectedRun); setPanel("run"); }} beforeRestore={confirmDiscard} onRestored={(next) => { setGraph(next); setDirty(false); void listGraphs().then(setGraphs); }} onOptimizerCloned={(next) => { setGraph(next); setSelected(null); setRun(null); setDirty(false); setPanel("optimizer"); void listGraphs(true).then(setGraphs); }}/> : null;+ const library = <div className="flex h-full min-h-0 flex-col"><div className="grid grid-cols-3 gap-1 border-b p-2">{(["automations", "sessions", "sources"] as const).map((mode) => <button key={mode} type="button" disabled={busy} className={`rounded-md px-2 py-1.5 text-xs capitalize ${libraryMode === mode ? "bg-accent font-semibold" : "text-muted-foreground hover:bg-accent/60"}`} onClick={() => setLibraryMode(mode)}>{mode}</button>)}</div><div className="min-h-0 flex-1">{libraryMode === "sources" ? <WorkflowOwnerSources runAction={runReplacement} beforeCopy={confirmDiscard} onSelect={(id) => void wrap(() => selectGraph(id))} onCopied={async (next) => { if (!replacementStillCurrent()) return; setLibraryMode("automations"); await load(next.id, true); setLibraryOpen(false); }}/> : libraryMode === "automations" ? automationLibrary : <WorkflowSessionLibrary activeId={sessionView?.session.id} onSelect={(id) => void wrap(() => selectSession(id))}/>}</div></div>;+ const details = libraryMode === "sessions" && sessionView ? <WorkflowSessionDetails view={sessionView} node={sessionNode} onOpenTerminal={openSessionTerminal} onOpenCode={openSessionCode} onSaveDraft={saveSessionDraft} savingDraft={busy}/> : graph ? <WorkflowDetails graph={graph} graphs={graphs} node={node} run={run} panel={panel} onPanel={(next) => next === "optimizer" && dirty ? void openOptimizer() : setPanel(next)} onNode={updateNode} onDeleteNode={(id) => deleteNodes([id])} onGraph={mutate} onRunSelect={(selectedRun) => { setRun(selectedRun); setPanel("run"); }} runRestore={runReplacement} beforeRestore={confirmDiscard} onRestored={(next) => { if (!replacementStillCurrent()) return; setGraph(next); setDirty(false); void listGraphs().then(setGraphs); }} onOptimizerCloned={(next) => { setGraph(next); setSelected(null); setRun(null); setDirty(false); setPanel("optimizer"); void listGraphs(true).then(setGraphs); }}/> : null;const toolbarItems: ToolbarItem[] = [{ id: "library", label: "Workflow library", icon: PanelLeft, onClick: toggleLibrary, primary: true },{ id: "refresh", label: "Refresh", icon: RefreshCw, onClick: () => void wrap(async () => { if (libraryMode === "sessions") await refreshSession(); else if (confirmDiscard()) await load(undefined, true); }), disabled: busy },@@ -146,16 +149,16 @@ export default function WorkflowsApp(props: AppProps) {const headerTitle = libraryMode === "sessions" ? sessionView?.session.label : graph?.name;return <div ref={appRef} data-slot="workflows-feature" className="@container h-full min-h-0 min-w-0">- <AppFrame safeArea={false} className="h-full min-w-0" toolbar={<div className="flex h-11 min-w-0 items-center gap-1 px-2 @min-[700px]:gap-2 @min-[700px]:px-3"><Workflow className="hidden size-4 shrink-0 @min-[700px]:block"/><span className="hidden shrink-0 text-sm font-semibold @min-[700px]:inline">Workflows</span>{libraryMode === "sessions" ? <Badge variant="outline" className="shrink-0"><Activity className="mr-1 size-3"/>Session</Badge> : dirty ? <Badge variant="outline" className="hidden shrink-0 @min-[520px]:inline-flex">Unsaved</Badge> : null}{libraryMode === "automations" && graph ? <Input aria-label="Workflow name" className="h-8 min-w-[7rem] max-w-56 flex-1 @max-[600px]:max-w-none" value={graph.name} onChange={(event) => mutate({ ...graph, name: event.target.value })}/> : <div className="min-w-0 flex-1 truncate text-sm font-medium">{headerTitle || (libraryMode === "sessions" ? "Sessions" : "Workflows")}</div>}{libraryMode === "automations" ? <WorkflowCreateDialog compact={overlayPane} onBlank={async () => { await createBlank(); }} onTemplate={async (id) => { await createTemplate(id); }} onAI={async (definition) => { await createAI(definition); }} onImport={async (definition) => { await createImported(definition); }}/> : null}<ResponsiveToolbar items={toolbarItems} compact={toolbarCompact} className="ml-auto shrink-0"/></div>}>+ <AppFrame safeArea={false} className="h-full min-w-0" toolbar={<div className="flex h-11 min-w-0 items-center gap-1 px-2 @min-[700px]:gap-2 @min-[700px]:px-3"><Workflow className="hidden size-4 shrink-0 @min-[700px]:block"/><span className="hidden shrink-0 text-sm font-semibold @min-[700px]:inline">Workflows</span>{libraryMode === "sessions" ? <Badge variant="outline" className="shrink-0"><Activity className="mr-1 size-3"/>Session</Badge> : dirty ? <Badge variant="outline" className="hidden shrink-0 @min-[520px]:inline-flex">Unsaved</Badge> : null}{libraryMode === "automations" && graph ? <Input aria-label="Workflow name" disabled={busy} className="h-8 min-w-[7rem] max-w-56 flex-1 @max-[600px]:max-w-none" value={graph.name} onChange={(event) => mutate({ ...graph, name: event.target.value })}/> : <div className="min-w-0 flex-1 truncate text-sm font-medium">{headerTitle || (libraryMode === "sessions" ? "Sessions" : "Workflows")}</div>}{libraryMode === "automations" ? <WorkflowCreateDialog compact={overlayPane} onBlank={async () => { await createBlank(); }} onTemplate={async (id) => { await createTemplate(id); }} onAI={async (definition) => { await createAI(definition); }} onImport={async (definition) => { await createImported(definition); }}/> : null}<ResponsiveToolbar items={toolbarItems} compact={toolbarCompact} className="ml-auto shrink-0"/></div>}><div className={`grid h-full min-h-0 min-w-0 ${showLibraryPanel ? "grid-cols-[300px_minmax(0,1fr)] @min-[1200px]:grid-cols-[340px_minmax(0,1fr)]" : "grid-cols-1"}`}>{showLibraryPanel ? <aside className="min-h-0 min-w-0 border-r">{library}</aside> : null}- <main className="flex min-h-0 min-w-0 overflow-hidden">+ <main inert={busy} className="flex min-h-0 min-w-0 overflow-hidden">{libraryMode === "sources" ? <div className="flex h-full flex-1 items-center justify-center p-6 text-center text-sm text-muted-foreground">Owner sources are listed in the library. Open an own workflow or copy a foreign source as a disabled draft for review.</div> : libraryMode === "automations" ? graph ? <div className="flex min-h-0 min-w-0 flex-1 flex-col"><div className="flex min-h-10 min-w-0 shrink-0 flex-wrap items-center gap-1.5 border-b px-2 py-1 @min-[520px]:flex-nowrap @min-[520px]:gap-2"><label className="flex shrink-0 items-center gap-1.5 text-[10px] text-muted-foreground"><span>Status</span><select aria-label="Workflow status" className="h-7 min-w-0 max-w-24 rounded border bg-background px-2 text-xs text-foreground" value={graph.status} onChange={(event) => mutate({ ...graph, status: event.target.value as WorkflowGraph["status"] })}><option value="draft">Draft</option><option value="active">Active</option><option value="archived">Archived</option></select></label><WorkflowNodePalette onAdd={addNode} open={nodeCreator.open} context={nodeCreator.sourceId ? "after-node" : "all"} onOpenChange={(open) => setNodeCreator(open ? { open: true } : { open: false })}/>{message ? <span className="w-full min-w-0 truncate text-[11px] text-muted-foreground @min-[520px]:ml-auto @min-[520px]:w-auto @min-[520px]:max-w-72">{message}</span> : null}</div><div className="min-h-0 min-w-0 flex-1 overflow-hidden"><WorkflowCanvas key={graph.id} graph={graph} selectedId={selected} onSelect={chooseNode} onCustomNodes={(customNodes) => mutate({ ...graph, metadata: { ...graph.metadata, customNodes } })} onMoveMany={(nodes) => mutate({ ...graph, nodes })} nodeStates={runStates} edgeStates={runEdgeStates} onOpen={(id) => void openNode(id)} onConnect={connect} onQuickAdd={(sourceId, sourceHandle) => setNodeCreator({ open: true, sourceId, ...(sourceHandle ? { sourceHandle } : {}) })} onMove={(id, position) => mutate({ ...graph, nodes: graph.nodes.map((item) => item.id === id ? { ...item, position } : item) })} onDeleteNodes={deleteNodes} onDeleteEdges={deleteEdges} onTidy={tidy}/></div></div> : <div className="flex h-full min-w-0 flex-1 items-center justify-center px-4 text-center text-sm text-muted-foreground"><div className="grid justify-items-center gap-[var(--feature-gap,0.75rem)]"><p>Create an automation or discover saved workflows in Sources.</p><Button variant="secondary" onClick={() => { setLibraryMode("sources"); setShowLibrary(true); setLibraryOpen(overlayPane); }}>View sources</Button></div></div>: sessionView ? <div className="flex min-h-0 min-w-0 flex-1 flex-col"><div className="flex min-h-10 shrink-0 items-center gap-2 border-b px-3 text-[11px] text-muted-foreground [@media(max-height:520px)]:hidden"><span className="font-medium text-foreground">{sessionView.session.label}</span><span>read-only</span><span>·</span><span>{sessionView.steps.length} steps</span><span>·</span><span>{sessionView.shownEvents}/{sessionView.totalEvents} actions</span>{message ? <span className="ml-auto truncate">{message}</span> : null}</div><div className="min-h-0 min-w-0 flex-1 overflow-hidden"><WorkflowCanvas key={sessionView.graph.revision} graph={sessionView.graph} selectedId={sessionSelected} onSelect={chooseSessionNode} onConnect={() => undefined} onMove={() => undefined} readOnly/></div></div> : <div className="flex h-full min-w-0 flex-1 items-center justify-center px-4 text-center text-sm text-muted-foreground">Select a session to inspect its semantic execution flow.</div>}{showDetailsPanel ? <aside className="w-[320px] shrink-0 border-l @min-[1200px]:w-[360px]">{details}</aside> : null}</main></div>- {overlayPane ? <><ResponsiveDialog open={libraryOpen} onOpenChange={setLibraryOpen} variant="panel" size="lg" mobileVariant="drawer-right" sheetSide="left"><ResponsiveDialog.Header><ResponsiveDialog.Title>Workflows</ResponsiveDialog.Title><ResponsiveDialog.Description>Switch between reusable automations and recorded sessions.</ResponsiveDialog.Description></ResponsiveDialog.Header><ResponsiveDialog.Body className="p-0">{library}</ResponsiveDialog.Body></ResponsiveDialog><ResponsiveDialog open={detailsOpen && Boolean(libraryMode === "sessions" ? sessionView : graph)} onOpenChange={setDetailsOpen} variant="panel" size="lg" mobileVariant="drawer-right" sheetSide="right"><ResponsiveDialog.Header><ResponsiveDialog.Title>{libraryMode === "sessions" ? sessionNode?.name ?? sessionView?.session.label ?? "Session details" : node?.name ?? graph?.name ?? "Workflow details"}</ResponsiveDialog.Title><ResponsiveDialog.Description>{libraryMode === "sessions" ? "Inspect semantic steps, grouped actions, code, and execution receipts without exposing internal session IDs." : "Inspect configuration, runs, versions, variables, and the directory without shrinking the canvas."}</ResponsiveDialog.Description></ResponsiveDialog.Header><ResponsiveDialog.Body className="p-0">{details}</ResponsiveDialog.Body></ResponsiveDialog></> : null}+ {overlayPane ? <><ResponsiveDialog open={libraryOpen} onOpenChange={setLibraryOpen} variant="panel" size="lg" mobileVariant="drawer-right" sheetSide="left"><ResponsiveDialog.Header><ResponsiveDialog.Title>Workflows</ResponsiveDialog.Title><ResponsiveDialog.Description>Switch between reusable automations and recorded sessions.</ResponsiveDialog.Description></ResponsiveDialog.Header><ResponsiveDialog.Body className="p-0">{library}</ResponsiveDialog.Body></ResponsiveDialog><ResponsiveDialog open={detailsOpen && Boolean(libraryMode === "sessions" ? sessionView : graph)} onOpenChange={setDetailsOpen} variant="panel" size="lg" mobileVariant="drawer-right" sheetSide="right"><ResponsiveDialog.Header><ResponsiveDialog.Title>{libraryMode === "sessions" ? sessionNode?.name ?? sessionView?.session.label ?? "Session details" : node?.name ?? graph?.name ?? "Workflow details"}</ResponsiveDialog.Title><ResponsiveDialog.Description>{libraryMode === "sessions" ? "Inspect semantic steps, grouped actions, code, and execution receipts without exposing internal session IDs." : "Inspect configuration, runs, versions, variables, and the directory without shrinking the canvas."}</ResponsiveDialog.Description></ResponsiveDialog.Header><ResponsiveDialog.Body className="p-0"><div inert={busy}>{details}</div></ResponsiveDialog.Body></ResponsiveDialog></> : null}</AppFrame></div>;}diff --git a/frontend/slices/workflows/components/workflow-details.tsx b/frontend/slices/workflows/components/workflow-details.tsxindex 1256502c..4b026ab8 100644--- a/frontend/slices/workflows/components/workflow-details.tsx+++ b/frontend/slices/workflows/components/workflow-details.tsx@@ -25,7 +25,7 @@ const PANELS = [["directory", "Directory", BookOpen],] as const satisfies ReadonlyArray<readonly [WorkflowPanel, string, typeof SlidersHorizontal]>;-export function WorkflowDetails({ graph, graphs, node, run, panel, onPanel, onNode, onDeleteNode, onGraph, onRunSelect, beforeRestore, onRestored, onOptimizerCloned }: {+export function WorkflowDetails({ graph, graphs, node, run, panel, onPanel, onNode, onDeleteNode, onGraph, onRunSelect, runRestore, beforeRestore, onRestored, onOptimizerCloned }: {graph: WorkflowGraph;graphs: WorkflowGraph[];node: WorkflowGraphNode | null;@@ -36,6 +36,7 @@ export function WorkflowDetails({ graph, graphs, node, run, panel, onPanel, onNoonDeleteNode: (id: string) => void;onGraph: (graph: WorkflowGraph) => void;onRunSelect: (run: WorkflowGraphRun) => void;+ runRestore: (fn: () => Promise<void>) => Promise<void>;beforeRestore: () => boolean;onRestored: (graph: WorkflowGraph) => void;onOptimizerCloned: (graph: WorkflowGraph) => void;@@ -57,7 +58,7 @@ export function WorkflowDetails({ graph, graphs, node, run, panel, onPanel, onNo{panel === "optimizer" ? <WorkflowOptimizerPanel graph={graph} onCloned={onOptimizerCloned}/> : null}{panel === "run" ? <WorkflowRunPanel run={run}/> : null}{panel === "history" ? <WorkflowRunHistory graph={graph} onSelect={onRunSelect}/> : null}- {panel === "versions" ? <WorkflowVersionPanel graph={graph} beforeRestore={beforeRestore} onRestored={onRestored}/> : null}+ {panel === "versions" ? <WorkflowVersionPanel graph={graph} runRestore={runRestore} beforeRestore={beforeRestore} onRestored={onRestored}/> : null}{panel === "variables" ? <WorkflowVariablePanel/> : null}{panel === "data" ? <WorkflowDataTablePanel/> : null}{panel === "directory" ? <WorkflowDirectoryPanel/> : null}diff --git a/frontend/slices/workflows/components/workflow-owner-sources.tsx b/frontend/slices/workflows/components/workflow-owner-sources.tsxindex 1a33569f..2e765347 100644--- a/frontend/slices/workflows/components/workflow-owner-sources.tsx+++ b/frontend/slices/workflows/components/workflow-owner-sources.tsx@@ -6,7 +6,7 @@ import { Input } from "@/components/ui/input";import type { WorkflowDiscoveryPage, WorkflowDiscoveryRow } from "@/lib/contracts/workflow-discovery";import type { WorkflowGraph } from "@/lib/contracts/workflow-graph";-export function WorkflowOwnerSources({ beforeCopy, onSelect, onCopied }: { beforeCopy: () => boolean; onSelect: (id: string) => void; onCopied: (graph: WorkflowGraph) => void }) {+export function WorkflowOwnerSources({ runAction, beforeCopy, onSelect, onCopied }: { runAction: (fn: () => Promise<void>) => Promise<void>; beforeCopy: () => boolean; onSelect: (id: string) => void; onCopied: (graph: WorkflowGraph) => Promise<void> }) {const [offset, setOffset] = useState(0), [query, setQuery] = useState("");const [result, setResult] = useState<{ offset: number; page?: WorkflowDiscoveryPage; error?: string } | null>(null);const [error, setError] = useState(""), [busy, setBusy] = useState(false);@@ -23,11 +23,12 @@ export function WorkflowOwnerSources({ beforeCopy, onSelect, onCopied }: { beforconst copy = async (row: WorkflowDiscoveryRow) => {if (busy || !beforeCopy()) return;setBusy(true); setError("");- try {+ await runAction(async () => { try {const response = await fetch("/api/v1/workflows", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ action: "owner_clone", origin_owner: row.owner, graph_id: row.id, expected_revision: row.revision, confirm: true }) });- const body = await response.json(); if (!response.ok) throw new Error(body.error || "Copy failed"); onCopied(body.graph);+ const body = await response.json(); if (!response.ok) throw new Error(body.error || "Copy failed"); await onCopied(body.graph);} catch (cause) { setError(cause instanceof Error ? cause.message : "Copy failed"); }- finally { setBusy(false); }+ finally { setBusy(false); } });+ setBusy(false);};return <div className="flex h-full min-h-0 flex-col gap-2 p-3"><h3 className="text-sm font-semibold">Owner sources</h3>diff --git a/frontend/slices/workflows/components/workflow-version-panel.tsx b/frontend/slices/workflows/components/workflow-version-panel.tsxindex 8b13b00f..92b53eb0 100644--- a/frontend/slices/workflows/components/workflow-version-panel.tsx+++ b/frontend/slices/workflows/components/workflow-version-panel.tsx@@ -4,9 +4,9 @@ import type { WorkflowGraph } from "@/lib/contracts/workflow-graph";import { Button } from "@/components/ui/button";import { ScrollArea } from "@/components/ui/scroll-area";import { listVersions, restoreVersion } from "../lib/api";-export function WorkflowVersionPanel({graph,beforeRestore,onRestored}:{graph:WorkflowGraph;beforeRestore:()=>boolean;onRestored:(graph:WorkflowGraph)=>void}){+export function WorkflowVersionPanel({graph,runRestore,beforeRestore,onRestored}:{graph:WorkflowGraph;runRestore:(fn:()=>Promise<void>)=>Promise<void>;beforeRestore:()=>boolean;onRestored:(graph:WorkflowGraph)=>void}){const[rows,setRows]=useState<Awaited<ReturnType<typeof listVersions>>>([]),[busy,setBusy]=useState(false),[error,setError]=useState("");const load=async()=>setRows(await listVersions(graph.id));useEffect(()=>{let cancelled=false;void listVersions(graph.id).then((value)=>{if(!cancelled)setRows(value);});return()=>{cancelled=true;};},[graph.id]);- const restore=async(revision:string)=>{if(busy||!beforeRestore())return;setBusy(true);setError("");try{const next=await restoreVersion(graph,revision);onRestored(next);await load();}catch(e){setError(e instanceof Error?e.message:"Restore failed");}finally{setBusy(false);}};+ const restore=async(revision:string)=>{if(busy||!beforeRestore())return;setBusy(true);setError("");await runRestore(async()=>{try{const next=await restoreVersion(graph,revision);onRestored(next);await load();}catch(e){setError(e instanceof Error?e.message:"Restore failed");}finally{setBusy(false);}});setBusy(false);};return <ScrollArea className="h-full"><div className="space-y-2 p-3"><div className="text-xs font-semibold">Version history</div>{error&&<p className="text-xs text-destructive">{error}</p>}{rows.map((row)=><div key={`${row.savedAt}-${row.revision}`} className="rounded-lg border p-2"><div className="text-xs font-medium">{new Date(row.savedAt).toLocaleString()}</div><div className="mt-1 text-[10px] text-muted-foreground">{row.reason} · {row.nodeCount} nodes · {row.revision.slice(0,8)}</div>{row.revision!==graph.revision&&<Button className="mt-2" size="sm" variant="outline" disabled={busy} onClick={()=>void restore(row.revision)}>Restore</Button>}</div>)}</div></ScrollArea>;}