A desktop coding agent with free access to frontier models.
TypeScript
fix: required reasons match the cli
ogsamrat3ce638d95b2e
diff --git a/apps/server/src/box/box-required-service.test.ts b/apps/server/src/box/box-required-service.test.tsindex ff9b05ea..7a40fbbd 100644--- a/apps/server/src/box/box-required-service.test.ts+++ b/apps/server/src/box/box-required-service.test.ts@@ -89,11 +89,9 @@ describe("required sandbox: the desktop's projects", () => {expect(status).toMatchObject({ on: true, source: "required", required: true, state: "unavailable" });expect(status.requiredText?.optOut).toBe("Required for new chats on this account. Chats started before keep running where they started.");expect(status.setup).toMatchObject({ need: process.platform === "linux" ? "runtime" : expect.any(String), fallback: "native", declined: false });- // "Not now": chats run here meanwhile, and say so.- const declined = await boxes.setup(workspace, "decline");- expect(declined.setup?.declined).toBe(true);- expect(await boxes.beforePrompt("ses_req_decl1", workspace)).toBeNull();- expect(await boxes.planOutcome("ses_req_decl1", workspace)).toMatchObject({ native: true, source: "required", reason: "setup_declined", required: true, fallback: "native" });+ // No step this app can run here (no backend at all): the chat runs here, as cannot_run (the CLI's reason too).+ expect(await boxes.beforePrompt("ses_req_none1", workspace)).toBeNull();+ expect(await boxes.planOutcome("ses_req_none1", workspace)).toMatchObject({ native: true, source: "required", reason: "cannot_run", required: true, fallback: "native" });});test("a new chat goes in the box; a reopened native chat stays here without waiting (kept_old_chat)", async () => {diff --git a/apps/server/src/box/service.ts b/apps/server/src/box/service.tsindex 24238e23..eb18fc52 100644--- a/apps/server/src/box/service.ts+++ b/apps/server/src/box/service.ts@@ -837,7 +837,9 @@ export class BoxService {const runtime = project.why.runtime ? { runtime: project.why.runtime } : {};if (mode.required && project.why.reason !== "downloading") {const setup = await this.setupFor(project.lastRuntime ?? null).catch(() => null);- const reason = setup?.need === "cannot_run" || project.why.reason === "helpers_missing" ? "cannot_run" : setup?.declined ? "setup_declined" : "setup_needed";+ // As the CLI: only a step this app can run here (Allow, the WSL setup, the VM) is setup; else it cannot run.+ const fixable = setup && ["linux_allow", "win_install", "win_restart", "win_update", "mac_vm"].includes(setup.need);+ const reason = !fixable || project.why.reason === "helpers_missing" ? "cannot_run" : setup.declined ? "setup_declined" : "setup_needed";return native(reason, runtime);}return native(project.why.reason, runtime);diff --git a/apps/server/src/omnirush-gateway-broker.test.ts b/apps/server/src/omnirush-gateway-broker.test.tsindex 8de0e3e5..68d35f6c 100644--- a/apps/server/src/omnirush-gateway-broker.test.ts+++ b/apps/server/src/omnirush-gateway-broker.test.ts@@ -1674,9 +1674,19 @@ describe("OmniRush gateway broker upload keys, account and integrity", () => {engineToken: "local-engine-token",fetch: async () => Response.json({ schema_versions: [2, 3], canonical_trace: true, local_box: localBox }),});- expect((await make().sessionUploadCapabilities()).local_box).toEqual({ default: "on", max_turn_bytes: 268435456, backends: ["bwrap", "podman"] });+ // An older server: not required, no prefetch.+ expect((await make().sessionUploadCapabilities()).local_box).toEqual({ default: "on", max_turn_bytes: 268435456, backends: ["bwrap", "podman"], required: false, required_fallback: null, setup: { prefetch: false } });localBox = { default: "offer", backends: null };- expect((await make().sessionUploadCapabilities()).local_box).toEqual({ default: "offer", max_turn_bytes: null, backends: null });+ expect((await make().sessionUploadCapabilities()).local_box).toEqual({ default: "offer", max_turn_bytes: null, backends: null, required: false, required_fallback: null, setup: { prefetch: false } });+ });++ test("the Linux sandbox block keeps required, its fallback and prefetch", async () => {+ const broker = new OmniRushGatewayBroker({+ credentials,+ engineToken: "local-engine-token",+ fetch: async () => Response.json({ schema_versions: [2, 3], canonical_trace: true, local_box: { default: "on", required: true, required_fallback: "native_uncounted", setup: { prefetch: true }, backends: null } }),+ });+ expect((await broker.sessionUploadCapabilities()).local_box).toEqual({ default: "on", max_turn_bytes: null, backends: null, required: true, required_fallback: "native_uncounted", setup: { prefetch: true } });});test("the automatic compaction block is passed on, and maxAgeMs asks the server again", async () => {