{"draft":null,"from":161,"to":162,"files":[{"path":"client/src/api.ts","added":6,"removed":1,"diff":"--- a/client/src/api.ts\n+++ b/client/src/api.ts\n@@ -2,6 +2,7 @@\n // except `run`, which sends a tar.gz and reads the answer as a stream of JSON\n // lines (box-run.ts).\n \n+import { randomUUID } from \"node:crypto\";\n import { setDefaultResultOrder } from \"node:dns\";\n import type {\n \tChangeAnswer,\n@@ -201,6 +202,7 @@\n \t\tif (this.config.visitor && method !== \"GET\")\n \t\t\tthrow new ApiError(`${path}: a folder that reads signed out sends only reads`);\n \t\tconst sent = body === undefined ? undefined : JSON.stringify(body);\n+\t\tconst requestId = method === \"POST\" ? randomUUID() : undefined;\n \t\tconst timeoutMs = Math.max(atLeastMs, timeoutFor(this.timeoutMs, sent));\n \t\t// A connection that never opened is tried once more, IPv4 first (#37, GAME - UI/UX: one IPv6\n \t\t// address timed out, and the same command went through seconds later). Nothing went out, so\n@@ -209,7 +211,10 @@\n \t\t\ttry {\n \t\t\t\tres = await this.send(this.url(path, server), {\n \t\t\t\t\tmethod,\n-\t\t\t\t\theaders: this.headers(sent === undefined ? undefined : \"application/json\"),\n+\t\t\t\t\theaders: {\n+\t\t\t\t\t\t...this.headers(sent === undefined ? undefined : \"application/json\"),\n+\t\t\t\t\t\t...(requestId ? { \"Idempotency-Key\": requestId } : {}),\n+\t\t\t\t\t},\n \t\t\t\t\t...(sent === undefined ? {} : { body: sent }),\n \t\t\t\t\tsignal: AbortSignal.timeout(timeoutMs),\n \t\t\t\t});"}],"unmatched":[]}