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(extensions): lock project controls until initial inspection

Rahmane7fe02674ae8
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 39cccfb3..bbade613 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -12,6 +12,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Fixed**
+- `extensions` lock project controls until initial inspection
- `browser` diagnose secure viewer failures without losing power state
**Tests**
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 24dc81c0..7ca2dcab 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,17 @@
+## 2026-09-18 — Keep MCP target controls locked until their first inspection
+
+PR release verification caught the mobile MCP journey leaving Use project disabled after
+an early fill. The installation hook originally rendered busy=false with no snapshot,
+then disabled the controls on a deferred initial inspection. Start busy instead so there
+is no initially interactive, uninspected target. Mutations still require an inspected
+revision; backend authorization, target selection and all existing assertions are unchanged.
+
+A regression reproduces the incorrect first-render state for host, named and path targets.
+The browser journey now holds the initial inspection request, verifies disabled controls,
+releases it, checks readiness and the entered value, then performs the same real
+install/uninstall flow across desktop, portrait and landscape. No retries, timing sleeps,
+coverage reductions or skipped checks hide the original CI failure.
+
## 2026-09-18 — Inspect Organization fixture permissions and bytes on one descriptor
The combined release's hosted CodeQL scan identified a filesystem race in the new
diff --git a/frontend/slices/extensions/use-mcp-installations.test.tsx b/frontend/slices/extensions/use-mcp-installations.test.tsx
new file mode 100644
index 00000000..3ae9eb80
--- /dev/null
+++ b/frontend/slices/extensions/use-mcp-installations.test.tsx
@@ -0,0 +1,24 @@
+import { createElement } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { useMcpInstallations } from "./use-mcp-installations";
+
+afterEach(() => vi.unstubAllGlobals());
+describe("MCP installation initial readiness", () => {
+ it.each(["@host", "fixture-project", "/tmp/mso-fixture-project"])("keeps %s busy before its first inspection", project => {
+ function Probe() {
+ const state = useMcpInstallations(project);
+ return createElement("output", { "data-busy": String(state.busy), "data-snapshot": state.snapshot ? "ready" : "missing" });
+ }
+ expect(renderToStaticMarkup(createElement(Probe))).toContain('data-busy="true"');
+ });
+ it("does not mutate an uninspected target", async () => {
+ const fetcher = vi.fn(); vi.stubGlobal("fetch", fetcher);
+ let mutation: ReturnType<typeof useMcpInstallations>["mutate"] | undefined;
+ function Probe() { mutation = useMcpInstallations("@host").mutate; return null; }
+ renderToStaticMarkup(createElement(Probe));
+ expect(mutation).toBeDefined();
+ await expect(mutation!("upsert", { server: "si-coder", plugin: "si-coder" })).resolves.toBe(false);
+ expect(fetcher).not.toHaveBeenCalled();
+ });
+});
diff --git a/frontend/slices/extensions/use-mcp-installations.ts b/frontend/slices/extensions/use-mcp-installations.ts
index 73ac0459..eabb0e9a 100644
--- a/frontend/slices/extensions/use-mcp-installations.ts
+++ b/frontend/slices/extensions/use-mcp-installations.ts
@@ -12,7 +12,8 @@ async function request(args: object, signal?: AbortSignal) {
}
export function useMcpInstallations(project: string) {
const [snapshot, setSnapshot] = useState<McpSnapshot | null>(null);
- const [busy, setBusy] = useState(false), [error, setError] = useState("");
+ // Keep target controls locked from the first render until inspection finishes.
+ const [busy, setBusy] = useState(true), [error, setError] = useState("");
const generation = useRef(0), source = useRef(Symbol("mcp-installations"));
const reload = useCallback(async (signal?: AbortSignal) => {
const epoch = ++generation.current;
diff --git a/scripts/e2e/mcp-settings.mjs b/scripts/e2e/mcp-settings.mjs
index bd71b953..42764a75 100644
--- a/scripts/e2e/mcp-settings.mjs
+++ b/scripts/e2e/mcp-settings.mjs
@@ -26,6 +26,33 @@ export async function mcpPublicJourney(page) {
expect(privateRequests).toBe(0);
page.off("request", listener);
}
+async function chooseProjectTarget(page, fixture) {
+ let release = () => {};
+ const held = new Promise(resolve => { release = resolve; });
+ const initial = request => {
+ if (!request.url().endsWith("/api/v1/project-mcp") || request.method() !== "POST") return false;
+ const body = request.postDataJSON();
+ return body?.action === "inspect" && body.project === "@host";
+ };
+ const hold = async route => { if (initial(route.request())) await held; await route.continue(); };
+ await page.route("**/api/v1/project-mcp", hold);
+ try {
+ const request = page.waitForRequest(initial, { timeout: 10000 });
+ await page.getByRole("tab", { name: /MSO to External/ }).click();
+ await request;
+ const input = page.getByLabel("Exact MCP target project");
+ const useProject = page.getByRole("button", { name: "Use project", exact: true });
+ await expect(input).toBeDisabled();
+ await expect(useProject).toBeDisabled();
+ release();
+ await expect(input).toBeEnabled();
+ await expect(page.getByText("Each project starts with no SI-Coder or Batonly binding.", { exact: false })).toBeVisible();
+ await input.fill(fixture.dir);
+ await expect(input).toHaveValue(fixture.dir);
+ await expect(useProject).toBeEnabled();
+ await useProject.click();
+ } finally { release(); await page.unroute("**/api/v1/project-mcp", hold); }
+}
export async function mcpOwnerJourneys(page, fixture) {
const errors = [];
page.on("pageerror", error => errors.push(error.message));
@@ -58,11 +85,7 @@ export async function mcpOwnerJourneys(page, fixture) {
await page.getByRole("button", { name: "Show expired & disconnected", exact: true }).click();
await expect(page.getByText("Read data · revoked", { exact: true })).toBeVisible();
await nav.getByRole("button", { name: "MCP overview", exact: true }).click();
- await page.getByRole("tab", { name: /MSO to External/ }).click();
- await expect(page.getByText("Each project starts with no SI-Coder or Batonly binding.", { exact: false })).toBeVisible();
- await page.getByLabel("Exact MCP target project").fill(fixture.dir);
- await expect(page.getByRole("button", { name: "Use project", exact: true })).toBeEnabled();
- await page.getByRole("button", { name: "Use project", exact: true }).click();
+ await chooseProjectTarget(page, fixture);
const siCoder = page.getByRole("article").filter({ has: page.getByRole("heading", { name: "SI-Coder", exact: true }) });
await expect(siCoder.getByRole("button", { name: "Install", exact: true })).toBeEnabled();
page.once("dialog", dialog => dialog.accept());