fix: supervise dashboard and terminal ws runtime with health checks#418
fix: supervise dashboard and terminal ws runtime with health checks#418AgentWrapper wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| const notes = svc.details; | ||
| console.log( | ||
| ` ${svc.id.padEnd(22)}${processState.padEnd(12)}${port.padEnd(8)}${ready.padEnd(8)}${notes}`, | ||
| ); |
There was a problem hiding this comment.
Chalk-colored strings break padEnd column alignment
Medium Severity
colorProcessState returns a chalk-formatted string containing invisible ANSI escape codes. Calling .padEnd(12) on this string counts those escape characters toward the length, so the padding will be far too short and the status table columns will be visibly misaligned. The ready column using chalk.green/chalk.red via .padEnd(8) has the same problem.
Additional Locations (1)
| const status = await getStatusForManager(config, "supervisor"); | ||
| return { manager: "supervisor", stopped, status }; | ||
| } | ||
| } |
There was a problem hiding this comment.
Auto-stop ignores running supervisor when systemd available
High Severity
When preference is "auto" and systemd is available, stopManagedServices only attempts stopSystemdServices and returns stopped: true on success. If services were actually started via the supervisor fallback (which happens when systemd is available but startSystemdServices failed at runtime), the supervisor and its child processes are never stopped. systemctl stop on inactive units succeeds silently, masking the issue.
| } | ||
| } else { | ||
| await preflight.checkPort(port); | ||
| port = newPort; |
There was a problem hiding this comment.
Port-in-use preflight check removed for normal start
Medium Severity
The old code called preflight.checkPort(port) when opts?.autoPort was false (normal ao start with existing config), giving a clear "Port N is already in use" error. This check was removed entirely. Now, if the configured port is occupied, startManagedServices launches services that fail to bind, producing only a vague "readiness checks are still failing" message instead of an actionable diagnostic.


Closes #417
Summary
This PR replaces fragile ad-hoc dashboard/ws dev process usage with a supervised runtime model and explicit health/status visibility for:
3000)14800)14801)It also explicitly addresses recurring
Connecting... XDAstalls by supervising both websocket backends and exposing readiness checks for them.What Changed
ao servicescommand group:ao services installao services startao services stopao services status(--strict/--json)ao services run-supervisor)enable)ao startnow starts supervised services instead of launching ad-hocpnpm devprocess treesao stopnow stops managed services (with legacy best-effort port cleanup fallback)start:dashboardstart:terminalstart:direct-terminalpackages/cli/__tests__/lib/services.test.tspackages/cli/__tests__/commands/services.test.tspackages/cli/__tests__/commands/start.test.tsfor managed service integrationREADME.mdSETUP.mdTROUBLESHOOTING.mdAcceptance Criteria Coverage
Restart=always/ao/and/sessions/<id>remain reachable under routine restarts:Connecting... XDAfrom missing ws backends):ao services statusDesign Trade-offs
systemduser services on Linux for robust lifecycle/autostart semantics.ao services installfor normal operation; keepao dashboardas explicitly unsupervised dev mode.Validation (exact commands run)