A desktop coding agent with free access to frontier models.
TypeScript
fix: macOS sandbox advice names the right version and no docker group
ogsamrat57155b8c2bc6
diff --git a/apps/app/src/react-app/domains/settings/linux-sandbox.ts b/apps/app/src/react-app/domains/settings/linux-sandbox.tsindex e4fc09d6..45e130c2 100644--- a/apps/app/src/react-app/domains/settings/linux-sandbox.ts+++ b/apps/app/src/react-app/domains/settings/linux-sandbox.ts@@ -70,6 +70,9 @@ function stepFor(reason: string, platform: string | undefined): LinuxSandboxNextif (/Docker Desktop is installed but not running|Docker is installed but not running/.test(reason)) {return { title: "Start your container app", detail: "Open Docker Desktop, OrbStack or colima, wait until it is running, then check again.", command: null };}+ if (/another macOS user/.test(reason)) {+ return { title: "Start your container app", detail: "Docker here belongs to another account on this Mac. Open Docker Desktop, OrbStack or colima in this account, then check again.", command: null };+ }if (/Docker daemon is not running/.test(reason)) return { title: "Start Docker", detail: "Run this in a terminal, then check again.", command: "sudo systemctl start docker" };return null;}diff --git a/apps/server/src/box/backends/apple.ts b/apps/server/src/box/backends/apple.tsindex bccdf360..30b4d69b 100644--- a/apps/server/src/box/backends/apple.ts+++ b/apps/server/src/box/backends/apple.ts@@ -52,10 +52,28 @@ export function findAppleBin({ env = process.env, exists = existsSync }: { env?:return null;}-/** macOS major version from the Darwin kernel release (Darwin 25 = macOS 26). */-export function macosMajor(release = os.release()): number | null {+const SYSTEM_VERSION = "/System/Library/CoreServices/SystemVersion.plist";++/** This Mac's ProductVersion ("27.0.1") from SystemVersion.plist, or null. */+export function systemProductVersion(read: (file: string) => string = (file) => readFileSync(file, "utf8")): string | null {+ try {+ const match = /<key>ProductVersion<\/key>\s*<string>(\d+(?:\.\d+)*)<\/string>/.exec(read(SYSTEM_VERSION));+ return match?.[1] ?? null;+ } catch {+ return null;+ }+}++/**+ * macOS major version: this Mac's own ProductVersion when asked about this+ * machine, else from the Darwin release (20-24 = macOS 11-15, 25 = macOS 26).+ */+export function macosMajor(release = os.release(), product: string | null = release === os.release() ? systemProductVersion() : null): number | null {+ const own = Number.parseInt(String(product ?? ""), 10);+ if (Number.isFinite(own) && own >= 10) return own;const darwin = Number.parseInt(String(release).split(".")[0] ?? "", 10);- return Number.isFinite(darwin) && darwin >= 20 ? darwin + 1 : null;+ if (!Number.isFinite(darwin) || darwin < 20) return null;+ return darwin <= 24 ? darwin - 9 : darwin + 1;}function record(value: unknown): Record<string, unknown> {diff --git a/apps/server/src/box/box-backends.test.ts b/apps/server/src/box/box-backends.test.tsindex 3829d307..2af67172 100644--- a/apps/server/src/box/box-backends.test.ts+++ b/apps/server/src/box/box-backends.test.ts@@ -15,7 +15,7 @@ import { PassThrough } from "node:stream";import { OPT_IN, BACKENDS, backendsFor, detectBackend, driverFor, normalizeBackend, ORDER } from "./backends/index.js";import { apparmorProfile, boxdEnv, boxrunPath, explainProbe, parseOut, probeBwrap, upArgs } from "./backends/bwrap.js";-import { createAppleArgs, findDigest, macosMajor, parseVersions, probeApple, snapshotInfo, SUPPORTED as APPLE } from "./backends/apple.js";+import { createAppleArgs, findDigest, macosMajor, parseVersions, probeApple, snapshotInfo, SUPPORTED as APPLE, systemProductVersion } from "./backends/apple.js";import { versionAtLeast } from "./backends/shared.js";import { decodeWsl, download, ENABLE_HINT, inDistro, parseWslList, probeWslDistro, startKeeper } from "./backends/wsl.js";import { createWslcArgs, labelsOf, parseJsonRows, parseWslcVersion, probeWslc, UPDATE_HINT } from "./backends/wslc.js";@@ -189,8 +189,14 @@ const appleVersions = [{ appName: "container", version: "1.5.0", buildType: "reldescribe("box backends: macOS", () => {test("Apple container: macOS 26 on Apple silicon, the 1.x line, its service running", async () => {- expect(macosMajor("25.0.0")).toBe(26);- expect(macosMajor("24.6.0")).toBe(25);+ expect(macosMajor("25.0.0", null)).toBe(26);+ expect(macosMajor("24.6.0", null)).toBe(15);+ expect(macosMajor("20.1.0", null)).toBe(11);+ expect(macosMajor("19.6.0", null)).toBe(null);+ // This Mac's own version wins over the kernel number (macOS 27.0.1 reports Darwin 27.0.0).+ expect(macosMajor("27.0.0", "27.0.1")).toBe(27);+ expect(systemProductVersion(() => "<dict><key>ProductVersion</key>\n\t<string>27.0.1</string></dict>")).toBe("27.0.1");+ expect(systemProductVersion(() => { throw new Error("ENOENT"); })).toBe(null);expect(parseVersions(JSON.stringify(appleVersions))).toEqual({ version: "1.5.0", server: "1.5.0" });expect(parseVersions("container CLI version 0.5.0 (build: release, commit: 1234)").version).toBe("0.5.0");const base = { platform: "darwin" as const, arch: "arm64", release: "25.1.0", env: { PATH: "/usr/bin" }, exists: set(APPLE_BIN) };@@ -201,7 +207,7 @@ describe("box backends: macOS", () => {return r.ok ? "" : r.reason;};expect(await reason(good, { arch: "x64" })).toMatch(/Apple silicon/);- expect(await reason(good, { release: "24.6.0" })).toMatch(/macOS 26 or later \(this is macOS 25\)/);+ expect(await reason(good, { release: "24.6.0" })).toMatch(/macOS 26 or later \(this is macOS 15\)/);expect(await reason(good, { exists: () => false })).toMatch(/not installed/);expect(await reason(async (_b, args) => (args[1] === "version" ? ok([{ appName: "container", version: "0.11.0" }]) : ok("")))).toMatch(/0\.11\.0 is outside the supported 1\.x line/);expect((await probeApple({ ...base, run: async (_b, args) => (args[1] === "version" ? ok([{ appName: "container", version: "2.0.0" }]) : ok("")) })).ok).toBe(false);diff --git a/apps/server/src/box/box.test.ts b/apps/server/src/box/box.test.tsindex 2c9b354f..fdc341d0 100644--- a/apps/server/src/box/box.test.ts+++ b/apps/server/src/box/box.test.ts@@ -61,6 +61,9 @@ describe("box runtime", () => {test("failures read as one line for the user", () => {expect(explainFailure("docker", { code: 1, stderr: "permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock" })).toContain("docker group");+ const mac = explainFailure("docker", { code: 1, stderr: "permission denied while trying to connect to the docker API at unix:///var/run/docker.sock" }, { platform: "darwin", env: {}, exists: () => true });+ expect(mac).toContain("another macOS user");+ expect(mac).not.toMatch(/usermod|docker group/);expect(explainFailure("docker", { code: 1, stderr: "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?" }, { platform: "darwin" })).toContain("start Docker Desktop");expect(explainFailure("docker", { code: -1, stderr: "", error: "ENOENT" })).toBe("docker is not installed");// Docker 29's wording, and a stopped daemon told by its missing socket whatever the words.diff --git a/apps/server/src/box/runtime.ts b/apps/server/src/box/runtime.tsindex 8d2aca14..116351d3 100644--- a/apps/server/src/box/runtime.ts+++ b/apps/server/src/box/runtime.ts@@ -196,6 +196,8 @@ export function explainFailure(name: string, result: Partial<RunResult>, { platfif (result.error === "timeout") return `${name} did not answer in time (is it starting?)`;const notRunning = platform === "linux" ? "the Docker daemon is not running" : "Docker is installed but not running (start Docker Desktop, OrbStack or colima)";if (name === "docker" && /permission denied/i.test(said) && /docker\.sock|docker daemon socket|docker api/i.test(said)) {+ // macOS has no docker group: the socket is another account's (Docker Desktop links /var/run/docker.sock to its user's home).+ if (platform === "darwin") return "Docker's socket belongs to another macOS user (their Docker Desktop); start Docker Desktop, OrbStack or colima in this account";return "Docker refused this user (add it to the docker group: `sudo usermod -aG docker $USER`, then log in again), or use rootless Podman";}if (name === "docker" && result.code !== 0) {