Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix(test): add dataPath/atomicWrite to cleanupAgentWorktree fileUtils mock (#1563)

[._.]/ Adam Eivye2f975c77a3d
diff --git a/server/services/cleanupAgentWorktree.test.js b/server/services/cleanupAgentWorktree.test.js
index 02ff0cac5e..89d365a8ec 100644
--- a/server/services/cleanupAgentWorktree.test.js
+++ b/server/services/cleanupAgentWorktree.test.js
@@ -108,6 +108,11 @@ vi.mock('../lib/fileUtils.js', () => ({
tryReadFile: vi.fn().mockResolvedValue(null),
ensureDir: vi.fn().mockResolvedValue(undefined),
readJSONFile: vi.fn().mockResolvedValue({}),
+ // instances.js (now pulled in via agentLifecycle's identity stamping, #1563)
+ // resolves `dataPath('instances.json')` at module load and writes via
+ // atomicWrite — both must be present on the mock or the import graph throws.
+ dataPath: vi.fn((p) => `/mock/root/data/${p}`),
+ atomicWrite: vi.fn().mockResolvedValue(undefined),
PATHS: {
root: '/mock/root',
cosAgents: '/mock/root/data/cos/agents',