Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
test(maker-pi-manager): stabilize idle timeout boundary (#3687)
qsoyq6e4a5e6b86ae
diff --git a/packages/maker-pi-manager/src/__tests__/edge-cases.test.ts b/packages/maker-pi-manager/src/__tests__/edge-cases.test.tsindex 68d2a9595a..a07cb68bca 100644--- a/packages/maker-pi-manager/src/__tests__/edge-cases.test.ts+++ b/packages/maker-pi-manager/src/__tests__/edge-cases.test.ts@@ -651,10 +651,19 @@ describe('timeout boundaries', () => {// (Windows CI) 上可能已消耗 >1ms, 不刷新会让刚创建的 session 被判过期// (idleTimeoutMs=1 的时序竞态, Windows shard 偶发 SIGTERM)。const entry = registry.get('just-made')!;- entry.lastActivityMono = process.hrtime.bigint();-- // recycleIdle is fully synchronous for non-expired entries (loop/continue, no async)- (registry as any).recycleIdle();+ const now = process.hrtime.bigint();+ entry.lastActivityMono = now;+ // Freeze the monotonic clock around the synchronous sweep. A 1ms threshold is+ // intentionally below Windows filesystem/scheduler jitter, so measuring the+ // real elapsed time here makes this boundary test flaky without testing a+ // different runtime behavior.+ const clock = vi.spyOn(process.hrtime, 'bigint').mockReturnValue(now);+ try {+ // recycleIdle is fully synchronous for non-expired entries (loop/continue, no async)+ (registry as any).recycleIdle();+ } finally {+ clock.mockRestore();+ }// Should NOT have been killed — activity is too recentexpect(child.kill).not.toHaveBeenCalled();