Skip to content

The agent that grows with you

fix(desktop): exempt the shipped uv-cache from the bundle arch audit

ethernet124b8a1baca8
diff --git a/apps/desktop/scripts/audit-bundle-arch.mjs b/apps/desktop/scripts/audit-bundle-arch.mjs
index 747285352a7..0078bf051aa 100644
--- a/apps/desktop/scripts/audit-bundle-arch.mjs
+++ b/apps/desktop/scripts/audit-bundle-arch.mjs
@@ -212,6 +212,13 @@ const EXEMPT_PATTERNS = [
// the zips extract in place, so the x64 trees carry a -win64 segment.
// Scoping to that segment keeps linux/darwin chromium audited.
/agent-payload[/\\]tools[/\\]chromium(_headless_shell)?-[^/\\]+[/\\](chrome|chrome-headless-shell)-win64[/\\]/i,
+ // The uv wheel/build cache (uv-cache/) is DELIBERATELY shipped with the
+ // payload for warm rebuilds of the mutable venv (pm bundle copies it).
+ // It holds cached sdists/archives that uv may have built for ANY arch
+ // (x64/ia32 PEs on an arm64 payload) — inert cache bytes, never loaded
+ // at runtime. Same class as the fetch-* prune: dead weight, not a
+ // binary. The audit must not fail a payload for shipping its own cache.
+ /agent-payload[/\\]uv-cache[/\\]/i,
]
export function isExemptPath(relPath) {
diff --git a/apps/desktop/scripts/audit-bundle-arch.test.mjs b/apps/desktop/scripts/audit-bundle-arch.test.mjs
index f44696f142c..4dc673f7269 100644
--- a/apps/desktop/scripts/audit-bundle-arch.test.mjs
+++ b/apps/desktop/scripts/audit-bundle-arch.test.mjs
@@ -175,6 +175,21 @@ test('the emulated x64 chromium trees are exempt in a win32-arm64 payload', () =
assert.equal(isExemptPath('resources/agent-payload/tools/chromium-1208/chrome-mac-arm64/chrome'), false)
})
+test('the uv wheel/build cache is exempt in the payload', () => {
+ // pm bundle deliberately ships uv-cache/ for warm venv rebuilds; it
+ // holds cached sdists/archives uv may have built for ANY arch (x64/ia32
+ // PEs on an arm64 payload) — inert cache bytes, never loaded at runtime.
+ for (const relPath of [
+ 'resources/agent-payload/uv-cache/archive-v0/abc/setuptools/cli.exe',
+ 'resources\\agent-payload\\uv-cache\\archive-v0\\abc\\discord\\bin\\libopus-0.x64.dll',
+ 'resources/agent-payload/uv-cache/builds-v0/whatever/build.exe'
+ ]) {
+ assert.equal(isExemptPath(relPath), true, relPath)
+ }
+ // Anything outside the cache stays audited.
+ assert.equal(isExemptPath('resources/agent-payload/tools/uv-cache-1.0/tool.exe'), false)
+})
+
test('a random payload binary is not exempt', () => {
assert.equal(isExemptPath('resources/agent-payload/hermes-agent/something.exe'), false)
})