fix(sessions): canonicalize notification route cwd

This commit is contained in:
Federico Jaramillo Martinez
2026-07-19 02:24:38 +02:00
parent 71fd091e0e
commit 793b492153
3 changed files with 7 additions and 6 deletions
@@ -1,3 +1,4 @@
import { resolve } from "node:path";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import { PiSessionService } from "./piSessionService.js"; import { PiSessionService } from "./piSessionService.js";
import { SessionNotificationStore } from "./sessionNotificationStore.js"; import { SessionNotificationStore } from "./sessionNotificationStore.js";
@@ -29,7 +30,7 @@ describe("PiSessionService archive and cleanup", () => {
}); });
await service.status(sessionRef("archive-notification-session")); await service.status(sessionRef("archive-notification-session"));
const generation = store.currentGeneration("archive-notification-session", "/workspace"); const generation = store.currentGeneration("archive-notification-session", resolve("/workspace"));
if (generation === undefined) throw new Error("expected active notification generation"); if (generation === undefined) throw new Error("expected active notification generation");
store.addNotification(generation, "archive me", "warning"); store.addNotification(generation, "archive me", "warning");
@@ -944,7 +944,7 @@ describe("PiSessionService lifecycle, listing, and reload", () => {
"shutdown before close failure", "shutdown before close failure",
"prior", "prior",
]); ]);
expect(store.currentGeneration("failed-close-reload", "/workspace")).toBeDefined(); expect(store.currentGeneration("failed-close-reload", resolve("/workspace"))).toBeDefined();
await service.stop(sessionRef("failed-close-reload")); await service.stop(sessionRef("failed-close-reload"));
await service.dispose(); await service.dispose();
}); });
+4 -4
View File
@@ -689,7 +689,7 @@ export class PiSessionService implements SessionRouteService {
} }
notificationInbox(ref: PiSessionRef): SessionNotificationInboxSnapshot { notificationInbox(ref: PiSessionRef): SessionNotificationInboxSnapshot {
return this.notificationStore.inboxSnapshot(ref.id, ref.cwd); return this.notificationStore.inboxSnapshot(ref.id, canonicalizeStoredCwd(ref.cwd));
} }
dismissNotification( dismissNotification(
@@ -698,7 +698,7 @@ export class PiSessionService implements SessionRouteService {
): SessionNotificationInboxSnapshot { ): SessionNotificationInboxSnapshot {
const result = this.notificationStore.dismissNotification( const result = this.notificationStore.dismissNotification(
ref.id, ref.id,
ref.cwd, canonicalizeStoredCwd(ref.cwd),
request.daemonInstanceId, request.daemonInstanceId,
request.notificationId, request.notificationId,
); );
@@ -712,7 +712,7 @@ export class PiSessionService implements SessionRouteService {
): SessionNotificationInboxSnapshot { ): SessionNotificationInboxSnapshot {
const result = this.notificationStore.dismissAll( const result = this.notificationStore.dismissAll(
ref.id, ref.id,
ref.cwd, canonicalizeStoredCwd(ref.cwd),
request.daemonInstanceId, request.daemonInstanceId,
request.throughOrder, request.throughOrder,
request.throughOverflowWatermark, request.throughOverflowWatermark,
@@ -1692,7 +1692,7 @@ export class PiSessionService implements SessionRouteService {
return; return;
} }
if (isPiSessionRef(ref)) { if (isPiSessionRef(ref)) {
this.publishNotificationMutations(this.notificationStore.clearSessionIdentity(ref.id, ref.cwd, "runtime-close")); this.publishNotificationMutations(this.notificationStore.clearSessionIdentity(ref.id, canonicalizeStoredCwd(ref.cwd), "runtime-close"));
return; return;
} }
await this.closeActive(ref); await this.closeActive(ref);