Skip to content

armgit / mso

Public Imported from GitHub
0

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.

fix(workflows): serialize toolbar actions

Abdurrahman Fakhrulf765880b89df
diff --git a/docs/evidence/2026-11-04-frontend-agents.md b/docs/evidence/2026-11-04-frontend-agents.md
index 62d3759a..bbbab0f4 100644
--- a/docs/evidence/2026-11-04-frontend-agents.md
+++ b/docs/evidence/2026-11-04-frontend-agents.md
@@ -7,7 +7,7 @@ Base: origin/main 266c24cb. This is implementation evidence, not a release or br
| AD-01 | Opening a form returned early and unmounted ChatPanel. The app now hides its mounted frame while rendering a form, preserving the same ChatPanel runner, wire-history ref and thread persistence refs for the lifetime of the mounted Assistant window. Shell remount persistence still requires verification. |
| AD-02, AD-10, AC-01 | Channels and groups capture the revision in each editor session, keep a stable new-editor key, guard dirty dismissal, reject older load responses and expose latest saved fields alongside a retained draft after failed save. Adopting the latest revision is an explicit overwrite choice. State stays local to each app/editor. A mocked two-writer ChannelEditor fixture confirms a revision-10 draft does not overwrite revision 11; group parity and browser interactions remain untested. |
| AD-03, WF-01 | Duplicate asks to save a dirty graph before cloning. Owner-source copy and version restore call the existing dirty guard before mutation. Workflow state remains owned by the exact window. |
-| WF-02 | Delete confirms the named graph and warns about dirty changes; existing busy/error state handles feedback. A synchronous double-activation test remains outstanding. |
+| WF-02 | Delete confirms the named graph and warns about dirty changes; a synchronous per-window action guard and busy/error state handle repeat activation and feedback. A double-activation test remains outstanding. |
| AD-04, AD-11 | Organization editor confirms named deletion and uses pending/error state; narrow unit and seat actions have accessible names and titles. |
| AD-05 | Variable save/delete have pending guards; delete names and confirms the variable, failures are reported, and fields are named. |
| AD-06 | Form fields associate individual controls with unique labels and hints; multi-control pickers use fieldsets. Static rendering tests cover associations. |
diff --git a/frontend/slices/workflows/app.tsx b/frontend/slices/workflows/app.tsx
index 7447a944..30e11b66 100644
--- a/frontend/slices/workflows/app.tsx
+++ b/frontend/slices/workflows/app.tsx
@@ -23,6 +23,8 @@ import { tidyWorkflowNodes } from "./lib/canvas-layout";
import { buildWorkflowPackage, workflowPackageFilename, type WorkflowDefinition } from "./lib/portability";
import { cloneGraph, createFromTemplate, createGraph, deleteGraph, getGraph, getSessionGraph, listGraphs, resolveNode, runGraph, runStatus, saveSessionWorkflowDraft, updateGraph } from "./lib/api";
+function createActionLock() { let active = false; return async (fn: () => Promise<void>) => { if (active) return; active = true; try { await fn(); } finally { active = false; } }; }
+
type LibraryMode = "automations" | "sessions" | "sources";
function starterGraph(): WorkflowDefinition { return { name: "New Workflow", description: "Private workflow graph.", status: "draft", inputs: {}, metadata: { provenance: "user" }, nodes: [{ id: "manual", name: "Manual Trigger", type: "manual", position: { x: 80, y: 160 }, config: {} }, { id: "output", name: "Output", type: "output", position: { x: 420, y: 160 }, config: {} }], edges: [{ id: "edge-start", source: "manual", target: "output" }] }; }
function payloadSessionId(payload: unknown): string | undefined { if (!payload || typeof payload !== "object") return undefined; const row = payload as { view?: unknown; sessionId?: unknown }; return row.view === "sessions" && typeof row.sessionId === "string" ? row.sessionId : undefined; }
@@ -66,7 +68,8 @@ export default function WorkflowsApp(props: AppProps) {
return () => { alive = false; };
}, [props.payload, setLibraryMode, setSessionSelected, setSessionView]);
- const wrap = async (fn: () => Promise<void>) => { setBusy(true); setMessage(""); try { await fn(); } catch (error) { setMessage(error instanceof Error ? error.message : "Action failed"); } finally { setBusy(false); } };
+ 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 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); };