feat(session): crash recovery — auto-resume sessions after crash - #43489
Open
AndyS77 wants to merge 8 commits into
Open
feat(session): crash recovery — auto-resume sessions after crash#43489AndyS77 wants to merge 8 commits into
AndyS77 wants to merge 8 commits into
Conversation
…rites, session validation, config error handling
…on, process.on(exit) cleanup, additional tests
1 task
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Based on the search results, I found one highly related PR: PR #39684: feat(core): recover interrupted sessions on startup This PR appears to address a similar concern about recovering sessions on startup, which overlaps with the crash recovery auto-resume functionality in PR #43489. You may want to review that PR to ensure there's no duplication of effort and to understand any prior approaches to session recovery. |
Author
|
Thanks for the heads up. I reviewed PR #39684 — it's complementary, not a duplicate:
They solve different layers of the same problem: #39684 ensures session data survives the crash, this PR ensures the user gets back into their session automatically. |
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.
Issue for this PR
Closes #43488
Type of change
What does this PR do?
Adds an opt-in config option (
session.auto_resume) that persists active session IDs to a manifest file on disk. On next startup, if the manifest exists (previous process didn't shut down cleanly), opencode automatically resumes the most recently active session. The manifest is cleared on clean shutdown viaprocess.on("exit"). Manifest writes are atomic and shape-validated; corrupt JSON degrades gracefully.How did you verify your code works?
17 tests pass (13 unit + 4 e2e). Live-tested crash, partial-idle, clean-shutdown, corrupt-JSON, multi-session, and write-update scenarios against the real data directory.
Screenshots / recordings
N/A — no UI changes.
Checklist