Skip to content

Commit 1e7a76f

Browse files
authored
fix(e2e): declare agents-delete fixture owners (#123000)
1 parent cd0fb35 commit 1e7a76f

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

‎scripts/e2e/lib/fixtures/workspace.mjs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ function writeAgentsDeleteConfig() {
3030
fs.mkdirSync(sharedWorkspace, { recursive: true });
3131
writeJson(path.join(stateDir, "openclaw.json"), {
3232
agents: {
33+
ownership: "explicit",
34+
defaults: { heartbeat: { agentId: "main" } },
3335
entries: {
3436
main: { workspace: sharedWorkspace },
3537
ops: { workspace: sharedWorkspace },

‎test/scripts/fixtures-workspace.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ function runAgentsDeleteAssert(root: string, outputPath: string, env: Record<str
2121
});
2222
}
2323

24+
function runAgentsDeleteConfig(root: string) {
25+
const stateDir = path.join(root, "state");
26+
const workspace = path.join(root, "workspace");
27+
mkdirSync(stateDir, { recursive: true });
28+
const result = spawnSync(process.execPath, [FIXTURE_SCRIPT, "agents-delete-config"], {
29+
encoding: "utf8",
30+
env: { ...process.env, OPENCLAW_STATE_DIR: stateDir, SHARED_WORKSPACE: workspace },
31+
});
32+
return { result, stateDir, workspace };
33+
}
34+
2435
function runOpenWebUiWorkspace(workspaceDir: string) {
2536
return spawnSync(process.execPath, [FIXTURE_SCRIPT, "openwebui-workspace"], {
2637
encoding: "utf8",
@@ -32,6 +43,18 @@ function runOpenWebUiWorkspace(workspaceDir: string) {
3243
}
3344

3445
describe("workspace fixture assertions", () => {
46+
it("writes explicit owners for the shared-workspace agents", () => {
47+
const root = tempDirs.make("openclaw-fixture-workspace-");
48+
const { result, stateDir, workspace } = runAgentsDeleteConfig(root);
49+
50+
expect(result.status).toBe(0);
51+
expect(JSON.parse(readFileSync(path.join(stateDir, "openclaw.json"), "utf8")).agents).toEqual({
52+
ownership: "explicit",
53+
defaults: { heartbeat: { agentId: "main" } },
54+
entries: { main: { workspace }, ops: { workspace } },
55+
});
56+
});
57+
3558
it("prepares Open WebUI without retired workspace setup state", () => {
3659
const root = mkdtempSync(path.join(tmpdir(), "openclaw-fixture-workspace-"));
3760
const workspaceDir = path.join(root, "workspace");

0 commit comments

Comments
 (0)