Skip to content

feat: add unarchive/restore for archived sessions#24154

Open
alohaninja wants to merge 2 commits intoanomalyco:devfrom
alohaninja:feat/unarchive-sessions
Open

feat: add unarchive/restore for archived sessions#24154
alohaninja wants to merge 2 commits intoanomalyco:devfrom
alohaninja:feat/unarchive-sessions

Conversation

@alohaninja
Copy link
Copy Markdown

@alohaninja alohaninja commented Apr 24, 2026

Issue for this PR

Closes #24153

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Archiving a session is currently one-way — once archived, there is no way
to restore it from the UI. The backend schema already supports clearing
time.archived (the UpdatedTime type accepts NullOr(Number)), so this
wires up the missing pieces.

Backend (2 files):

  • PATCH /session/:id validator now accepts null for time.archived
  • setArchived passes null to the projector when clearing, so
    time_archived = NULL in SQLite

Web app (5 files):

  • unarchiveSession() in layout.tsx — calls update with archived: null,
    then navigates to the restored session
  • Command palette entry "Unarchive session"
  • Session dropdown menu shows "Unarchive" instead of "Archive" when the
    session is archived (conditional via info()?.time?.archived)
  • File picker labels archived sessions with "(archived)" text
  • Event reducer increments sessionTotal when an unarchived session is
    re-inserted into the store

TUI (1 file):

  • ctrl+a keybind in session list toggles archive/unarchive
  • Archived sessions show [archived] prefix in the list

Generated (3 files):

  • OpenAPI spec, SDK types, and SDK client updated via ./script/generate.ts

How did you verify your code works?

  • Type-checked both packages/opencode and packages/app with tsc --noEmit — zero errors
  • API round-trip verified via curl (create → archive → unarchive with null → archived field cleared)
  • TUI boots cleanly on the feature branch
  • Ran Playwright against bun dev serve + bun dev:web to validate the web UI (screenshots below)

Screenshots / recordings

1. Command palette: archived session shows (archived) label

palette-archived

2. Session dropdown: "Unarchive" instead of "Archive" for archived sessions

unarchive-dropdown

3. Session restored and accessible after unarchiving

restored

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Allow users to restore archived sessions back to active status.

Backend: accept null for time.archived in PATCH endpoint to clear
the archived timestamp. Pass null through setArchived to the
projector so time_archived is set to NULL in SQLite.

Web app: add unarchiveSession() and command palette entry. Show
'Unarchive' instead of 'Archive' in the session dropdown when
viewing an archived session. Label archived sessions in the file
picker with '(archived)'. Increment sessionTotal when a session
is re-inserted into the store via un-archive event.

TUI: add ctrl+a keybind in session list to toggle archive state.
Show '[archived]' prefix on archived sessions.

Closes anomalyco#24153
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Apr 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Cleroth
Copy link
Copy Markdown

Cleroth commented Apr 26, 2026

This is a poor solution. We should have the list of archived sessions next to active sessions.

OpenCode_YF2ZHvPFj9

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add unarchive/restore for archived sessions

2 participants