← Back to PRs

#11708: feat(ui): add Delete Session button to /chat page

by andrii-solokh open 2026-02-08 06:19 View on GitHub →
app: web-ui stale
## Summary Adds a Delete Session button to the `/chat` page, allowing users to delete sessions directly from the chat view without navigating to `/sessions`. ## Changes - Add trash icon button to chat controls (right side, next to refresh) - Disabled for main session (cannot be deleted) - Shows confirmation dialog before deletion - Falls back to main session after deletion - Adds `btn--danger-icon` hover style (red tint) - Supports both dark and light themes ## Screenshots The button appears in the chat controls bar, grayed out for main session, with a red hover state for deletable sessions. ## Testing - [x] Build passes (`pnpm build` in `ui/`) - [x] Manual testing: button appears, confirmation works, session deletes correctly <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds a new trash-icon button to the `/chat` page controls that deletes the currently-selected session (with a confirmation prompt), then switches the UI back to the main session and refreshes chat + sessions. It also introduces `btn--danger-icon` hover styling for a red “danger” affordance in both dark and light themes. The main integration point is `renderChatControls` in `ui/src/ui/app-render.helpers.ts`, which wires the new button into the existing chat header control bar and uses the gateway RPC `sessions.delete` plus state resets similar to the existing session-switch logic. Styling changes live in `ui/src/styles/chat/layout.css` alongside other chat control button styles. <h3>Confidence Score: 3/5</h3> - This PR is close to mergeable but has a couple of edge cases that can break the intended “cannot delete main session” guarantee and can crash the click handler under certain state combinations. - The feature is localized and follows existing UI patterns, but the main-session guard depends on `mainSessionKey` being resolved, and the delete action uses a non-null assertion on `state.client` while the button enablement only checks `connected`. Both are user-facing and should be fixed before merging. - ui/src/ui/app-render.helpers.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs