`hostname -I` is net-tools only; CachyOS (and any GNU inetutils host) lacks it, so c3_lan_ip
returned empty → the studio URLs fell back to `localhost` (and the reporter hit a setup abort
they attributed to it).
- c3_lan_ip: try `hostname -I`, then fall back to the portable `ip -4 -o addr show scope global`.
Always returns 0 (callers no longer need a `|| true` guard).
- .env is now the source of truth for LANIP, like MODEL_DIR: comfyui-paths.sh reads LANIP from
repo-root .env at source time (env still wins), and a new c3_resolve_lanip() PERSISTS an
auto-detected IP back to .env (user-editable) — or, if nothing detects, falls back to localhost
and tells the user to set LANIP in .env. Precedence: shell-env > .env > auto-detect > localhost.
- setup-ai-studio.sh calls c3_resolve_lanip (the persister); gpu-mode keeps reading (it now picks
up the .env value + the portable detect, no write on a mode switch).
- derig guard: assert the `ip` fallback exists (no hostname-only regression) + accept the
c3_resolve_lanip wrapper.
Verified: net-tools host, faithful CachyOS host (hostname rejects -I → ip fallback), pinned
.env/env (reused, not overwritten), and no-detect (localhost + instruction). Real repo .env
untouched by the tests.
Claude-Session: https://claude.ai/code/session_01EfF565T9eSLaqGzidyJ1Pm
Co-authored-by: noonghunna <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>