mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-23 02:45:38 -06:00
fix(agents): preserve migrated configured workspaces (#125435)
Amp-Thread-ID: https://ampcode.com/threads/T-01a00a6a-b64e-74a5-8b15-2d3b966a468d Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
committed by
GitHub
parent
6e458d84bf
commit
daafb2bf5c
@@ -21,6 +21,7 @@ import {
|
||||
import {
|
||||
DEFAULT_AGENTS_FILENAME,
|
||||
DEFAULT_BOOTSTRAP_FILENAME,
|
||||
DEFAULT_IDENTITY_FILENAME,
|
||||
ensureAgentWorkspace,
|
||||
WORKSPACE_VANISHED_ERROR_CODE,
|
||||
} from "./workspace.js";
|
||||
@@ -114,6 +115,20 @@ describe("workspace setup-only SQLite safety", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("accepts a customized profile with migrated setup-only state", async () => {
|
||||
const tempDir = await makeTempWorkspace("openclaw-workspace-");
|
||||
const identityPath = path.join(tempDir, DEFAULT_IDENTITY_FILENAME);
|
||||
await fs.writeFile(identityPath, "# Existing identity\n");
|
||||
mergeWorkspaceSetupState(tempDir, {
|
||||
setupCompletedAt: "2026-07-15T10:01:00.000Z",
|
||||
});
|
||||
|
||||
await expect(
|
||||
ensureAgentWorkspace({ dir: tempDir, ensureBootstrapFiles: true }),
|
||||
).resolves.toMatchObject({ dir: tempDir });
|
||||
await expect(fs.readFile(identityPath, "utf8")).resolves.toBe("# Existing identity\n");
|
||||
});
|
||||
|
||||
it("does not mistake an old generated template for setup-only customization", async () => {
|
||||
const tempDir = await makeTempWorkspace("openclaw-workspace-");
|
||||
await fs.writeFile(path.join(tempDir, DEFAULT_AGENTS_FILENAME), "old generated agents\n");
|
||||
|
||||
@@ -655,7 +655,7 @@ async function workspaceSetupStateHasSurvivalEvidence(params: {
|
||||
if (await pathExists(params.bootstrapPath)) {
|
||||
return true;
|
||||
}
|
||||
if (await hasWorkspaceUserContentEvidence(params.dir)) {
|
||||
if (await workspaceProfileLooksConfigured({ dir: params.dir })) {
|
||||
return true;
|
||||
}
|
||||
const currentState = readCanonicalWorkspaceStateSnapshot(params.dir);
|
||||
|
||||
Reference in New Issue
Block a user