Repository navigation
fix: restore the desk on the next start after a session that never ended - #178
Conversation
A session journal (session.json) is written when the desk starts changing and deleted once the restore went through. If it is still there when the app opens, the session is rebuilt from it and from the display, audio and RTSS backups, restored like a normal one, and the user is told. Before, a crash left the screens as the session had them, and Restore now did nothing without an active session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Important
The crash-recovery path can discard the journal after an incomplete display restore, and startup can proceed without a journal when writing it fails.
Reviewed changes This review covers durable session journaling and startup recovery, along with its documentation and tests.
- Session journal persists pre-session audio, desktop icon, and pointer state before applying the main display changes.
- Interrupted-session recovery rebuilds the restore state at startup, restores it before auto-start, and reports recovery to the user.
gpt-6-luna | 𝕏
…hout it The journal is written before the desk changes; if it can't be written the session doesn't start. A restore that leaves the screens wrong keeps the journal for the next start, up to two attempts, so a screen gone for good doesn't restore the desk on every start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Both points fixed in the latest commit:
Tested on Windows: a 🤖 Generated with Claude Code |
There was a problem hiding this comment.
Important
The retry-counter update can destroy the only recovery journal before restoration completes.
Reviewed changes Reviewed the follow-up commit that hardened journal writes and retries after unsuccessful display restoration.
- Aborted sessions without a journal Prevented a session from starting when its initial recovery journal cannot be written.
- Retried incomplete restores Retained the journal when display restoration fails and limited recovery to two startup attempts.
gpt-6-luna | 𝕏
Written to a .tmp file and swapped in, so a crash while updating the retry count can't leave a cut-short journal that would be dropped as unreadable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fixed: 🤖 Generated with Claude Code |
There was a problem hiding this comment.
ℹ️ No critical issues; one minor durability-contract clarification inline.
Reviewed changes Reviewed the follow-up that writes the session journal through a sibling temporary file before replacing it.
- Replaced journal writes safely Wrote updates to a temporary sibling file before moving it over the journal, and added a rewrite test.
Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:
src/ConsoleMode/Services/SessionJournal.cs:445(RIGHT) — line 445 (RIGHT) is not inside a diff hunk
gpt-6-luna | 𝕏
| { | ||
| var temp = path + ".tmp"; | ||
| File.WriteAllText(temp, Serialize(journal)); | ||
| File.Move(temp, path, overwrite: true); |
There was a problem hiding this comment.
Writing beside the journal avoids truncating the destination while the temporary contents are produced, but File.Move(..., overwrite: true) does not document a power-loss durability guarantee for the replacement itself. The XML comment therefore promises more than the API contract establishes; see .NET File.Move and Windows MoveFileExW.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
ℹ️ No critical issues — one minor durability-contract clarification inline.
Reviewed changes Reviewed the follow-up that flushes the temporary session journal before replacing the existing file.
- Flushed journal contents Persisted the temporary file's data before moving it over the journal.
Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:
src/ConsoleMode/Services/SessionJournal.cs:440(RIGHT) — line 440 (RIGHT) is not inside a diff hunk
gpt-6-luna | 𝕏

What
PRD CORE-012 / D-22. Today, if Console Mode closes or the PC shuts down in the middle of a session, nothing is restored afterwards. The display, audio and RTSS backups stay on disk, but
Engine.Stop()returns early without an active session, so "Restore now" does nothing and the desk stays as the session left it (TV as the only screen, desk monitors off).Now:
session.jsonin the data folder): the launcher, the audio output before the session, the desktop icons (feat: put desktop icons back in place after a console session #167) and the pointer position (feat: move the mouse pointer out of the way during a session #177). Displays and RTSS already have their own backup files.Tests
dotnet test: 576 passing. NewSessionJournalTests: round trip, missing parts, broken or half-written files, and no file.ConsoleMode.exemid-session: JoyChromium stayed full screen andsession.jsonwas on disk. Reopening the app loggedRecuperação: a sessão … não terminou, restored the layout, sent JoyChromium back to a window, moved the pointer back to 500,350, deleted the journal and showed the warning (read through UI Automation).docs/TESTING.md→ "Restauração depois de uma queda".Changelog (Fixes) in both files, a paragraph in every guide, and the PRD: CORE-012 checked, D-22 and CA-03 corrected (the PRD wrongly said displays and audio were already restored after a crash).
🤖 Generated with Claude Code