Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/server/src/engine/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export function agentRoutes(service: AgentService): Hono<{ Variables: { owner: s
return c.json(identity);
});
app.get("/notifications", async (c) =>
c.json((await service.snapshot(c.get("owner"))).notifications),
c.json(await service.db.list<AgentNotification>(c.get("owner"), "notifications")),
);
app.post("/notifications/:id/read", async (c) => {
const notification = await service.db.compareAndSwap<AgentNotification>(
Expand Down
9 changes: 9 additions & 0 deletions tests/agent-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,15 @@ test("idea dismissal survives refresh and concurrent acceptance creates one goal
await read(`/tasks/${results[0].taskId}/control`, { action: "cancel" });
});

test("notification reads do not load the full agent workspace", async (t) => {
t.mock.method(server.agent, "snapshot", async () => {
throw new Error("notifications route must not call snapshot");
});
const response = await request("/notifications");
assert.equal(response.status, 200, await response.clone().text());
assert.ok(Array.isArray(await response.json()));
});

test("sample monitor saves its baseline and deduplicates notifications for repeated changes", async () => {
await read("/sample-page", { text: "No tables available" });
const monitor = await read<Monitor>(
Expand Down
Loading