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。

test(desktop): 钉住「worktree 会话移到对话」仍放行(Codex review 证伪)

Zhang Yunjinc8867bfe9bdc
diff --git a/apps/desktop/src/main/localDb/ipc/__tests__/sessionsUpdate.test.ts b/apps/desktop/src/main/localDb/ipc/__tests__/sessionsUpdate.test.ts
index eba0f6378e..0f3bbd6698 100644
--- a/apps/desktop/src/main/localDb/ipc/__tests__/sessionsUpdate.test.ts
+++ b/apps/desktop/src/main/localDb/ipc/__tests__/sessionsUpdate.test.ts
@@ -1065,6 +1065,19 @@ describe('local-db:sessions:update handler wiring', () => {
expect(h.relocate).not.toHaveBeenCalled();
});
+ it('still allows moving a worktree session back to a dialogue', async () => {
+ const worktreeDir = path.join(h.userDataDir!, '.cindy-worktrees', 'steady-goodall');
+ h.sqlite!.prepare('UPDATE sessions SET working_dir = ? WHERE id = ?').run(worktreeDir, 'cc-local');
+
+ // 「移到对话」的 patch 不带 workingDir:归属根本不参与判定,只改 workspaceKind,
+ // 目录仍停在 worktree 里(与 renderer 预检、与 Main 的 beforeMove 门控同口径)。
+ await invokeUpdate('cc-local', { workspaceKind: 'dialogue' });
+
+ expect(
+ h.sqlite!.prepare('SELECT working_dir, workspace_kind FROM sessions WHERE id = ?').get('cc-local'),
+ ).toEqual({ working_dir: worktreeDir, workspace_kind: 'dialogue' });
+ });
+
it('allows moving between subdirectories of the same managed worktree', async () => {
const worktreeDir = path.join(h.userDataDir!, '.cindy-worktrees', 'steady-goodall');
const from = path.join(worktreeDir, 'src');