Repository navigation
Closed as not planned
Closed as not planned
Copy link
Description
Description
When clicking the "Archive" button in OpenCode Desktop for Windows, all conversation history from the current session that hasn't been persisted to the database is permanently lost. This is a critical data loss bug.
Impact
- Severity: Critical (data loss)
- Affected Users: All Windows Desktop users
- Data Lost: 4+ hours of conversation history (in my case)
Steps to Reproduce
- Open OpenCode Desktop on Windows 10/11
- Start a new conversation and chat for several hours
- Do NOT manually save/export the conversation
- Click the "Archive" button in the session list
- The current session disappears from the list
- All messages from ~17:57 to ~21:40 are permanently lost
Expected Behavior
- Archiving a session should save all pending messages to the database first
- Archived sessions should be recoverable via an "Unarchive" function
- Users should be warned if there are unsaved messages before archiving
Actual Behavior
- Session data in memory is NOT persisted before archiving
- No confirmation dialog warns about unsaved data
- No way to recover the archived session
- Database shows no record of the lost conversation
Technical Evidence
Database Query Results
Queried ~/.local/share/opencode/opencode.db:
SELECT id, slug, title, time_updated FROM session ORDER BY time_updated DESC LIMIT 10;| Session ID | Title | Last Updated (Local Time) |
|---|---|---|
| ses_2adb34a58ffelj8oJzw2806lGG | GitHub 项目本地部署与启动流程 | 2026-04-03 14:49:12 |
| ses_2ac431abcffefonOJboRolkgoG | 恢复归档会话记录 | 2026-04-03 14:37:59 |
| ses_2ad40870affew5ZoDh95e1eu2N | T2: 禁用危险 Sandbox 参数 | 2026-04-03 13:44:49 |
All sessions were last updated BEFORE 17:00, but I was actively chatting until 21:40.
File System Analysis
Checked ~/.local/share/opencode/storage/session_diff/:
- All session diff files are empty (2 bytes, content:
[]) - No session data persisted between 17:57-21:40
Timeline
| Time | Event |
|---|---|
| 14:49 | Last session saved to database |
| 17:57 | Started new conversation (NOT in database) |
| 21:40 | Clicked "Archive" button |
| 21:40+ | 4+ hours of conversation history lost |
Root Cause Analysis
Based on source code review and database analysis:
- Session auto-save mechanism is broken - Messages are not being persisted to the database in real-time
- Archive action does not trigger a save - Clicking archive should flush pending messages first
- No warning dialog - Users are not warned about unsaved data before archiving
- No recovery mechanism - Archived sessions cannot be recovered
Suggested Fixes
Immediate (Critical)
- Add confirmation dialog before archiving if there are unsaved messages
- Force save pending messages before executing archive action
- Add warning toast if archive is attempted with pending data
Long-term
- Implement proper session persistence - Auto-save messages every N seconds
- Add unarchive functionality - Allow users to recover archived sessions
- Add session backup - Create backup before destructive operations
Workarounds (for users)
Until this is fixed, users should:
- Regularly export conversations using
/exportcommand (Ctrl+X X) - Avoid clicking "Archive" button until the bug is fixed
- Use TUI version (
opencodecommand) - community PR feat: add session archive/unarchive support to TUI #13961 adds archive/unarchive support
Related Issues
- [FEATURE]:希望添加「恢复归档会话」的功能,而不是归档就删除了会话。 #15980 - 希望添加「恢复归档会话」的功能
- 误操作点到归档了,如何能回撤这个操作~ #15677 - 误操作点到归档了,如何能回撤这个操作
- 当一个对话被"归档",要去哪里找回它 #12888 - 当一个对话被"归档",要去哪里找回它
- [FEATURE]: Unarchive session #16000 - [FEATURE]: Unarchive session
Related PRs
- feat: add session archive/unarchive support to TUI #13961 - feat: add session archive/unarchive support to TUI
- feat(session): add archive undo + unarchive command #16212 - feat(session): add archive undo + unarchive command
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
OpenCode Desktop App
Reacted by Moy
Reacted by Sureal Cereal
Metadata
Metadata
Assignees
Labels
No labels
Activity
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
ni3dre commentedon Aug 19, 2026
How to Restore Archived Chats in OpenCode
If you accidentally archived a chat and can't find it anywhere — don't worry, your data is not deleted. OpenCode stores all sessions in a SQLite database, and archiving simply sets a timestamp in the time_archived column. The chat data is still there, just hidden from the UI.
The Problem
OpenCode currently has no built-in way to list or restore archived sessions. So when you hit that archive button by mistake, there's no obvious way to get it back. Now enter the following prompt on any chat page:
That's all. Now restart OpenCode.