fixed stop-start

This commit is contained in:
Frank Harris 2026-06-10 17:52:14 -04:00
parent 17afb98f43
commit aa2dd354cf
2 changed files with 197 additions and 23 deletions

View file

@ -28,3 +28,38 @@ Keep startup and stop behavior visible and explicit. Failures should be reported
Detailed status validation design:
- [`GSP_WINDOWS_AGENT_PORT_VALIDATION.md`](GSP_WINDOWS_AGENT_PORT_VALIDATION.md)
## Lifecycle tracking
The Windows agent now tracks per-home runtime metadata under:
- `OGP64/OGP/runtime_status/pid-<home_id>.kv`
Tracked fields include PID/session information used to stop the right process reliably:
- `screen_pid`
- `windows_pid`
- `game_pid`
- `ip`
- `port`
## Stop escalation flow
When stop is requested, the agent now:
1. marks status hint as `STOPPING`
2. creates `SERVER_STOPPED` marker for autorestart handling
3. removes startup flag for `<ip>-<port>`
4. kills tracked PIDs (`screen_pid`, `windows_pid`, `game_pid`) if present
5. kills managed screen session
6. checks if the game port is still listening and kills the owning PID
7. verifies stop success (no managed session, no tracked running PID, no listening game port)
## Restart behavior
Restart remains stop-first and now guards against duplicates:
- stop is attempted first
- waits 60 seconds
- verifies old instance is stopped before starting again
- returns stop failure if the old process/port is still active