From 67a5baaa1fe2f72d4b09b141d5ae31b131d98461 Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 13 Nov 2026 20:43:46 +0800 Subject: [PATCH] agy-cli test: the sign-in check's upper bound has room on both sides (#1089) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "#1064 登录检查不为探测等太久" bounded authorize() at SLOW_MS + 3s + 1s, so a busy Windows box used up the 1s and went red 1 in 12. The fake session now answers after 60s, and the test asks that the probe session was started and that authorize() returned before half of that. The lower bound stays: a timer is only ever late. Run: WSL, node --test test/catalog.mjs 24/24; Windows 11 (xiaomi-gpu, Node 22), the #1064 tests 12 times, 0 red. Broken by hand: OFFERED_SIGNIN_WAIT_MS at 120s (authorize waits for the session) makes the test red, "登录检查等了会话(31524ms)". No package code changed, so no version bump. --- packages/agy-cli/test/catalog.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/agy-cli/test/catalog.mjs b/packages/agy-cli/test/catalog.mjs index 58a9f2d..65151f8 100644 --- a/packages/agy-cli/test/catalog.mjs +++ b/packages/agy-cli/test/catalog.mjs @@ -288,10 +288,14 @@ test("#1064 慢 agy:已登录时 authorize 读到的列表和探测就是目 }) test("#1064 登录检查不为探测等太久:会话一直不答时最多多等几秒", async () => { - await withKit({ ...SLOW_AGY, sessionNewDelayMs: 6_000 }, async (kit) => { + // 会话 60s 才答:authorize 只等探测约 3s,不该等到会话答(#1089:上界不留 1s 那么窄的余量)。 + // 下界是计时器,只会晚到不会早到,负载下也不会误报。 + const SESSION_MS = 60_000 + await withKit({ ...SLOW_AGY, sessionNewDelayMs: SESSION_MS }, async (kit) => { const { value: started, ms } = await timed(() => kit.plugin.auth.methods[0].authorize()) assert.equal(started.method, "auto") - assert.ok(ms < SLOW_MS + 3_000 + 1_000, `登录检查等了 ${Math.round(ms)}ms`) + assert.equal(kit.acpSpawns.length, 1, "登录检查该起探测会话") + assert.ok(ms < SESSION_MS / 2, `登录检查等了会话(${Math.round(ms)}ms)`) assert.ok(ms >= SLOW_MS + 2_500, `登录检查没等探测(${Math.round(ms)}ms)`) const models = await kit.models() assert.ok(models["gemini-4-argon"])