Files
the_kurgan/kurgan
paulandClaude Opus 5.5 3e84ab1322 Privilege split 5/11: host kurgan.hw as a Windows service (pywin32)
- kurgan/hw/winservice.py: pywin32's ServiceFramework, hosted by the base
  interpreter's python.exe (PrepareToHostSingle + StartServiceCtrlDispatcher),
  not pythonservice.exe. The venv's python.exe is a redirector that starts the
  base interpreter as a child, and the service manager only talks to the
  process it started. Recorded as Decision 0002 in the vault.
- Accepts stop and shutdown; both end the hardware loop, which leaves the case
  fans at 100% and hands the top fans back to the BIOS curve. An unexpected
  failure exits without reporting "stopped", so the recovery actions (set by
  setup.ps1: restart after 5 s, 10 s, 60 s) bring it back.
- hw_service.py: the service's image, run as
  "<base python>" -I -S -B hw_service.py. It adds the repo and the venv's
  site-packages itself (pywin32's .pth bootstrap included), so the base
  interpreter's own packages never load and SYSTEM writes no .pyc into the
  repo. --check imports everything the service needs (setup.ps1 runs it
  first); started from a console it runs the service in the foreground.
- requirements.txt: pywin32>=311 (312 has cp314 wheels).
- Tests: 5 new (stop/shutdown, the run, failure exits, console fallback, and
  the bootstrap under the base interpreter in isolated mode).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-05 19:30:25 +13:00
..