Skip to content

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

@Jensenwgd

Description

@Jensenwgd

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions