Bug: Persistent token fails across daemon restarts (WSL cross-environment)
Location: packages/hub/src/daemon.ts line 25-27, getHubDir()
Problem: getHubDir() uses os.homedir() as fallback. When running under WSL2, the Windows npm CLI spawns a WSL node process for the daemon. In that context, homedir() returns /home/<user> (WSL home), but the config is stored in Windows AppData/Roaming/itwillsync/. The daemon writes hub.json and hub.pid to the wrong location, so CLI sessions cannot read the persistent master token — every restart generates a new token and loses session history.
Repro: Run itwillsync claude, close it, restart. Previously opened sessions are lost. Token changes each time.
Suggested fix: Detect WSL environment via WSL_DISTRO_NAME env var, and/or check if the Windows AppData/Roaming/itwillsync/ path exists before falling back to the WSL homedir path.
Environment: Windows 11 + WSL2 (Hyper-V), Node.js 20.x
Bug: Persistent token fails across daemon restarts (WSL cross-environment)
Location:
packages/hub/src/daemon.tsline 25-27,getHubDir()Problem:
getHubDir()usesos.homedir()as fallback. When running under WSL2, the Windows npm CLI spawns a WSL node process for the daemon. In that context,homedir()returns/home/<user>(WSL home), but the config is stored in WindowsAppData/Roaming/itwillsync/. The daemon writeshub.jsonandhub.pidto the wrong location, so CLI sessions cannot read the persistent master token — every restart generates a new token and loses session history.Repro: Run
itwillsync claude, close it, restart. Previously opened sessions are lost. Token changes each time.Suggested fix: Detect WSL environment via
WSL_DISTRO_NAMEenv var, and/or check if the WindowsAppData/Roaming/itwillsync/path exists before falling back to the WSL homedir path.Environment: Windows 11 + WSL2 (Hyper-V), Node.js 20.x