{"version":58,"agent":"pinch","message":"abso login says it is waiting for approval, and that Ctrl-C stops it, then says it is still waiting about once a minute. It stops by itself when the code runs out, and never waits past 30 minutes whatever the server's expires_in says. A login that said nothing for 15 minutes looked like a hang.","time":1791598042242,"timeIso":"2026-10-10T02:07:22.242Z","changes":2,"change":748,"files":["client/src/box.ts","client/test/box.test.ts"],"draft":null,"diff":[{"path":"client/src/box.ts","added":14,"removed":1,"diff":"--- a/client/src/box.ts\n+++ b/client/src/box.ts\n@@ -174,6 +174,11 @@\n \t);\n }\n \n+/** The longest login waits for approval, whatever the server says. */\n+const MAX_LOGIN_WAIT_S = 30 * 60;\n+/** How often login says it's still waiting. */\n+const STILL_WAITING_MS = 60_000;\n+\n export interface LoginIo {\n \treadonly fetch?: typeof fetch;\n \treadonly sleep?: (ms: number) => Promise<void>;\n@@ -193,13 +198,21 @@\n \tconst start = await call(server, \"/login/device\", { name: boxName(), client: \"abso\" }, undefined, fetcher);\n \tconst { device_code: device, user_code: code, verification_uri_complete: link } = start.body;\n \tlet interval = Number(start.body.interval) || 5;\n-\tconst expiresIn = Number(start.body.expires_in) || 900;\n+\t// The server says when its code runs out; a server that says never still gets an end.\n+\tconst expiresIn = Math.min(Number(start.body.expires_in) || 900, MAX_LOGIN_WAIT_S);\n \tif (typeof code !== \"string\" || typeof link !== \"string\" || typeof device !== \"string\")\n \t\tthrow new UsageError(`${originOf(server)} didn't give a code to approve`);\n \tio.say(`To sign this box in, open ${link} and approve the code ${code}.`);\n+\tio.say(\"Waiting for approval. Ctrl-C stops waiting, and abso stops by itself when the code runs out.\");\n \tconst until = now() + expiresIn * 1000;\n+\tlet toldAt = now();\n \twhile (now() < until) {\n \t\tawait sleep(interval * 1000);\n+\t\t// A wait with no word looks like a hang, so say it's still waiting now and then.\n+\t\tif (now() - toldAt >= STILL_WAITING_MS) {\n+\t\t\tio.say(`Still waiting for the code ${code} to be approved.`);\n+\t\t\ttoldAt = now();\n+\t\t}\n \t\tconst a = await call(server, \"/login/token\", { device_code: device }, undefined, fetcher);\n \t\tif (a.status === 400) {\n \t\t\tif (a.body.error === \"authorization_pending\") continue;"},{"path":"client/test/box.test.ts","added":24,"removed":0,"diff":"--- a/client/test/box.test.ts\n+++ b/client/test/box.test.ts\n@@ -91,6 +91,7 @@\n \t);\n \tassert.deepEqual(said, [\n \t\t\"To sign this box in, open https://abso.dev/login/box?code=WXYZ-BCDF and approve the code WXYZ-BCDF.\",\n+\t\t\"Waiting for approval. Ctrl-C stops waiting, and abso stops by itself when the code runs out.\",\n \t]);\n \tassert.equal(readBox(SERVER, h)?.credential, CREDENTIAL);\n \tconst files = readdirSync(join(h, \".abso\", \"boxes\"));\n@@ -160,6 +161,29 @@\n \tassert.equal(readBox(SERVER, h), undefined);\n });\n \n+test(\"login says it's still waiting about once a minute, and stops in the end whatever the server says\", async () => {\n+\tconst c = clock();\n+\tconst said: string[] = [];\n+\tconst pending = Array.from({ length: 2000 }, (): [number, unknown] => [400, { error: \"authorization_pending\" }]);\n+\tawait assert.rejects(\n+\t\tlogin(\n+\t\t\tSERVER,\n+\t\t\t{\n+\t\t\t\tfetch: server([[200, { ...started, expires_in: 10 ** 9, interval: 5 }], ...pending], []),\n+\t\t\t\tsleep: c.sleep,\n+\t\t\t\tnow: c.now,\n+\t\t\t\tsay: (line) => said.push(line),\n+\t\t\t},\n+\t\t\thome(),\n+\t\t),\n+\t\t/nobody approved the code WXYZ-BCDF in time\\. Run abso login again\\./,\n+\t);\n+\tassert.equal(c.slept(), 30 * 60 * 1000, \"a server that says never still gets an end\");\n+\tconst still = said.filter((line) => line === \"Still waiting for the code WXYZ-BCDF to be approved.\");\n+\tassert.equal(still.length, 30);\n+\tassert.equal(said.length, 2 + 30);\n+});\n+\n test(\"a key is minted with the box credential, sent only to the box's own server\", async () => {\n \tconst seen: Seen = [];\n \tconst minted = await mintKey("}],"ci":null}