Skip to content

Lot 9: one set of rules for every way a session ends - #19

Merged
geeooff merged 2 commits into
mainfrom
lot-9-session-end
Oct 17, 2026
Merged

geeooff merged 2 commits into
mainfrom
lot-9-session-end

Conversation

@geeooff

@geeooff geeooff commented Oct 17, 2026

Copy link
Copy Markdown
Owner

A second machine's log, and a watcher that vanished here mid-game on 2026-10-11, showed three gaps in how a session ends. This gathers every way a session can end into one set of rules, written as one table in docs/design/09-robustness.md.

How the session ends Stop commands Marker
The game ends, Quit, stop run removed, or left if one failed
Windows ends the session not tried: they would die unborn left
An update, a reload not run left
The watcher vanishes — stays open

At start, a marker is resumed if a game still runs, and otherwise its stop commands run once. A marker still open is reported at warn: the last watcher ended without stopping.

What changes for the user

  • Windows ending the session is written at info, before the watcher answers. The Stopped that follows can be lost, because Microsoft documents that the session may end as soon as every application has returned from WM_ENDSESSION.
  • At a session end, no command is tried. The stop commands run at the next logon, as they already did, and the two warnings that came with them are gone.
  • A stop command that fails as a game ends runs again at the next start. A game closed by a shutdown triggers exactly that failure.
  • When the last watcher ended mid-game without stopping, the next start says so at warn.

Code

  • StopReason::SessionEnd.
  • StopSignal records one reason instead of one flag per reason.
  • Outcome::confirmed becomes any_failed.
  • The marker gets a state line (open or left). A marker with no state line, as written by 0.3.0, reads as left.
  • status shows the marker's state.

Verified

  • build.ps1 test passes. Four scenarios were added, and the ones the old rules had shaped were rewritten.
  • In the field on 2026-10-17, by the maintainer, read back from the log. The details are in the lot page.
    • A shutdown during a game: the stop command was refused before the watcher was told, and ran at the next start.
    • Two watchers ended from Task Manager, one resumed and one closed, each reported at warn.
  • Both real shutdowns carried ENDSESSION_CLOSEAPP. A first version read that flag as an installer's request; that branch was removed.

A second commit records one of Lot 17's pending checks: the old gamemode-executor.log was pruned.

🤖 Generated with Claude Code

geeooff and others added 2 commits October 17, 2026 11:40
A second machine's log showed three gaps. Windows ending the session was
logged at debug and the Stopped after it is often lost, since the session
may end as soon as WM_ENDSESSION returns, so a shutdown and a vanished
watcher read alike. A stop command refused as a game closed with the
shutdown was never run again. And two watchers had vanished mid-game,
there and here, with nothing at the next start to say so.

Now the session end is written at info before answering Windows, and
tries no command, since none started then lives; the session is left to
the next start. At any other end the stop commands run and a failure
leaves the session for one retry. The marker's state says whether a
watcher still held it, so a start can warn that the last one ended
without stopping. StopSignal records one reason instead of a flag each.

Seen in the field on 2026-10-17: a shutdown mid-game whose stop command
failed before the window was asked and ran at the next start, and two
watchers ended from Task Manager, each named at warn. Both real session
ends carried ENDSESSION_CLOSEAPP, so it is no longer read as an
installer's request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One of Lot 17's three things left to see: the single gamemode-executor.log
is gone, eight dated files kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@geeooff
geeooff merged commit 8616924 into main Oct 17, 2026
1 check passed
@geeooff
geeooff deleted the lot-9-session-end branch October 17, 2026 09:56
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