Preserve registry creation timestamps

This commit is contained in:
Mohamed Boudra
2025-11-30 02:26:26 +00:00
parent f38287ff4c
commit cc34ea722a
3 changed files with 28 additions and 1 deletions
@@ -126,6 +126,30 @@ describe("AgentRegistry", () => {
expect(persisted.config?.extra?.claude).toMatchObject({ maxThinkingTokens: 1024 });
});
test("applySnapshot preserves original createdAt timestamp", async () => {
const agentId = "agent-created-at";
const firstTimestamp = new Date("2025-01-01T00:00:00.000Z");
await registry.applySnapshot(
createManagedAgent({ id: agentId, createdAt: firstTimestamp })
);
const initialRecord = await registry.get(agentId);
expect(initialRecord?.createdAt).toBe(firstTimestamp.toISOString());
await registry.applySnapshot(
createManagedAgent({
id: agentId,
createdAt: new Date("2025-02-01T00:00:00.000Z"),
updatedAt: new Date("2025-02-01T00:00:00.000Z"),
lifecycle: "running",
})
);
const updatedRecord = await registry.get(agentId);
expect(updatedRecord?.createdAt).toBe(firstTimestamp.toISOString());
expect(updatedRecord?.lastStatus).toBe("running");
});
test("stores titles independently of snapshots", async () => {
await registry.applySnapshot(
createManagedAgent({