Skip to content

[FEATURE]: Add unarchive/restore for archived sessions #24153

Closed as duplicate
shoootyou/opencode
#18

Description

@alohaninja
  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Problem: Archiving a session is currently a one-way operation. Once archived, sessions disappear from the sidebar and the only place they're visible is dimmed in the command palette file picker. There's no way to restore them without directly hitting the API.

Related issues:

Proposed solution:

Add an unarchive action that restores an archived session to active status and navigates to it. The backend already supports this — UpdatedTime accepts archived: null — it just needs UI wiring.

Entry points (Web app):

  • Command palette: "Unarchive session" command
  • Command palette file picker: action on dimmed archived sessions (the one place they're already visible)
  • Session dropdown menu: show "Unarchive" instead of "Archive" when viewing an archived session by URL
  • Keyboard shortcut via command palette

Entry points (TUI):

  • Session list dialog: new keybind to archive/unarchive toggle

Behavior: Unarchiving restores the session to its original workspace grouping and navigates to it.

Scope of changes:

  • PATCH endpoint validation: accept null for time.archived (~1 line)
  • unarchiveSession() function + command palette entry in layout.tsx
  • Event reducer: handle un-archive events in reactive store
  • File picker: unarchive action on archived session rows
  • Message timeline dropdown: conditional archive/unarchive
  • TUI session list: archive/unarchive keybind
  • i18n: common.unarchive, command.session.unarchive

Estimated ~100-150 lines across ~8 files. No new dependencies. No schema/migration changes needed.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 24, 2026
  2. github-actions commented on Apr 24, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:


    For the TUI keybind aspect mentioned in this issue, please also check our pinned keybinds documentation: #4997

  3. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. Mehdi-afs commented on May 7, 2026

    @Mehdi-afs

    This feature is missing in the opencode desktop to bring back archived sessions, today I spent half hour fixing this to access and important session i mistakenly archived in desktop app.
    The desktop app has a poor design in this regard because it does not ask for confirmation of arching. It must ask are you sure to do this??

  5. sergioatp commented on May 15, 2026

    @sergioatp

    I'm stressing with this too. Sometimes we archive because we double-click the mouse, this needs to be fixed, man.

  6. SharkDriver commented on May 17, 2026

    @SharkDriver

    Please add "unarchive" to desktop. Please!

  7. The-Ai-DevOps commented on May 19, 2026

    @The-Ai-DevOps

    +1

  8. sorasoras commented on Jun 9, 2026

    @sorasoras

    without this feature, The archive feature should have been disable

  9. aleksandr-openlab commented on Jul 28, 2026

    @aleksandr-openlab
  10. binatheis commented on Aug 17, 2026

    @binatheis

    Also for Desktop please. Is UX nightmare!

  11. alohaninja commented on Aug 21, 2026

    @alohaninja
    Author

    I looked into this and the interesting part is that it isn't only missing UI — the clear path is broken in two places, so wiring up an "Unarchive" button alone returns HTTP 200 and does nothing. That's probably worth knowing before anyone else picks this up.

    1. packages/core/src/session/projector.ts — time_archived: info.time.archived passes undefined when the timestamp is cleared, and Drizzle omits undefined keys from .set(). That means "leave this column alone", not "set NULL", so the row keeps its old archived value.

    2. The session update handler — the guard is if (ctx.payload.time?.archived !== undefined). A client clearing the field sends {"time":{}}, because JSON.stringify drops undefined-valued properties, so the guard short-circuits and setArchived is never reached.

    I've put a fix up as a draft: #43919. It fixes both, adds the restore action (dropdown, command, and ctrl+a in the TUI), and makes archived sessions findable via palette search grouped under "Archived" — otherwise the restore action is unreachable, since you can't select a session you can't see. That last part is what #13463 asked for and what the review feedback on #24154 was pointing at.

    Since packages/desktop mounts AppInterface from @opencode-ai/app, this also covers the desktop app, which is what @Mehdi-afs, @SharkDriver and @binatheis were asking about here.

    @rekram1-node — I see this is assigned to you, so I don't want to cut across your work. Happy to have the PR closed if you've already got an approach in flight; I mainly wanted the two bugs written down somewhere visible. If it's useful as-is I'll mark it ready for review. I've deliberately left the sidebar "Archived" section out of scope — archived rows are stripped at three separate store layers before the sidebar sees them, and relaxing that also affects sessionTotal/hasMore accounting, so it seemed better as its own change.

    One separate thing several people raised above: archiving has no confirmation step, which is how most of you got here. That's arguably the actual bug and it's independent of restore — worth a separate issue if there isn't one.

  12. alohaninja commented on Sep 8, 2026

    @alohaninja
    Author

    Follow-up on my note above - the fix is up.

    Split in two, since small PRs move much faster here:

    To be clear for anyone waiting on desktop: #47848 on its own doesn't add a button - it makes unarchive work at all, which was the blocker. The UI is the second one.

  13. neriousy commented on Oct 1, 2026

    @neriousy
    Member

    Closing as a duplicate of #6680, which tracks viewing and restoring archived sessions. Please add your use case and 👍 there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions