[Bug]: CLI tools report "not logged in" when Reasonix runs with an overridden HOME (service/supervised deployments)
What happened
When the Reasonix process runs with HOME pointed at a config directory (e.g. a systemd unit or a launcher that forces HOME for config isolation), every bash-tool subprocess inherits that HOME. CLIs that resolve credentials via /root — gh (~/.config/gh) and similar — then look in the wrong place and report "not logged in", even though the credentials exist under the OS account's real home.
Expected vs actual
- Expected: tool subprocesses see the account's real home (or at least a documented/configurable behavior), so CLIs keep working regardless of Reasonix's own
HOME. - Actual: subprocess
HOMEequals the overridden one; credentials are invisible.
Steps to reproduce
HOME=/some/config/dir reasonix serve ...(or any launcher that overridesHOME).- In a session, run
gh auth status. - Result: "not logged in", although
/root/.config/gh/hosts.ymlexists under the account home. Works fine when Reasonix runs with a normalHOME.
Proposed fix (we already run this in our fork)
In the bash tool's subprocess environment construction, point HOME at the OS account home from the user database (os/user, not /root) when that directory exists, and keep the inherited value untouched otherwise (no HOME in the parent env, account home missing on disk, or already equal). Only the bash tool's env is affected; Reasonix's own config isolation (REASONIX_HOME etc.) is unchanged.
Reference implementation: GOGV/DeepSeek-Reasonix-Fork commit b3324cc (feat(bash): restore the OS account home as subprocess HOME), with unit tests.
Question to maintainers: acceptable as default behavior, or should it sit behind a config flag (e.g. [tools.shell] restore_home = true)? Happy to open a PR with the patch either way.
Environment
- Reasonix 1.19.3 (also reproduced on 1.17.21)
- go1.26.5, Linux x86_64, reasonix serve under systemd with
Environment=HOME=/root/.config/reasonix
Taking this — restoring OS account HOME for bash tool subprocesses (default behavior, keep inherited HOME when account home is missing).
Closing as not planned for the CLI stability batch (see #7663 merge 84988e8cdb5a33087228bb8b0a82fef38eff8d06).
Product decision: Reasonix does not automatically rewrite subprocess HOME to the OS account home. Isolation for Reasonix state remains REASONIX_HOME only.
- Services/supervised deployments should keep the real account
HOMEfor tools that resolve credentials via$HOME(gh, etc.). - Reasonix-owned data should use
REASONIX_HOMEwhen the process home must differ. reasonix doctorwarns when process HOME differs from the OS account home whileREASONIX_HOMEis unset (without embedding absolute paths).
Related discussion: not adopting #7600 automatic HOME rewrite for the same reason.