feat(chat): archive the session for sidebar "Delete chat"#1762
feat(chat): archive the session for sidebar "Delete chat"#1762arpitgupta1214 wants to merge 1 commit into
Conversation
Switch the sidebar's delete action to soft-delete via session archive
instead of removing the chat row. The api side filters chats whose
session is `archived` out of `GET /api/chats` (api#630), so the row
disappears from the sidebar; archive also triggers the existing
`stopSandboxOnArchive` lifecycle path on the api so we stop running
sandboxes for chats the user told us they're done with.
This also unblocks deleting the last chat in a session, which the
api previously refused with `400 Cannot delete the only chat in a
session` — archive has no such constraint.
- New `lib/sessions/archiveSession.ts` → `PATCH /api/sessions/{sid}
{ status: "archived" }`.
- `useDeleteChat` calls it (drops the `chatId` arg).
- `DeleteConfirmationModal` no longer passes `chatId`.
- Remove the now-unused `lib/chats/deleteChat.ts`.
Caveat for reviewers: if a session ever has >1 chat, archiving from
one row will hide the others too. Today every sidebar row corresponds
1:1 with its own session (each `POST /api/sessions` mints a session +
single chat), so this is a no-op in practice — but worth knowing
before we add a UI that creates additional chats inside an existing
session.
Depends on api#630 for the filter; until that lands, archived sessions
will still show up in the chat list.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
No issues found across 4 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: This change alters the core chat deletion logic to archive sessions instead, introducing a new API call and modifying the backend behavior, which requires human review to ensure data integrity, handle the caveat about multiple chats per session, and verify the dependency on api#630 is properly met.
Re-trigger cubic
|
Folded into #1758 — that PR was about to wire up a chat-row |
Summary
Switches the sidebar's "Delete chat" action to soft-delete by archiving the owning session instead of deleting the chat row. The api (api#630) filters chats from archived sessions out of
GET /api/chats, so the row disappears from the sidebar; archive also triggers the existing sandbox-teardown lifecycle, and the whole thing is reversible from the admin side.This also unblocks deleting the last chat in a session — the previous chat-row delete refused with
400 Cannot delete the only chat in a session, while archive has no such constraint.lib/sessions/archiveSession.ts→PATCH /api/sessions/{sid} { status: "archived" }.useDeleteChatcalls it (drops thechatIdarg).DeleteConfirmationModalno longer passeschatId.lib/chats/deleteChat.ts.Caveat
If a session ever has >1 chat, archiving from one row hides the others too. Today every sidebar row maps 1:1 to its own session (each
POST /api/sessionsmints a session + single chat), so this is a no-op in practice — but worth knowing before we add a UI that creates additional chats inside an existing session.Dependencies
feat/sidebar-delete-rename-session-scoped). Stacked so the file moves don't conflict.Test plan
status: "archived"viaGET /api/sessions/{sid}.Summary by cubic
Switch the sidebar “Delete chat” to archive the session instead of deleting the chat. The row disappears, sandbox teardown runs, deleting the last chat now works, and the action is reversible.
New Features
lib/sessions/archiveSession.ts(PATCH /api/sessions/{sid}with{ status: "archived" }).useDeleteChatandDeleteConfirmationModalto use session archive (nochatId).lib/chats/deleteChat.ts.Dependencies
api#630to filter archived sessions fromGET /api/chats; until live, archived sessions still appear.chat#1758(feat/sidebar-delete-rename-session-scoped).Written for commit f6af28f. Summary will update on new commits.