Skip to content

The agent that grows with you

fix(icons): isolate build dependencies from runtime payloads

ethernete0a806c9d646
diff --git a/.github/workflows/icons-freshness-check.yml b/.github/workflows/icons-freshness-check.yml
index 83d5555deb7..195fc7193cf 100644
--- a/.github/workflows/icons-freshness-check.yml
+++ b/.github/workflows/icons-freshness-check.yml
@@ -40,11 +40,7 @@ jobs:
pyproject.toml
uv.lock
- # Pillow is a core dependency; resvg-py rides the dev extra.
- - name: Install locked deps
- run: uv sync --locked --python 3.11 --extra dev
-
- name: Regenerate every target, then verify structure
run: |
- uv run python scripts/generate_icons.py
- uv run python scripts/generate_icons.py --check
+ node scripts/generate-icons.mjs
+ node scripts/generate-icons.mjs --check
diff --git a/pyproject.toml b/pyproject.toml
index cebab980ada..030241ac635 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -214,7 +214,7 @@ modal = ["modal==1.3.4"]
daytona = ["daytona==0.155.0"]
vercel = ["vercel==0.7.2"]
hindsight = ["hindsight-client==0.6.1"]
-dev = ["debugpy==1.8.20", "pytest==9.1.1", "pytest-asyncio==1.3.0", "mcp==2.0.0", "httpx2==2.7.0", "starlette==1.3.1", "ty==0.0.21", "ruff==0.15.10", "resvg-py==0.4.0", "setuptools==83.0.0"] # starlette: CVE-2026-48710; setuptools: 83 (torch >=2.13 requires setuptools 83)
+dev = ["debugpy==1.8.20", "pytest==9.1.1", "pytest-asyncio==1.3.0", "mcp==2.0.0", "httpx2==2.7.0", "starlette==1.3.1", "ty==0.0.21", "ruff==0.15.10", "setuptools==83.0.0"] # starlette: CVE-2026-48710; setuptools: 83 (torch >=2.13 requires setuptools 83)
messaging = ["python-telegram-bot[webhooks]==22.8", "discord.py[voice]==2.7.1", "aiohttp==3.14.3", "brotlicffi==1.2.0.1", "slack-bolt==1.30.0", "slack-sdk==3.43.0", "qrcode==7.4.2"] # aiohttp 3.14.3: prior CVEs + GHSA-cq5v-8q36-5273/GHSA-mfx4-hv73-q22v/GHSA-mq44-7p77-q5h7
cron = [] # croniter is now a core dependency; this extra kept for back-compat
@@ -457,6 +457,11 @@ all = [
"hermes-agent[youtube]",
]
+[dependency-groups]
+# Build tooling is not a runtime extra: payloads select --all-extras.
+# --only-group supplies Pillow without installing the Hermes application.
+icon-build = ["Pillow==12.3.0", "resvg-py==0.4.0"]
+
[build-system]
# setuptools.build_meta + our setup.py bdist_wheel guard import wheel during
# PEP 517 isolated builds (uv sync / uv pip install -e .). Without wheel in
diff --git a/scripts/generate-icons.mjs b/scripts/generate-icons.mjs
index 82a9a1252e5..515b2714e43 100644
--- a/scripts/generate-icons.mjs
+++ b/scripts/generate-icons.mjs
@@ -9,49 +9,34 @@
* - installer: apps/bootstrap-installer/package.json prebuild
* - web: web/package.json prebuild
*
- * Finds the project venv python (resvg-py rides the dev extra) and runs the
- * generator from the repo root. Fails loudly if the toolchain is missing so
- * a build can never silently ship without icons.
+ * The locked icon-build group runs outside the application environment.
+ * It is not a runtime extra, so --all-extras payloads do not include resvg.
*/
import { spawnSync } from 'node:child_process'
-import { existsSync } from 'node:fs'
import path from 'node:path'
-import { fileURLToPath } from 'node:url'
+import { fileURLToPath, pathToFileURL } from 'node:url'
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
-function findPython() {
- const candidates = [
- path.join(repoRoot, '.venv', 'Scripts', 'python.exe'), // windows
- path.join(repoRoot, '.venv', 'bin', 'python'), // posix
- path.join(repoRoot, 'venv', 'Scripts', 'python.exe'),
- path.join(repoRoot, 'venv', 'bin', 'python'),
- ]
- for (const candidate of candidates) {
- if (existsSync(candidate)) return candidate
- }
- return null
-}
-
-function main() {
- const python = findPython()
- const generator = path.join(repoRoot, 'scripts', 'generate_icons.py')
- let result
- if (python) {
- result = spawnSync(python, [generator], { cwd: repoRoot, stdio: 'inherit' })
- } else if (process.env.VIRTUAL_ENV) {
- const py = process.platform === 'win32' ? 'python.exe' : 'python'
- result = spawnSync(py, [generator], { cwd: repoRoot, stdio: 'inherit', env: process.env })
- } else {
- // Fall back to uv-managed python (CI installs the dev extra).
- result = spawnSync('uv', ['run', 'python', generator], { cwd: repoRoot, stdio: 'inherit' })
- }
+export function generateIcons(args = [], { root = repoRoot, run = spawnSync, env = process.env } = {}) {
+ const childEnv = { ...env }
+ // Parent payload paths must not shadow the isolated build dependencies.
+ delete childEnv.PYTHONPATH
+ delete childEnv.PYTHONHOME
+ const result = run('uv', [
+ 'run', '--isolated', '--locked', '--only-group', 'icon-build', '--python', '3.11',
+ // PM copies its wheel cache into payloads. Keep build wheels outside it.
+ '--cache-dir', path.join(root, '.cache', 'icon-build'),
+ 'python', path.join(root, 'scripts', 'generate_icons.py'), ...args
+ ], { cwd: root, stdio: 'inherit', windowsHide: true, env: childEnv })
if (result.error) {
console.error('[generate-icons] failed to launch icon generator:', result.error.message)
- console.error('[generate-icons] install the dev extra with: uv sync --extra dev')
- process.exit(1)
+ console.error('[generate-icons] uv is required to run the isolated icon-build group')
+ return 1
}
- process.exit(result.status ?? 1)
+ return result.status ?? 1
}
-main()
+if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) {
+ process.exitCode = generateIcons(process.argv.slice(2))
+}
diff --git a/scripts/generate_icons.py b/scripts/generate_icons.py
index 09311e29fdd..d8d27b4bc82 100644
--- a/scripts/generate_icons.py
+++ b/scripts/generate_icons.py
@@ -2,8 +2,8 @@
"""Generate every app icon in the repo from the nous-girl art + platform backgrounds.
Usage (from repo root):
- .venv/Scripts/python.exe scripts/generate_icons.py # write
- .venv/Scripts/python.exe scripts/generate_icons.py --check # verify structure
+ node scripts/generate-icons.mjs # write
+ node scripts/generate-icons.mjs --check # verify structure
Sources of truth — two axes, composed per target:
Girl art (vector): assets/nous-girl-black.svg (black positive space)
@@ -36,9 +36,9 @@ byte-compare against.
Rendering: resvg (resvg-py) for SVG -> PNG fidelity at every size.
Containers: Pillow for multi-size .ico and .icns.
-Deps:
- Pillow (core dependency), resvg-py (dev extra):
- uv sync --extra dev
+Build dependencies:
+ The runner uses the locked icon-build group in an isolated environment.
+ resvg-py is not a runtime extra and does not enter production payloads.
Outputs (30 files):
assets/icon-master.svg generated light master
@@ -88,8 +88,8 @@ try:
import resvg_py
except ImportError:
sys.exit(
- "resvg-py is missing. Install it with:\n"
- " uv sync --extra dev"
+ "resvg-py is build-only. Run the isolated generator with:\n"
+ " node scripts/generate-icons.mjs"
)
ROOT = Path(__file__).resolve().parent.parent
diff --git a/tests-js/generate-icons.test.mjs b/tests-js/generate-icons.test.mjs
new file mode 100644
index 00000000000..b29b845d8e4
--- /dev/null
+++ b/tests-js/generate-icons.test.mjs
@@ -0,0 +1,28 @@
+import path from 'node:path'
+import { expect, test, vi } from 'vitest'
+import { generateIcons } from '../scripts/generate-icons.mjs'
+
+test('icon builds use only the locked build group outside every application venv', () => {
+ const run = vi.fn(() => ({ status: 0 }))
+ const root = path.resolve('icon-build-fixture')
+ const env = { PATH: 'tools', VIRTUAL_ENV: 'runtime-venv', PYTHONPATH: 'payload-libraries', PYTHONHOME: 'payload-python' }
+ expect(generateIcons(['--check'], { root, run, env })).toBe(0)
+ expect(run).toHaveBeenCalledExactlyOnceWith('uv', [
+ 'run', '--isolated', '--locked', '--only-group', 'icon-build', '--python', '3.11',
+ '--cache-dir', path.join(root, '.cache', 'icon-build'),
+ 'python', path.join(root, 'scripts', 'generate_icons.py'), '--check'
+ ], { cwd: root, stdio: 'inherit', windowsHide: true, env: { PATH: 'tools', VIRTUAL_ENV: 'runtime-venv' } })
+ expect(env.PYTHONPATH).toBe('payload-libraries')
+})
+
+test('failed icon processes cannot report a successful build', () => {
+ expect(generateIcons([], { run: () => ({ status: 7 }), env: {} })).toBe(7)
+ expect(generateIcons([], { run: () => ({ status: null, signal: 'SIGTERM' }), env: {} })).toBe(1)
+ const error = vi.spyOn(console, 'error').mockImplementation(() => {})
+ try {
+ expect(generateIcons([], { run: () => ({ error: new Error('uv missing') }), env: {} })).toBe(1)
+ expect(error).toHaveBeenCalledWith(expect.stringContaining('failed to launch'), 'uv missing')
+ } finally {
+ error.mockRestore()
+ }
+})
diff --git a/tests/test_icon_build_dependencies.py b/tests/test_icon_build_dependencies.py
new file mode 100644
index 00000000000..9fed3a0b21b
--- /dev/null
+++ b/tests/test_icon_build_dependencies.py
@@ -0,0 +1,22 @@
+"""Icon tooling must not join the runtime's all-extras dependency set."""
+import re
+import shutil
+import subprocess
+from pathlib import Path
+
+
+def test_icon_group_is_separate_from_runtime_extras():
+ root = Path(__file__).resolve().parents[1]
+ uv = shutil.which("uv")
+ assert uv, "uv is required for the dependency-selection contract"
+
+ def packages(*selection):
+ result = subprocess.run(
+ [uv, "export", "--frozen", "--offline", "--no-hashes", "--no-annotate",
+ "--no-header", "--no-emit-project", *selection],
+ cwd=root, capture_output=True, text=True, encoding="utf-8", check=True,
+ )
+ return set(re.findall(r"^([a-z0-9-]+)==", result.stdout, re.MULTILINE))
+
+ assert "resvg-py" not in packages("--all-extras")
+ assert packages("--only-group", "icon-build") == {"pillow", "resvg-py"}
diff --git a/uv.lock b/uv.lock
index 84e1d020666..36a24207277 100644
--- a/uv.lock
+++ b/uv.lock
@@ -1808,7 +1808,6 @@ dev = [
{ name = "mcp" },
{ name = "pytest" },
{ name = "pytest-asyncio" },
- { name = "resvg-py" },
{ name = "ruff" },
{ name = "setuptools" },
{ name = "starlette" },
@@ -2001,6 +2000,12 @@ youtube = [
{ name = "youtube-transcript-api" },
]
+[package.dev-dependencies]
+icon-build = [
+ { name = "pillow" },
+ { name = "resvg-py" },
+]
+
[package.metadata]
requires-dist = [
{ name = "agent-client-protocol", marker = "extra == 'acp'", specifier = "==0.9.0" },
@@ -2125,7 +2130,6 @@ requires-dist = [
{ name = "qrcode", marker = "extra == 'feishu'", specifier = "==7.4.2" },
{ name = "qrcode", marker = "extra == 'messaging'", specifier = "==7.4.2" },
{ name = "requests", specifier = "==2.33.0" },
- { name = "resvg-py", marker = "extra == 'dev'", specifier = "==0.4.0" },
{ name = "rich", specifier = "==14.3.3" },
{ name = "ruamel-yaml", specifier = "==0.18.17" },
{ name = "ruff", marker = "extra == 'dev'", specifier = "==0.15.10" },
@@ -2161,6 +2165,12 @@ requires-dist = [
]
provides-extras = ["anthropic", "exa", "firecrawl", "parallel-web", "fal", "edge-tts", "modal", "daytona", "vercel", "hindsight", "dev", "messaging", "cron", "slack", "matrix", "wecom", "tts-premium", "voice", "wake", "honcho", "telegram", "discord", "stt-whisper", "audio-io", "silk", "wake-openwakeword", "wake-sherpa", "wake-porcupine", "wake-tflite", "google-chat", "doc-extract", "trace-upload", "supermemory", "mem0", "vision", "pty", "mcp", "nemo-relay", "homeassistant", "sms", "teams", "computer-use", "acp", "mistral", "otlp", "bedrock", "vertex", "azure-identity", "termux", "termux-all", "dingtalk", "feishu", "google", "youtube", "web", "all"]
+[package.metadata.requires-dev]
+icon-build = [
+ { name = "pillow", specifier = "==12.3.0" },
+ { name = "resvg-py", specifier = "==0.4.0" },
+]
+
[[package]]
name = "hf-xet"
version = "1.5.2"
diff --git a/website/scripts/prebuild.mjs b/website/scripts/prebuild.mjs
index a577520f758..7d7f29fcbe7 100644
--- a/website/scripts/prebuild.mjs
+++ b/website/scripts/prebuild.mjs
@@ -128,7 +128,7 @@ console.log("[prebuild] generating icon assets…");
{
const r = spawnSync("node", [iconGenScript], { stdio: "inherit", cwd: repoRoot });
if (r.status !== 0) {
- console.error("[prebuild] icon generation failed — install the dev extra with `uv sync --extra dev`");
+ console.error("[prebuild] icon generation failed — see the isolated icon-build runner output above");
process.exit(1);
}
}