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): relax Windows stale-takeover wall-clock bound

Cursor Agent2b678db21fd1
diff --git a/apps/desktop/src/main/device-link/__tests__/crossProcessLock.test.ts b/apps/desktop/src/main/device-link/__tests__/crossProcessLock.test.ts
index 3de5f7eddc..943bd60513 100644
--- a/apps/desktop/src/main/device-link/__tests__/crossProcessLock.test.ts
+++ b/apps/desktop/src/main/device-link/__tests__/crossProcessLock.test.ts
@@ -687,11 +687,19 @@ describe('接管陈旧锁', () => {
return result;
}) as typeof fsp.rename);
try {
+ // Count is the real bound: three successful takeovers must stop the loop.
+ // The wall-clock check only proves we did not wait out waitMs. Each
+ // takeover publishes a reclaim gate (fsync + hard-link); Windows CI has
+ // been observed at ~1.6s for three takeovers, so a 1s ceiling races the
+ // runner rather than the lock policy. Warm the current-process
+ // identity first — production does not charge that probe to waitMs.
+ await __testing.getProcessIdentity(process.pid);
+ const waitMs = 8_000;
const started = performance.now();
await expect(
- withCrossProcessLock(lock, { label: 'churn', waitMs: 2_000 }, async (s) => s),
+ withCrossProcessLock(lock, { label: 'churn', waitMs }, async (s) => s),
).resolves.toEqual({ held: false, reason: 'busy' });
- expect(performance.now() - started).toBeLessThan(1_000);
+ expect(performance.now() - started).toBeLessThan(4_000);
expect(takeovers).toBe(3);
} finally {
spy.mockRestore();