Reusable, idempotent patches for the pipx-installed headroom-ai
package. pipx upgrade headroom-ai overwrites package files, so re-run after
upgrades. Safe to run any number of times — already-applied patches are a no-op.
# clone this gist anywhere
git clone https://gist.github.com/6393502f87f8c64e5afc19b8c983af0c.git headroom-patches
cd headroom-patches
chmod +x apply.sh patch_headroom.py
./apply.shapply.sh patches the package, then restarts the default persistent
deployment.
Override defaults via env:
HEADROOM_VENV_PY— path to the headroom venv python (default~/.local/pipx/venvs/headroom-ai/bin/python)HEADROOM_PROFILE— deployment profile to restart (defaultdefault)
Patch only, no restart:
~/.local/pipx/venvs/headroom-ai/bin/python patch_headroom.pyExit codes: 0 applied/no-op, 2 an anchor was not found (upstream source
changed — re-derive the patch before trusting it).
-
docker-entrypoint-dupe — the code appends
headroom proxyto the container args, but the image ENTRYPOINT is already["headroom","proxy"]. The duplicate makes click fail withGot unexpected extra arguments (headroom proxy), the container crashes on start, andheadroom install apply --preset persistent-dockernever becomes ready (Deployment 'default' did not become ready after start.). Fix: pass only the proxy flags. -
cache-perms — the container
HOME(/tmp/headroom-home) is the docker workdir, created root-owned and not writable by the--useruid, so huggingface_hub/onnx spam[Errno 13] Permission denied: .../.cacheon every request. Fix: redirectXDG_CACHE_HOME/HF_HOME/HUGGINGFACE_HUB_CACHEinto the bind-mounted, user-writable.headroomdir (also persists the cache across restarts).
patch_headroom.py— self-locating, idempotent patcher (the source of truth)apply.sh— wrapper: patch + restart deploymentruntime.py.prepatch(created next to the package file) — pristine snapshot taken on first apply after each upgrade
Both are bugs in headroom-ai itself; these patches are a stopgap until they're
fixed upstream. Tested against the persistent-docker preset. The patcher only
edits source it can match exactly and recompiles after, so a changed upstream
file fails loudly (exit 2) rather than silently corrupting the install.