Repository navigation
Name runs that ended on a sleeping or locked PC instead of calling them unexplained - #199
Merged
Merged
Conversation
…em unexplained A recovered run without a close request, a Windows fault or a Windows stop event was always reported as shutdown-incomplete. Most of those runs on 2.7.x ended on a PC that went to sleep or was locked and never came back, which hid the real unexplained stops among them. The session sentinel window now also receives the sleep, resume, lock and unlock notices (WM_POWERBROADCAST and WM_WTSSESSION_CHANGE) on its own thread, and the run marker keeps the last sleep and lock times. Resuming and unlocking clear them, as does a checkpoint a minute or more after the sleep notice, since the checkpoint timer does not run while Windows sleeps. The next start labels such a run system-sleep or session-locked; a Windows fault, stop or shutdown event still wins, and markers from earlier versions keep today's reading. Like a Windows shutdown, these runs get no dashboard card. Closes #193
Views2k
marked this pull request as ready for review
November 8, 2026 21:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A recovered run without a close request, a Windows fault or a Windows stop event was always
shutdown-incomplete("Wisp stopped without being closed" in Tools). On 2.7.x most of those runs ended on a PC that went to sleep or was locked and never came back, hiding the real unexplained stops among them.What changed
SessionEndSentinelnow also handlesWM_POWERBROADCAST(PBT_APMSUSPEND,PBT_APMRESUMEAUTOMATIC,PBT_APMRESUMESUSPEND) andWM_WTSSESSION_CHANGE(WTS_SESSION_LOCK,WTS_SESSION_UNLOCK, registered withWTSRegisterSessionNotification) on its own thread, and reports every notice through oneSessionNoticecallback. The shutdown notices keep their behaviour.SuspendedAtUtcandSessionLockedAtUtc. Resuming and unlocking clear them; a checkpoint a minute or more after the sleep notice also clears it, because the checkpoint timer does not run while Windows sleeps. Invalid times (not UTC, before the run started) are dropped on read, so a marker from an earlier version keeps today's reading.PreviousRunRecoverysetsRecoveredExitInfo.Suspended/SessionLockedfrom the previous marker when there is no fault, no native record, no Windows stop and no shutdown event. A matched fault clears both.system-sleeporsession-locked(sleep wins when both are set);shutdown-incompleteremains for runs with neither state. Both reasons join theReasonscatalog (the Tools catalog was extended in Views2k/wisp-site first, since ingestion validates reasons).Verified
PreviousRunRecoveryTests(suspended / locked / both / neither reasons and report text; stop and shutdown events win; fault and recorded shutdown win),RunExitMarkerStoreTests(notices survive checkpoints and restart until withdrawn, invalid times rejected and dropped, late checkpoint clears sleep),SupplementaryIncidentCaptureTests(reason mapping and catalog validity),DiagnosticsViewModelCrashNoticeTests(no card). The PR gate selects these classes.dotnet format whitespaceon the changed files;wisp-preflight. Windows build and tests run in CI.Unverified
WTSRegisterSessionNotificationon a PC where the Terminal Services service is stopped: the sentinel then records shutdowns and sleep only.Closes #193