fix(resident): report unflushed changes after crash - #331
Open
y4ho0 wants to merge 1 commit into
Open
Conversation
y4ho0
marked this pull request as ready for review
August 20, 2026 14:44
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.
Summary
saveandclosereturnresident_unflushed_changes_lostinstead of claiming the stale file is already savedScope
This implements the issue's minimum honest-recovery option. It does not replay lost edits: replaying arbitrary resident operations as a WAL can duplicate non-idempotent mutations if a process dies after saving the document but before clearing the journal. The warning instead tells the caller that the resident may have lost acknowledged in-memory edits and points short-lived agent harnesses to
OFFICECLI_RESIDENT_FLUSH=each.The marker contains only a version, process ID, and timestamp. Its filename is derived from the same canonical per-document identity used by resident IPC; it does not store the document path.
Validation
dotnet build src/officecli/officecli.csproj -c Release --no-restore(0 errors; one pre-existing nullable warning inExcelHandler.SheetShift.cs)SIGKILL: memory heldafter crash, disk heldbefore crash, and the nextsave --jsonexited 1 withresident_unflushed_changes_lostsavecontrol + validated resident PID +SIGKILL: disk retainedsaved value, and the nextsave --jsonsucceeded without a recovery warningget --jsonreturned the last saved value with the recovery warning; the second returned the value without repeating the warninggit diff --checkRefs #328