{"draft":null,"from":203,"to":318,"files":[{"path":"client/test/box.test.ts","added":94,"removed":0,"diff":"--- a/client/test/box.test.ts\n+++ b/client/test/box.test.ts\n@@ -458,3 +458,97 @@\n \t\t/Projects: all of yours, now and later \\(writer at most\\)\\. abso init makes a new one/,\n \t);\n });\n+\n+// abso 684: in an agent's folder, login asks a person in the project instead of relaying the code.\n+function askedOf(withdrawn: number[]): NonNullable<Parameters<typeof login>[1][\"ask\"]> {\n+\treturn async ({ device, user }) => {\n+\t\tassert.equal(device, started.device_code, \"the ask is made with this client's own device code\");\n+\t\tassert.equal(user, started.user_code);\n+\t\treturn {\n+\t\t\tproject: \"abso\",\n+\t\t\twho: \"the person who approved this agent's box\",\n+\t\t\tasks: [41],\n+\t\t\texpiresAt: Date.parse(\"2026-10-15T19:30:00Z\"),\n+\t\t\trole: \"writer\",\n+\t\t\twithdraw: async () => void withdrawn.push(41),\n+\t\t};\n+\t};\n+}\n+\n+test(\"an asked login says who was asked and until when, and doesn't lead with the code (abso 684)\", async () => {\n+\tconst said: string[] = [];\n+\tconst c = clock();\n+\tawait login(\n+\t\tSERVER,\n+\t\t{\n+\t\t\task: askedOf([]),\n+\t\t\tfetch: server(\n+\t\t\t\t[\n+\t\t\t\t\t[200, started],\n+\t\t\t\t\t[200, { box_id: \"b_test\", box_token: CREDENTIAL, expires_at: EXPIRES, grant: { projects: [] } }],\n+\t\t\t\t],\n+\t\t\t\t[],\n+\t\t\t),\n+\t\t\tsleep: c.sleep,\n+\t\t\tnow: c.now,\n+\t\t\tsay: (line) => said.push(line),\n+\t\t},\n+\t\thome(),\n+\t);\n+\tassert.match(\n+\t\tsaid[0]!,\n+\t\t/^Asked the person who approved this agent's box \\(ask 41 in abso\\) to sign this box in, as at most writer\\.$/,\n+\t);\n+\tassert.match(said[1]!, /^Waiting for their answer, until .* CT\\. To approve it yourself instead: /);\n+\tassert.doesNotMatch(said.join(\"\\n\"), /approve the code/);\n+});\n+\n+test(\"an asked login that's turned down says who turned it down (abso 684)\", async () => {\n+\tconst c = clock();\n+\tawait assert.rejects(\n+\t\tlogin(\n+\t\t\tSERVER,\n+\t\t\t{\n+\t\t\t\task: askedOf([]),\n+\t\t\t\tfetch: server(\n+\t\t\t\t\t[\n+\t\t\t\t\t\t[200, started],\n+\t\t\t\t\t\t[400, { error: \"access_denied\" }],\n+\t\t\t\t\t],\n+\t\t\t\t\t[],\n+\t\t\t\t),\n+\t\t\t\tsleep: c.sleep,\n+\t\t\t\tnow: c.now,\n+\t\t\t\tsay: () => {},\n+\t\t\t},\n+\t\t\thome(),\n+\t\t),\n+\t\t/the person who approved this agent's box turned this sign-in down/,\n+\t);\n+});\n+\n+test(\"an asked login that nobody answers withdraws its ask and grants nothing (abso 684)\", async () => {\n+\tconst withdrawn: number[] = [];\n+\tconst c = clock();\n+\tawait assert.rejects(\n+\t\tlogin(\n+\t\t\tSERVER,\n+\t\t\t{\n+\t\t\t\task: askedOf(withdrawn),\n+\t\t\t\tfetch: server(\n+\t\t\t\t\t[\n+\t\t\t\t\t\t[200, started],\n+\t\t\t\t\t\t[400, { error: \"expired_token\" }],\n+\t\t\t\t\t],\n+\t\t\t\t\t[],\n+\t\t\t\t),\n+\t\t\t\tsleep: c.sleep,\n+\t\t\t\tnow: c.now,\n+\t\t\t\tsay: () => {},\n+\t\t\t},\n+\t\t\thome(),\n+\t\t),\n+\t\t/nobody answered in time, so nothing was granted/,\n+\t);\n+\tassert.deepEqual(withdrawn, [41]);\n+});"}],"unmatched":[]}