Fix: GitHub Copilot on Windows/WSL — stop breaking Copilot's own logging (issue #78)
COPILOT_HOME is GitHub Copilot CLI's own configuration variable — it relocates Copilot's entire config, including session-state/, session.db, and events.jsonl. Earlier guidance to set COPILOT_HOME=/mnt/c/Users/<you>/.copilot for Token Optimizer's benefit was also read by the native-Windows Copilot CLI, which then wrote its session logs to a /mnt path that doesn't exist on Windows — silently stopping its logging (and downstream tools like Langfuse lost session output).
What changed
- Token Optimizer no longer overloads
COPILOT_HOME. It uses its own collision-free override,TOKEN_OPTIMIZER_COPILOT_HOME, which the Copilot CLI never reads. - Auto-detection for WSL-root. Running
bash install.sh --copilotfrom a Windows shell now auto-detects your real Windows Copilot home under/mnt/c/Users/<you>/.copilot— no environment variable needed. - Guardrail. If
COPILOT_HOMEis set to a/mntpath, Token Optimizer warns that it breaks native-Windows Copilot's own logging and points you to the fix. - Quieter diagnostics. Repeated home-resolution warnings are deduplicated (they previously printed up to four times per command).
If you set COPILOT_HOME on Windows following older guidance
Unset it (or set it back to C:\Users\<you>\.copilot) and restart Copilot — your session-state/ logs return immediately. Only if you have multiple Windows profiles do you need to set TOKEN_OPTIMIZER_COPILOT_HOME=/mnt/c/Users/<you>/.copilot (Token Optimizer only; never Copilot's own variable).
See docs/copilot.md for the full Windows/WSL section.