Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

Merge remote-tracking branch 'upstream/main' into fix/2941-restart-runtime-on-session-move

nothingyuancandof4744d741397
diff --cc apps/desktop/src/main/localDb/ipc/__tests__/sessionsUpdate.test.ts
index 3309b96d04,6b1deda274..cff66da128
--- a/apps/desktop/src/main/localDb/ipc/__tests__/sessionsUpdate.test.ts
+++ b/apps/desktop/src/main/localDb/ipc/__tests__/sessionsUpdate.test.ts
@@@ -25,10 -30,17 +30,18 @@@ const h = vi.hoisted(() => (
relocate: vi.fn(async (): Promise<{ persistedSdkSessionId: string | null }> => ({
persistedSdkSessionId: null,
})),
+ closeSession: vi.fn(async () => undefined),
tapWindowBroadcast: vi.fn(),
summarizeSession: vi.fn(async () => undefined),
+ stopAndRemovePiSubagentRuns: vi.fn(async (_root: string) => true),
+ writePiSubagentDeletedTombstone: vi.fn(async (_agentHome: string, _sessionId: string) => undefined),
+ clearPiSubagentDeletedTombstone: vi.fn(async (_agentHome: string, _sessionId: string) => undefined),
+ getMakerIfReady: vi.fn((): {
+ isSessionAlive: (id: string) => boolean;
+ closeSession: (id: string) => Promise<void>;
+ } | null => null),
setPinnedSectionCardMode: vi.fn(),
+ upsertRecentWorkdir: vi.fn(async () => undefined),
routeLock: vi.fn(async <T>(_sessionId: string, task: () => Promise<T>): Promise<T> =>
task(),
) as SessionRouteLockMock,
@@@ -170,9 -207,17 +208,18 @@@ async function invokeUpdate(id: string
beforeEach(() => {
vi.clearAllMocks();
h.relocate.mockImplementation(async () => ({ persistedSdkSessionId: null }));
+ h.closeSession.mockClear();
h.routeLock.mockImplementation(async (_sessionId, task) => task());
h.handlers.clear();
+ h.stopAndRemovePiSubagentRuns.mockClear();
+ h.stopAndRemovePiSubagentRuns.mockImplementation(async () => true);
+ h.writePiSubagentDeletedTombstone.mockClear();
+ h.writePiSubagentDeletedTombstone.mockImplementation(async () => undefined);
+ h.clearPiSubagentDeletedTombstone.mockClear();
+ h.clearPiSubagentDeletedTombstone.mockImplementation(async () => undefined);
+ h.getMakerIfReady.mockReset();
- h.getMakerIfReady.mockReturnValue(null);
++ h.getMakerIfReady.mockReturnValue({ isSessionAlive: () => false, closeSession: h.closeSession });
+ h.userDataDir = mkdtempSync(path.join(os.tmpdir(), 'cindy-sessions-update-'));
createDb();
setSessionRouteLockImplementation(h.routeLock);
registerSessionIpc();
diff --cc apps/desktop/src/main/localDb/ipc/sessions.ts
index 66d017adf9,1f030ff116..d23d6941e6
--- a/apps/desktop/src/main/localDb/ipc/sessions.ts
+++ b/apps/desktop/src/main/localDb/ipc/sessions.ts
@@@ -1551,10 -1550,8 +1574,10 @@@ export function registerSessionIpc
});
scheduleWorktreeRecycleForStatusChange(sid, p.status, { ownerScope, mediaDb: db });
notifyGhostSessionStatusChange(sid, p.status, updated.workingDir);
- removeHookAttachmentDir(sid, p.status);
+ cleanupSessionTerminalArtifacts(sid, p.status);
return updated;
+ };
+ return p.workingDir === undefined ? update() : withSessionRouteLock(sid, update);
});
// 窄口径会话元数据编辑(status / title / pinnedAt)。专为 device-link 控制端**远程**