itwillsync icon indicating copy to clipboard operation
itwillsync copied to clipboard

[Bug] WSL2 cross-environment: persistent token fails across daemon restarts

Open Jensenwgd opened this issue 6 months ago • 1 comments

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

Jensenwgd avatar May 11 '26 13:05 Jensenwgd

Completely missed this BUG, will look into this EOD.

shrijayan avatar May 19 '26 06:05 shrijayan