Remove dashboard-load timing instrumentation

The perf logs were temporary diagnostics used to identify that slow
reloads were caused by a registered remote node timing out in
/projects/across-nodes. Root cause is resolved and the short-circuit
for zero-remote setups (already committed in 7ea60382a) remains.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Fusion
2026-04-19 00:58:05 -07:00
committed by gsxdsm
parent 4b448a2b40
commit e8dcca6e54
5 changed files with 60 additions and 31 deletions

View File

@@ -27,9 +27,11 @@ describe("AgentStore — instructions bundle", () => {
}
createdAgentIds.length = 0;
store.close();
// Filesystem cleanup last
try {
await rm(testDir, { recursive: true, force: true });
await rm(testDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
} catch {
// Ignore cleanup errors
}

View File

@@ -27,9 +27,11 @@ describe("AgentStore — instructions fields", () => {
}
createdAgentIds.length = 0;
store.close();
// Filesystem cleanup last
try {
await rm(testDir, { recursive: true, force: true });
await rm(testDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
} catch {
// Ignore cleanup errors
}

View File

@@ -35,7 +35,8 @@ describe("AgentStore", () => {
});
afterEach(async () => {
await rm(rootDir, { recursive: true, force: true });
store.close();
await rm(rootDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
});
// ── init ──────────────────────────────────────────────────────────
@@ -80,18 +81,22 @@ describe("AgentStore", () => {
const legacyStore = new AgentStore({ rootDir: legacyRoot });
await legacyStore.init();
const run = await legacyStore.getRunDetail("agent-legacy", "run-legacy");
try {
const run = await legacyStore.getRunDetail("agent-legacy", "run-legacy");
expect(run).toMatchObject({
id: "run-legacy",
agentId: "agent-legacy",
status: "completed",
contextSnapshot: { taskId: "FN-001" },
stdoutExcerpt: "done",
});
expect(await legacyStore.importLegacyFileRuns()).toBe(0);
expect(run).toMatchObject({
id: "run-legacy",
agentId: "agent-legacy",
status: "completed",
contextSnapshot: { taskId: "FN-001" },
stdoutExcerpt: "done",
});
expect(await legacyStore.importLegacyFileRuns()).toBe(0);
} finally {
legacyStore.close();
}
} finally {
await rm(legacyRoot, { recursive: true, force: true });
await rm(legacyRoot, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
}
});
});
@@ -1502,6 +1507,10 @@ describe("AgentStore", () => {
taskId = task.id;
});
afterEach(() => {
taskStore.close();
});
it("checkoutTask acquires a lease and stamps checkedOutAt", async () => {
const updated = await store.checkoutTask(holderId, taskId);
@@ -2382,11 +2391,14 @@ describe("AgentStore", () => {
const store2 = new AgentStore({ rootDir });
await store2.init();
const keys = await store2.listApiKeys(agent.id);
expect(keys).toHaveLength(1);
expect(keys[0].id).toBe(key.id);
expect(keys[0].label).toBe("persist");
try {
const keys = await store2.listApiKeys(agent.id);
expect(keys).toHaveLength(1);
expect(keys[0].id).toBe(key.id);
expect(keys[0].label).toBe("persist");
} finally {
store2.close();
}
});
});
@@ -2461,18 +2473,21 @@ describe("AgentStore", () => {
// Create a new store instance pointing to the same rootDir
const store2 = new AgentStore({ rootDir });
await store2.init();
try {
const found = await store2.getAgent(agent.id);
expect(found).not.toBeNull();
expect(found!.id).toBe(agent.id);
expect(found!.name).toBe("Persistent");
expect(found!.role).toBe("reviewer");
expect(found!.metadata).toEqual({ key: "val" });
expect(found!.lastHeartbeatAt).toBeDefined();
const found = await store2.getAgent(agent.id);
expect(found).not.toBeNull();
expect(found!.id).toBe(agent.id);
expect(found!.name).toBe("Persistent");
expect(found!.role).toBe("reviewer");
expect(found!.metadata).toEqual({ key: "val" });
expect(found!.lastHeartbeatAt).toBeDefined();
// Heartbeat history persists too
const history = await store2.getHeartbeatHistory(agent.id);
expect(history).toHaveLength(1);
// Heartbeat history persists too
const history = await store2.getHeartbeatHistory(agent.id);
expect(history).toHaveLength(1);
} finally {
store2.close();
}
});
});
});

View File

@@ -1995,6 +1995,16 @@ export class AgentStore extends EventEmitter {
this.db.bumpLastModified();
}
/**
* Close the underlying SQLite connection and release resources.
*/
close(): void {
if (this._db) {
this._db.close();
this._db = null;
}
}
private async withLock<T>(agentId: string, fn: () => Promise<T>): Promise<T> {
// Get or create lock for this agent
let lock = this.locks.get(agentId);

View File

@@ -48,8 +48,8 @@ describe("TaskStore", () => {
afterEach(async () => {
store.close();
await rm(rootDir, { recursive: true, force: true });
await rm(globalDir, { recursive: true, force: true });
await rm(rootDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
await rm(globalDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
});
async function createTestTask(): Promise<Task> {