惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
G
Google Developers Blog
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
J
Java Code Geeks
U
Unit 42
云风的 BLOG
云风的 BLOG
阮一峰的网络日志
阮一峰的网络日志
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Docker
V
Visual Studio Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
V
V2EX
T
Tailwind CSS Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test: fold sandbox skill sync coverage · openclaw/opencla...
steipete · 2026-04-24 · via Recent Commits to openclaw:main

@@ -1,14 +1,47 @@

1-

import { describe, expect, it, vi } from "vitest";

1+

import fs from "node:fs/promises";

2+

import os from "node:os";

3+

import path from "node:path";

4+

import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";

25

import type { OpenClawConfig } from "../config/config.js";

36

import { registerSandboxBackend } from "./sandbox/backend.js";

47

import { ensureSandboxWorkspaceForSession, resolveSandboxContext } from "./sandbox/context.js";

5869

const updateRegistryMock = vi.hoisted(() => vi.fn());

10+

const syncSkillsToWorkspaceMock = vi.hoisted(() => vi.fn(async () => undefined));

711812

vi.mock("./sandbox/registry.js", () => ({

913

updateRegistry: updateRegistryMock,

1014

}));

111516+

vi.mock("../infra/skills-remote.js", () => ({

17+

getRemoteSkillEligibility: vi.fn(() => ({ note: "test-remote" })),

18+

}));

19+20+

vi.mock("./exec-defaults.js", () => ({

21+

canExecRequestNode: vi.fn(() => false),

22+

}));

23+24+

vi.mock("./skills.js", () => ({

25+

syncSkillsToWorkspace: syncSkillsToWorkspaceMock,

26+

}));

27+28+

let sandboxFixtureRoot = "";

29+

let sandboxFixtureCount = 0;

30+31+

async function createSandboxFixtureDir(prefix: string): Promise<string> {

32+

const dir = path.join(sandboxFixtureRoot, `${prefix}-${sandboxFixtureCount++}`);

33+

await fs.mkdir(dir, { recursive: true });

34+

return dir;

35+

}

36+37+

beforeAll(async () => {

38+

sandboxFixtureRoot = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-sandbox-context-"));

39+

});

40+41+

afterAll(async () => {

42+

await fs.rm(sandboxFixtureRoot, { recursive: true, force: true });

43+

});

44+1245

describe("resolveSandboxContext", () => {

1346

it("does not sandbox the agent main session in non-main mode", async () => {

1447

const cfg: OpenClawConfig = {

@@ -138,4 +171,40 @@ describe("resolveSandboxContext", () => {

138171

restore();

139172

}

140173

}, 15_000);

174+175+

it("requests skill sync for read-only sandbox workspaces", async () => {

176+

syncSkillsToWorkspaceMock.mockClear();

177+

const bundledDir = await createSandboxFixtureDir("bundled");

178+

const workspaceDir = await createSandboxFixtureDir("workspace");

179+180+

const cfg: OpenClawConfig = {

181+

agents: {

182+

defaults: {

183+

sandbox: {

184+

mode: "all",

185+

scope: "session",

186+

workspaceAccess: "ro",

187+

workspaceRoot: path.join(bundledDir, "sandboxes"),

188+

},

189+

},

190+

},

191+

};

192+193+

const result = await ensureSandboxWorkspaceForSession({

194+

config: cfg,

195+

sessionKey: "agent:main:main",

196+

workspaceDir,

197+

});

198+199+

expect(result).not.toBeNull();

200+

expect(syncSkillsToWorkspaceMock).toHaveBeenCalledWith(

201+

expect.objectContaining({

202+

sourceWorkspaceDir: workspaceDir,

203+

targetWorkspaceDir: result?.workspaceDir,

204+

config: cfg,

205+

agentId: "main",

206+

eligibility: { remote: { note: "test-remote" } },

207+

}),

208+

);

209+

}, 15_000);

141210

});