Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(desktop): retain remote guards for ID history mutations

Seraph-x6c920c79dad5
diff --git a/apps/desktop/src/lib/remote-ipc-safety.ts b/apps/desktop/src/lib/remote-ipc-safety.ts
index 85ee8446b..6fcae20ec 100644
--- a/apps/desktop/src/lib/remote-ipc-safety.ts
+++ b/apps/desktop/src/lib/remote-ipc-safety.ts
@@ -4,6 +4,7 @@ import i18n from "i18next";
const localOnly = new Set<string>([
IPC.invoke.sessionConfigure, IPC.invoke.sessionFork, IPC.invoke.sessionMoveProject,
IPC.invoke.sessionReplaceMessages, IPC.invoke.sessionSaveRevision,
+ IPC.invoke.sessionDeleteMessage, IPC.invoke.sessionRetractPendingPrompt,
IPC.invoke.sessionListRevisions, IPC.invoke.sessionActivateRevision,
IPC.invoke.sessionGetScratchPath, IPC.invoke.sessionOpenScratchPath,
IPC.invoke.agentSteer, IPC.invoke.agentQueuePush, IPC.invoke.agentQueueList,
diff --git a/apps/desktop/test/bounded-history-mutations.test.mjs b/apps/desktop/test/bounded-history-mutations.test.mjs
index f24cc0dc0..a888a6683 100644
--- a/apps/desktop/test/bounded-history-mutations.test.mjs
+++ b/apps/desktop/test/bounded-history-mutations.test.mjs
@@ -148,6 +148,16 @@ test("refused conditional retraction rolls back its fence so late old-turn callb
assert.deepEqual(h.events.slice(-2), [["rollback"], ["release"]]);
});
+test("new ID mutations preserve the existing remote read-only capability boundary", () => {
+ const { guardRemoteInvocation } = load("../src/lib/remote-ipc-safety.ts", {
+ "@pi-desktop/shared": { IPC }, i18next: { default: { t: () => "Remote history is read-only" } },
+ });
+ for (const channel of [IPC.invoke.sessionDeleteMessage, IPC.invoke.sessionRetractPendingPrompt]) {
+ assert.throws(() => guardRemoteInvocation(channel, { sessionId: "remote:host:session", messageId: "m" }), { code: "CAPABILITY_UNAVAILABLE" });
+ assert.doesNotThrow(() => guardRemoteInvocation(channel, { sessionId: "local-session", messageId: "m" }));
+ }
+});
+
test("the real store/API/preload/IPC path uploads bounded ids with more than 64 MiB retained history", async () => {
const huge = [...previous];
huge[1] = { ...huge[1], content: "A".repeat(65 * 1024 * 1024) };