#11708: feat(ui): add Delete Session button to /chat page
app: web-ui
stale
Cluster:
UI Enhancements and Fixes
## 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
#13548: feat(control-ui): Add quote reply and send message to session features
by Annaxiebot · 2026-02-10
79.8%
#21642: fix(ui): disable dashboard session delete for webchat clients
by graysurf · 2026-02-20
77.1%
#19343: Refactor chat state management: reset chat messages and queue on se...
by saurav470 · 2026-02-17
77.0%
#21788: ui(agents): add Start New Session action per agent
by rt219 · 2026-02-20
76.6%
#19473: feat(ui): add ★ Main badge to session selector and sessions list
by EricGrill · 2026-02-17
75.2%
#18694: fix(ui): reset session key to main after /new in webchat
by Phineas1500 · 2026-02-17
74.1%
#18668: feat(ui/chat): chat UX overhaul
by jasonkneen · 2026-02-16
73.9%
#9218: Fix Control UI chat resync on gaps and terminal events
by figitaki · 2026-02-05
73.6%
#22798: feat(webchat): ChatGPT-style multi-chat threads with generated titles
by opnsec · 2026-02-21
73.5%
#14309: fix(ui): resolve chat event session key mismatch
by justonlyforyou · 2026-02-11
73.3%