template.apply: subprocess env missing, debug-profile builds, no nutools fallback #27

Closed
opened 2026-05-25 05:57:25 +00:00 by zaelgohary · 1 comment
Member

provisioning.template.apply enqueues lab flow template build as a daemon-side hero_proc job, but several env requirements arent satisfied so every template build fails fast.

Symptoms

  1. PATH_ROOT not set — lab shells out into hero_lib code that calls path_root().expect("PATH_ROOT"), panicking the build subprocess immediately. The daemon runs under hero_proc with a minimal env so the var is simply absent.
  2. Debug profilelab flow template build defaults to a debug build. Template rollouts ship the resulting ~/hero/bin/ to every managed user, so debug binaries are an order of magnitude larger than necessary and slower at runtime.
  3. HERO_NUTOOLS_DIR not set — labs nu-modules installer falls back to $PATH_ROOT/code/hero_skills/nutools which is empty on herodev (/root/hero/code/hero_skills/ exists but doesnt contain nutools/). Without it lab errors out at the nu-install step.
  4. HERO_MIN_BIN_BYTES guard kills aggressive-opt binaries — labs orchestrator has a 512KB minimum-binary-size guard that flags small release binaries as corrupt and deletes them. With size-optimized release builds several binaries fall under 512KB and get wiped.

Fix

Daemon-side patch in crates/hero_codescalers_server/src/provisioning.rs:

  • Export PATH_ROOT=/root/hero before invoking lab.
  • Pass --release to lab flow template build.
  • Auto-detect a real nutools/ checkout (env var → /root/hero/code/.../home/*/hero/code/hero_skills/nutools) and export HERO_NUTOOLS_DIR when found.
  • Export HERO_MIN_BIN_BYTES=0 to defeat the size guard.
  • Apply the same env preamble to provisioning.common.apply (also invokes lab).

Lab-side cleanups (separate issues to follow) should make nutools portable and relax the 512KB guard so the daemon doesnt need workarounds.

`provisioning.template.apply` enqueues `lab flow template build` as a daemon-side hero_proc job, but several env requirements arent satisfied so every template build fails fast. ## Symptoms 1. **`PATH_ROOT` not set** — lab shells out into hero_lib code that calls `path_root().expect("PATH_ROOT")`, panicking the build subprocess immediately. The daemon runs under hero_proc with a minimal env so the var is simply absent. 2. **Debug profile** — `lab flow template build` defaults to a debug build. Template rollouts ship the resulting `~/hero/bin/` to every managed user, so debug binaries are an order of magnitude larger than necessary and slower at runtime. 3. **`HERO_NUTOOLS_DIR` not set** — labs nu-modules installer falls back to `$PATH_ROOT/code/hero_skills/nutools` which is empty on herodev (`/root/hero/code/hero_skills/` exists but doesnt contain `nutools/`). Without it lab errors out at the nu-install step. 4. **HERO_MIN_BIN_BYTES guard kills aggressive-opt binaries** — labs orchestrator has a 512KB minimum-binary-size guard that flags small release binaries as corrupt and deletes them. With size-optimized release builds several binaries fall under 512KB and get wiped. ## Fix Daemon-side patch in `crates/hero_codescalers_server/src/provisioning.rs`: - Export `PATH_ROOT=/root/hero` before invoking lab. - Pass `--release` to `lab flow template build`. - Auto-detect a real `nutools/` checkout (env var → `/root/hero/code/...` → `/home/*/hero/code/hero_skills/nutools`) and export `HERO_NUTOOLS_DIR` when found. - Export `HERO_MIN_BIN_BYTES=0` to defeat the size guard. - Apply the same env preamble to `provisioning.common.apply` (also invokes lab). Lab-side cleanups (separate issues to follow) should make `nutools` portable and relax the 512KB guard so the daemon doesnt need workarounds.
Author
Member
87bcc2a
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_codescalers#27
No description provided.