|
| 1 | +// Workspace tests cover bootstrap seeding, attestation safety, bootstrap file |
| 2 | +// filtering, and setup-completion state for agent workspaces. |
1 | 3 | import { createHash } from "node:crypto"; |
2 | 4 | import fs from "node:fs/promises"; |
3 | 5 | import os from "node:os"; |
@@ -90,6 +92,8 @@ async function expectWorkspaceVanished( |
90 | 92 | action: Promise<unknown>, |
91 | 93 | expected?: { attestationPath?: string }, |
92 | 94 | ): Promise<void> { |
| 95 | + // Recently attested generated workspaces must not be silently recreated after |
| 96 | + // deletion or wipe; that could hide user data loss. |
93 | 97 | await expect(action).rejects.toMatchObject({ |
94 | 98 | code: WORKSPACE_VANISHED_ERROR_CODE, |
95 | 99 | name: "WorkspaceVanishedError", |
@@ -221,6 +225,8 @@ describe("ensureAgentWorkspace", () => { |
221 | 225 | }); |
222 | 226 |
|
223 | 227 | it("accepts a recently attested workspace when customized AGENTS.md survives", async () => { |
| 228 | + // Custom instructions prove the directory is user-managed, so reseeding is |
| 229 | + // skipped and the workspace is accepted. |
224 | 230 | const tempDir = await makeTempWorkspace("openclaw-workspace-"); |
225 | 231 | await ensureAgentWorkspace({ dir: tempDir, ensureBootstrapFiles: true }); |
226 | 232 | await fs.writeFile(path.join(tempDir, DEFAULT_AGENTS_FILENAME), "custom instructions\n"); |
|
0 commit comments