Skip to content

fix(windows): start and persist host agent after install#954

Merged
Lightheartdevs merged 1 commit intomainfrom
fix/windows-host-agent-startup
Apr 13, 2026
Merged

fix(windows): start and persist host agent after install#954
Lightheartdevs merged 1 commit intomainfrom
fix/windows-host-agent-startup

Conversation

@Lightheartdevs
Copy link
Copy Markdown
Collaborator

Summary

  • The Windows installer never ported the host agent startup from Linux Phase 07
  • After install, the dashboard showed "Host agent is offline" and extension management was completely broken
  • This adds agent startup during install, login persistence via Windows Scheduled Task, and full CLI management (.\dream.ps1 agent start/stop/restart/status/logs)

Changes

installers/windows/lib/constants.ps1

  • Add agent constants (port 7710, PID file, log file, health URL, scheduled task name)

installers/windows/phases/07-devtools.ps1

  • Start host agent after devtools installation (with reinstall handling — kills old agent first)
  • Register DreamServerHostAgent Windows Scheduled Task for login persistence
  • Prepend Docker bin to PATH so agent can find docker.exe on fresh installs
  • Graceful fallback if Python is missing

installers/windows/dream.ps1

  • Add Invoke-Agent function with status|start|stop|restart|logs subcommands (mirrors Linux cmd_agent())
  • Wire agent command into dispatch switch
  • Integrate agent health into Invoke-Status output
  • Auto-start agent on dream.ps1 start (all services)
  • Auto-stop agent on dream.ps1 stop (all services)
  • Add to help text

Test plan

  • .\dream.ps1 agent status — reports running/not responding
  • .\dream.ps1 agent start — starts agent, health check passes
  • .\dream.ps1 agent stop — stops agent, cleans PID file
  • .\dream.ps1 agent restart — stop + start cycle
  • .\dream.ps1 status — shows Host Agent line in status output
  • Dashboard extensions page — "Host agent is offline" banner gone
  • .\dream.ps1 agent logs — tails log file
  • Scheduled task persists across reboot
  • Reinstall kills old agent and starts fresh

Note

The Windows python3.exe App Execution Alias (Microsoft Store redirect) can crash the agent if it spawns python3 internally. Users who encounter this should disable the alias in Settings → Apps → Advanced app settings → App execution aliases. This is a pre-existing agent issue, not introduced by this PR.

🤖 Generated with Claude Code

The Windows installer never ported the host agent setup from Linux Phase 07.
After install, the dashboard showed "Host agent is offline" and extension
management was broken.

- Add agent constants to constants.ps1 (port, PID file, log, health URL, task name)
- Start agent in 07-devtools.ps1 with reinstall handling and scheduled task
  registration for login persistence
- Add Invoke-Agent function to dream.ps1 with status/start/stop/restart/logs
- Integrate agent into dream.ps1 start/stop/status commands
- Prepend Docker bin to PATH in agent launch to handle fresh Docker installs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Sensitive Files Detected

Trigger: Security-sensitive files detected: dream-server/installers/

Files flagged:

dream-server/installers/windows/dream.ps1
dream-server/installers/windows/lib/constants.ps1
dream-server/installers/windows/phases/07-devtools.ps1

Extra human review is recommended for this PR.


Claude Code Review | Sensitive File Detection | ~$1.50

@Lightheartdevs Lightheartdevs merged commit cb2aa3f into main Apr 13, 2026
27 checks passed
Lightheartdevs added a commit that referenced this pull request Apr 18, 2026
…ery --max-time

Three small bug fixes from PR #985 audit:

1. Windows: WHISPER_PORT was hardcoded to 9000. If a user sets a different
   port in .env (port conflict resolution), the pre-download block probed
   the wrong port and failed silently. Now resolves dynamically like
   Linux/macOS.

2. Windows: Get-Content can choke on legacy BOM-prefixed .env files (written
   by old Set-Content -Encoding UTF8 in pre-PR-#954 installs). Switch to
   [System.IO.File]::ReadAllText with UTF8NoBom, and defensively strip any
   leading BOM byte regardless.

3. Linux: Phase 12's STT_RECOVERY_CMD string omitted --max-time 3600, so
   users running the printed recovery curl could hang indefinitely.
   macOS and Windows already had --max-time; Linux now matches.
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.

1 participant