style: format sandbox and helper files

This commit is contained in:
Peter Steinberger 2026-03-31 18:44:39 +01:00
parent 5e0e46f405
commit 62e13bbf21
No known key found for this signature in database
6 changed files with 11 additions and 12 deletions

View File

@ -46,7 +46,9 @@ function toExecLikeRequest(request: ApprovalRequest): ExecApprovalRequest {
};
}
function extractSlackSessionKind(sessionKey?: string | null): "direct" | "channel" | "group" | null {
function extractSlackSessionKind(
sessionKey?: string | null,
): "direct" | "channel" | "group" | null {
if (!sessionKey) {
return null;
}

View File

@ -1,7 +1,7 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { collectDockerFlagValues, findDockerArgsCall } from "./test-args.js";
import { SANDBOX_MOUNT_FORMAT_VERSION } from "./workspace-mounts.js";
import type { SandboxConfig } from "./types.js";
import { SANDBOX_MOUNT_FORMAT_VERSION } from "./workspace-mounts.js";
let BROWSER_BRIDGES: Map<string, unknown>;
let ensureSandboxBrowser: typeof import("./browser.js").ensureSandboxBrowser;

View File

@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import { computeSandboxBrowserConfigHash, computeSandboxConfigHash } from "./config-hash.js";
import { SANDBOX_MOUNT_FORMAT_VERSION } from "./workspace-mounts.js";
import type { SandboxDockerConfig } from "./types.js";
import { SANDBOX_MOUNT_FORMAT_VERSION } from "./workspace-mounts.js";
function createDockerConfig(overrides?: Partial<SandboxDockerConfig>): SandboxDockerConfig {
return {

View File

@ -3,8 +3,8 @@ import { Readable } from "node:stream";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { computeSandboxConfigHash } from "./config-hash.js";
import { collectDockerFlagValues } from "./test-args.js";
import { SANDBOX_MOUNT_FORMAT_VERSION } from "./workspace-mounts.js";
import type { SandboxConfig } from "./types.js";
import { SANDBOX_MOUNT_FORMAT_VERSION } from "./workspace-mounts.js";
type SpawnCall = {
command: string;
@ -336,6 +336,8 @@ describe("ensureSandboxContainer config-hash recreation", () => {
(call) => call.command === "docker" && call.args[0] === "create",
);
expect(createCall).toBeDefined();
expect(createCall?.args).toContain(`openclaw.mountFormatVersion=${SANDBOX_MOUNT_FORMAT_VERSION}`);
expect(createCall?.args).toContain(
`openclaw.mountFormatVersion=${SANDBOX_MOUNT_FORMAT_VERSION}`,
);
});
});

View File

@ -58,9 +58,6 @@ describe("appendWorkspaceMountArgs", () => {
});
const mounts = args.filter((arg) => arg.startsWith("/tmp/"));
expect(mounts).toEqual([
"/tmp/workspace:/workspace:ro,z",
"/tmp/agent-workspace:/agent:ro,z",
]);
expect(mounts).toEqual(["/tmp/workspace:/workspace:ro,z", "/tmp/agent-workspace:/agent:ro,z"]);
});
});

View File

@ -324,9 +324,7 @@ export function resolveMemorySlotDecision(params: {
// memory slot must stay enabled so its other slot role can still load.
const isMultiKind = Array.isArray(params.kind) && params.kind.length > 1;
if (params.slot === null) {
return isMultiKind
? { enabled: true }
: { enabled: false, reason: "memory slot disabled" };
return isMultiKind ? { enabled: true } : { enabled: false, reason: "memory slot disabled" };
}
if (typeof params.slot === "string") {
if (params.slot === params.id) {