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 pull request #2880 from jiajiayao/codex/fix-ghost-receipt-roundtrip

MagicLizidc4f23194eb6
diff --cc apps/desktop/src/main/cindy-brain/__tests__/ghostInstallReceipt.test.ts
index c02fba6265,6ba48b6b67..9392aa610c
--- a/apps/desktop/src/main/cindy-brain/__tests__/ghostInstallReceipt.test.ts
+++ b/apps/desktop/src/main/cindy-brain/__tests__/ghostInstallReceipt.test.ts
@@@ -229,21 -227,29 +229,44 @@@ describe('GhostInstallReceiptStore clea
});
});
+ it('preserves only the legacy Forge origin as an effective authorization fact', async () => {
+ await store.write(
+ createGhostInstallReceipt({
+ ...createSetupReceipt(),
+ installOrigin: 'agent-forge',
+ }),
+ );
+
+ const read = store.read('hello');
+ expect(read.state).toBe('approved');
+ if (read.state !== 'approved') return;
+ expect(effectiveInstallOrigin(read.receipt)).toBe('agent-forge');
+ expect(effectiveInstallOrigin({ installOrigin: 'future-origin' })).toBe('manual');
+ });
+
+ it('reads receipts through a state-root path with a linked ancestor', async () => {
+ const realRoot = path.join(workDir, 'real-state');
+ const linkedRoot = path.join(workDir, 'linked-state');
+ await fs.promises.mkdir(realRoot);
+ try {
+ await fs.promises.symlink(
+ realRoot,
+ linkedRoot,
+ process.platform === 'win32' ? 'junction' : 'dir',
+ );
+ } catch {
+ return;
+ }
+ const linkedStore = new GhostInstallReceiptStore(
+ () => linkedRoot,
+ async () => {},
+ );
+
+ await linkedStore.write(createSetupReceipt());
+
+ expect(linkedStore.read('hello')).toMatchObject({ state: 'approved' });
+ });
+
it('treats only a missing migration marker as absent', () => {
expect(store.hasMigrationMarker('hello')).toBe(false);
});