Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

[bug] UpgradeVerify reports existing hooks as missing when the path uses ${HOME-}

Open Jazb opened this issue 1 week ago • 0 comments

Version

LifeOS 8.761.0 · attestation: 5 system file(s) differ from danielmiessler/[email protected]:

  • skills/LifeOS/SKILL.md
  • LIFEOS/TOOLS/Doctor.ts
  • LIFEOS/DOCUMENTATION/ARCHITECTURE_SUMMARY.md
  • LIFEOS/STATUSLINE/producers/UsageRefresh.ts
  • LIFEOS/STATUSLINE/producers/LocationWeather.ts

What is broken

UpgradeVerify reports hooks-registered as critical for hooks that exist when their command refers to the home directory as ${HOME-}. Only $HOME and ${HOME} are expanded, so the path is treated as relative to the config root. The same hook written with ${HOME} passes. An install with such hooks cannot reach a verified upgrade.

Where (file:line)

LIFEOS/TOOLS/UpgradeVerify.ts:160

Repro on a clean tree

# REL = LifeOS/install from a clean v8.761.0 checkout
T=$(mktemp -d); mkdir -p "$T/hooks"; printf '#!/bin/sh\nexit 0\n' > "$T/hook.sh"
echo '{"hooks":{"Stop":[{"hooks":[{"type":"command","command":"/bin/sh \"${HOME-}/hook.sh\""}]}]}}' > "$T/settings.json"
HOME="$T" bun "$REL/LIFEOS/TOOLS/UpgradeVerify.ts" --root "$T" 2>&1 | grep hooks-registered

Negative control

Probe: sh "$REPRO/c.sh" · exit 0 · captured 2026-11-25T20:46:49.525Z

Red looks like: do not exist

  🔴 hooks-registered: 1 registered hook file(s) do not exist: /tmp/tmp.0gw1RXciYT/${HOME-}/hook.sh

Suggested fix

Also expand ${HOME-} and ${HOME:-}.

--- a/LIFEOS/TOOLS/UpgradeVerify.ts
+++ b/LIFEOS/TOOLS/UpgradeVerify.ts
@@ -157,7 +157,7 @@
     for (const m of cmd.matchAll(/([^\s"']+\.(?:hook\.ts|ts|sh|js))(?=$|[\s"'])/g)) {
       let p = m[1]
         .replace(/\$LIFEOS_DIR|\$\{CLAUDE_PROJECT_DIR\}/g, ROOT)
-        .replace(/\$HOME|\$\{HOME\}/g, process.env.HOME || homedir())
+        .replace(/\$HOME|\$\{HOME(?::?-)?\}/g, process.env.HOME || homedir())
         .replace(/^~(?=\/)/, process.env.HOME || homedir());
       if (!isAbsolute(p)) p = join(ROOT, p);
       referenced.add(p);

Verified after fix

Probe: sh "$REPRO/c.sh" · exit 0 · captured 2026-11-25T20:46:49.554Z

  ✅ hooks-registered: 1 registered hook/script file(s) all exist on disk

Environment

  • OS: Ubuntu 24.04.5 LTS (x64)
  • Harness: claude-code
  • bun: 1.4.5 · git: 2.43.0
  • Doctor broken: none

Jazb avatar Nov 25 '26 20:11 Jazb