Skip to content

fix(hoosage): read Copilot CLI sessions from WSL on Windows - #48

Merged
wakemeup0 merged 1 commit into
mainfrom
fix/wsl-cli-sessions
Sep 29, 2026
Merged

wakemeup0 merged 1 commit into
mainfrom
fix/wsl-cli-sessions

Conversation

@wakemeup0

Copy link
Copy Markdown
Contributor

Problem

When a WSL folder is opened in Windows VS Code (\\wsl.localhost\<distro>\...), hoosage runs on Windows and only reads the Windows ~/.copilot/session-state. Copilot CLI sessions started inside the WSL distribution (/home/<user>/.copilot/session-state) were never counted, so WSL projects showed far too little CLI usage.

Fix

  • New WslCliSessions (src/core/wsl-sessions.ts): on Windows, lists running distributions via wsl.exe --list --running --quiet right before reading (normally every 15 s), so a stopped distribution is never started. Discovers /root and /home/* .copilot/session-state via \\wsl.localhost\<distro> and reuses CliUsageScanner per folder.
  • Linux cwds are translated before project matching: /home/u/repo → \\wsl.localhost\<distro>\home\u\repo, /mnt/c/repo → C:\repo. WSL CLI sessions therefore join the project of the WSL folder opened in Windows VS Code.
  • Usage read earlier stays visible while a distribution is stopped. Stopped distributions do not hold up indexing.
  • Shared-sync entries whose id was already read locally are skipped, so a peer WSL host sharing the same sessions is not double counted.
  • New setting hoosage.readWslCliSessions (default true). Diagnose Tracking reports the number of WSL session folders read.

Verification

  • npm run check passes (75 tests, including 4 new ones in test/wsl-sessions.test.ts).
  • Real data: 215 CLI calls (~$402.70) from a running VRKB distribution resolve to the project of \\wsl.localhost\VRKB\home\<u>\src\vrkb. Previously none of them were visible.

Windows VS Code windows that open a WSL folder via \\wsl.localhost never saw Copilot CLI sessions run inside that distribution, because only the Windows ~/.copilot/session-state was read. Read session-state of running WSL distributions (never starting a stopped one), map Linux working directories to their Windows form for project matching, and skip shared-sync entries already read locally. Can be disabled with hoosage.readWslCliSessions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@wakemeup0
wakemeup0 merged commit 381f431 into main Sep 29, 2026
7 checks passed
@wakemeup0
wakemeup0 deleted the fix/wsl-cli-sessions branch September 29, 2026 09:46
wakemeup0 added a commit that referenced this pull request Sep 29, 2026
## 0.13.2 (2026-09-29)

### Bug Fixes

- **hoosage:** read Copilot CLI sessions from WSL on Windows (#48) (381f431)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants