Conversation
…rites, session validation, config error handling
…on, process.on(exit) cleanup, additional tests
|
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. |
|
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. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
|
This PR was closed by automated PR cleanup (older than 1 month, fewer than 2 reactions). I'd like to request reopening because: The underlying issue (#43488) is still open. When opencode crashes, there is no mechanism to automatically resume the most recently active session on next startup. Users have to manually find and resume their session, which is particularly painful after an unexpected crash during long-running tasks. The feature is opt-in. It's gated behind No alternative exists. No other PR implements crash recovery. The feature has been requested by multiple users in the issue thread. The PR was in a reviewable state. It includes tests for the manifest lifecycle (write, read, clear, crash detection) and was typecheck-clean. I'm still actively maintaining this PR and would appreciate it being reopened. |
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