DeepSeek-Reasonix icon indicating copy to clipboard operation
DeepSeek-Reasonix copied to clipboard

[Bug]: CLI tools report "not logged in" when Reasonix runs with an overridden HOME (service/supervised deployments)

Open SprayHank opened this issue 4 months ago • 1 comments

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 HOME equals the overridden one; credentials are invisible.

Steps to reproduce

  1. HOME=/some/config/dir reasonix serve ... (or any launcher that overrides HOME).
  2. In a session, run gh auth status.
  3. Result: "not logged in", although /root/.config/gh/hosts.yml exists under the account home. Works fine when Reasonix runs with a normal HOME.

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

SprayHank avatar Aug 03 '26 13:08 SprayHank

Taking this — restoring OS account HOME for bash tool subprocesses (default behavior, keep inherited HOME when account home is missing).

skyzhao1223 avatar Aug 05 '26 09:08 skyzhao1223

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 HOME for tools that resolve credentials via $HOME (gh, etc.).
  • Reasonix-owned data should use REASONIX_HOME when the process home must differ.
  • reasonix doctor warns when process HOME differs from the OS account home while REASONIX_HOME is unset (without embedding absolute paths).

Related discussion: not adopting #7600 automatic HOME rewrite for the same reason.

SivanCola avatar Aug 06 '26 06:08 SivanCola