A desktop coding agent with free access to frontier models.
TypeScript
fix: setup hold for any box being set up
ogsamrat2b262eb8802c
diff --git a/apps/app/src/react-app/domains/settings/linux-sandbox.ts b/apps/app/src/react-app/domains/settings/linux-sandbox.tsindex 99e34da9..60d251cf 100644--- a/apps/app/src/react-app/domains/settings/linux-sandbox.ts+++ b/apps/app/src/react-app/domains/settings/linux-sandbox.ts@@ -213,9 +213,14 @@ export type LinuxSandboxProblem = { message: string; retry: (() => void) | null* while it moves, and when the window comes back), the switch (shown at* once, before the server answers), the backend, Retry and Reset.*/-/** Whether the local server holds a new chat's prompt for this box (box/service.ts waitForBox): required, on, downloading or starting. */-export function sandboxSetupHolds(box: Pick<OmniRushWorkspaceBox, "required" | "on" | "state"> | null): boolean {- return Boolean(box?.required && box.on && (box.state === "downloading" || box.state === "starting"));+/**+ * Whether this project's box is being set up for its chats (on, downloading+ * or starting), whatever turned it on: the required level, the user, a model+ * that runs only in the box. A send then may be held by the local server until+ * the box is ready (box/service.ts waitForBox), so it waits rather than goes "unknown".+ */+export function sandboxSetupHolds(box: Pick<OmniRushWorkspaceBox, "on" | "state"> | null): boolean {+ return Boolean(box?.on && (box.state === "downloading" || box.state === "starting"));}export function useLinuxSandbox(client: LinuxSandboxClient | null, workspaceId: string | null, { fresh: freshOnOpen = true, sessionId = null }: { fresh?: boolean; sessionId?: string | null } = {}) {@@ -261,7 +266,7 @@ export function useLinuxSandbox(client: LinuxSandboxClient | null, workspaceId:if (boxFor.current === workspaceId) reportSandboxFallback(workspaceId, box);}, [box, workspaceId]);- // The local server holds this project's prompts while its required box is set up: a send then waits, not "unknown".+ // While this project's box is set up the local server may hold its prompts: a send then waits, not "unknown".useEffect(() => {if (workspaceId && boxFor.current === workspaceId) setSandboxSetupHold(workspaceId, sandboxSetupHolds(box));}, [box, workspaceId]);diff --git a/apps/app/tests/sandbox-setup-hold.test.ts b/apps/app/tests/sandbox-setup-hold.test.tsnew file mode 100644index 00000000..48de8a8a--- /dev/null+++ b/apps/app/tests/sandbox-setup-hold.test.ts@@ -0,0 +1,19 @@+import { describe, expect, test } from "bun:test";++import { sandboxSetupHolds } from "../src/react-app/domains/settings/linux-sandbox";++describe("sandbox setup hold", () => {+ test("holds while the box is on and downloading or starting, whatever turned it on", () => {+ expect(sandboxSetupHolds({ on: true, state: "downloading" })).toBe(true);+ expect(sandboxSetupHolds({ on: true, state: "starting" })).toBe(true);+ // Turned on by the user (the offer level), not required.+ expect(sandboxSetupHolds({ on: true, required: false, state: "downloading" } as never)).toBe(true);+ });++ test("no hold once ready, failed or off", () => {+ expect(sandboxSetupHolds({ on: true, state: "ready" })).toBe(false);+ expect(sandboxSetupHolds({ on: true, state: "failed" })).toBe(false);+ expect(sandboxSetupHolds({ on: false, state: "downloading" })).toBe(false);+ expect(sandboxSetupHolds(null)).toBe(false);+ });+});