Skip to content
TypeScript

chore(task-cache): name native client downloads so agent-device can install them by URL

Julius Marminge69f85ef34e5f
diff --git a/infra/task-cache/src/NativeClients.test.ts b/infra/task-cache/src/NativeClients.test.ts
index c4fb4b42f3b..ffd214c246f 100644
--- a/infra/task-cache/src/NativeClients.test.ts
+++ b/infra/task-cache/src/NativeClients.test.ts
@@ -119,6 +119,7 @@ it.effect("serves a writer's multipart upload to readers with its digest", () =>
expect(download.status).toBe(200);
expect(download.headers.get("x-t3-digest")).toBe(digest);
expect(download.headers.get("x-t3-build-ms")).toBe("540000");
+ expect(download.headers.get("content-disposition")).toMatch(/filename="[a-f0-9]+\.tgz"$/);
expect(yield* Effect.promise(() => download.text())).toBe("native client");
const again = yield* request("/uploads", {
diff --git a/infra/task-cache/src/NativeClients.ts b/infra/task-cache/src/NativeClients.ts
index c0982913ba9..897c72adb91 100644
--- a/infra/task-cache/src/NativeClients.ts
+++ b/infra/task-cache/src/NativeClients.ts
@@ -120,6 +120,8 @@ const make = Effect.gen(function* () {
"Content-Type": "application/octet-stream",
"Content-Length": String(object.size),
"Cache-Control": "no-store",
+ // agent-device install-from-source picks the archive type from this name.
+ "Content-Disposition": `attachment; filename="${key.split("/").at(-1)}.tgz"`,
"X-T3-Digest": object.customMetadata?.digest ?? "",
"X-T3-Build-Ms": object.customMetadata?.buildMs ?? "0",
},