






















@@ -155,6 +155,55 @@ describe("ensureAgentWorkspace", () => {
155155await expectCompletedWithoutBootstrap(tempDir);
156156});
157157158+it("skips configured optional bootstrap files without skipping required files", async () => {
159+const tempDir = await makeTempWorkspace("openclaw-workspace-");
160+161+await ensureAgentWorkspace({
162+dir: tempDir,
163+ensureBootstrapFiles: true,
164+skipOptionalBootstrapFiles: [
165+DEFAULT_SOUL_FILENAME,
166+DEFAULT_IDENTITY_FILENAME,
167+DEFAULT_USER_FILENAME,
168+DEFAULT_HEARTBEAT_FILENAME,
169+],
170+});
171+172+await expect(fs.access(path.join(tempDir, DEFAULT_AGENTS_FILENAME))).resolves.toBeUndefined();
173+await expect(fs.access(path.join(tempDir, DEFAULT_TOOLS_FILENAME))).resolves.toBeUndefined();
174+await expect(
175+fs.access(path.join(tempDir, DEFAULT_BOOTSTRAP_FILENAME)),
176+).resolves.toBeUndefined();
177+for (const fileName of [
178+DEFAULT_SOUL_FILENAME,
179+DEFAULT_IDENTITY_FILENAME,
180+DEFAULT_USER_FILENAME,
181+DEFAULT_HEARTBEAT_FILENAME,
182+]) {
183+await expect(fs.access(path.join(tempDir, fileName))).rejects.toMatchObject({
184+code: "ENOENT",
185+});
186+}
187+});
188+189+it("preserves legacy setup detection when skipped profile files already exist", async () => {
190+const tempDir = await makeTempWorkspace("openclaw-workspace-");
191+await writeWorkspaceFile({ dir: tempDir, name: DEFAULT_IDENTITY_FILENAME, content: "custom" });
192+await writeWorkspaceFile({ dir: tempDir, name: DEFAULT_USER_FILENAME, content: "custom" });
193+194+await ensureAgentWorkspace({
195+dir: tempDir,
196+ensureBootstrapFiles: true,
197+skipOptionalBootstrapFiles: [DEFAULT_IDENTITY_FILENAME, DEFAULT_USER_FILENAME],
198+});
199+200+await expect(fs.access(path.join(tempDir, DEFAULT_BOOTSTRAP_FILENAME))).rejects.toMatchObject({
201+code: "ENOENT",
202+});
203+const state = await readWorkspaceState(tempDir);
204+expect(state.setupCompletedAt).toMatch(/\d{4}-\d{2}-\d{2}T/);
205+});
206+158207it("migrates legacy onboardingCompletedAt markers to setupCompletedAt", async () => {
159208const tempDir = await makeTempWorkspace("openclaw-workspace-");
160209await fs.mkdir(path.join(tempDir, ".openclaw"), { recursive: true });
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。