#21642: fix(ui): disable dashboard session delete for webchat clients
app: web-ui
size: S
Cluster:
Network Error Handling Improvements
## Summary
- Problem: Dashboard Sessions showed a `Delete` button, but Dashboard connections are webchat clients and `sessions.delete` is rejected server-side.
- Why it matters: Users are presented with an action that always fails, creating confusion and noisy error banners.
- What changed: Sessions view now treats delete as unavailable in Dashboard mode, shows an informational callout, and disables row-level Delete buttons with a clear reason.
- What did NOT change (scope boundary): No gateway/server behavior changes; only Dashboard UI behavior and tests were updated.
## Change Type (select all)
- [x] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Docs
- [ ] Security hardening
- [ ] Chore/infra
## Scope (select all touched areas)
- [ ] Gateway / orchestration
- [ ] Skills / tool execution
- [ ] Auth / tokens
- [ ] Memory / storage
- [ ] Integrations
- [ ] API / contracts
- [x] UI / DX
- [ ] CI/CD / infra
## Linked Issue/PR
- Closes #21264
- Related #21264
## User-visible / Behavior Changes
- Dashboard Sessions now shows delete as unavailable with an info callout.
- Delete buttons are disabled in Dashboard sessions with a clear reason.
## Security Impact (required)
- New permissions/capabilities? (`No`)
- Secrets/tokens handling changed? (`No`)
- New/changed network calls? (`No`)
- Command/tool execution surface changed? (`No`)
- Data access scope changed? (`No`)
- If any `Yes`, explain risk + mitigation:
## Repro + Verification
### Environment
- OS: macOS (reporter), local dev machine
- Runtime/container: node + control-ui
- Model/provider: N/A
- Integration/channel (if any): Dashboard webchat client
- Relevant config (redacted): default Dashboard connection mode
### Steps
1. Open Dashboard and navigate to Sessions.
2. Observe a session row and click `Delete`.
3. See request fail with `webchat clients cannot delete sessions`.
### Expected
- Delete is not offered as an actionable control in Dashboard webchat context, or is disabled with clear guidance.
### Actual
- Delete was displayed as actionable but always failed with an API error.
## Issues List
| ID | Issue | Status | Notes |
| --- | --- | --- | --- |
| PR-21642-BUG-01 | Dashboard sessions exposed `Delete` for webchat clients even though `sessions.delete` is rejected | Fixed | Delete is disabled and an info callout explains why |
## Fix Approach
- Added `canDeleteSessions` and `deleteUnavailableReason` props to the sessions view.
- Rendered an info callout when delete is unavailable.
- Disabled Delete actions per row when unavailable.
- Wired app render state to pass Dashboard-specific delete capability (`false`).
- Added a sessions view test for the disabled-delete/notice behavior.
## Testing Results
- ✅ `pnpm --dir ui exec vitest run --config vitest.config.ts src/ui/views/sessions.test.ts src/ui/controllers/sessions.test.ts`
- ✅ `pnpm --dir ui build`
- ⚠️ `pnpm --dir ui test -- src/ui/views/sessions.test.ts` (runs broader UI suite in this environment and reports unrelated pre-existing failures outside this change)
## Evidence
- [x] Failing test/log before + passing after
- [ ] Trace/log snippets
- [ ] Screenshot/recording
- [ ] Perf numbers (if relevant)
## Human Verification (required)
- Verified scenarios: sessions view renders delete-unavailable callout; delete button is disabled with reason tooltip.
- Edge cases checked: existing sessions view tests for custom values still pass.
- What you did **not** verify: full interactive Dashboard manual flow against a running gateway instance.
## Compatibility / Migration
- Backward compatible? (`Yes`)
- Config/env changes? (`No`)
- Migration needed? (`No`)
- If yes, exact upgrade steps:
## Failure Recovery (if this breaks)
- How to disable/revert this change quickly: revert this PR commit.
- Files/config to restore: `ui/src/ui/views/sessions.ts`, `ui/src/ui/app-render.ts`, `ui/src/ui/views/sessions.test.ts`.
- Known bad symptoms reviewers should watch for: Delete appearing enabled in Dashboard Sessions.
## Risks and Mitigations
- Risk: Users may still expect delete directly in Dashboard.
- Mitigation: UI now explicitly explains unavailability in-context.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR correctly addresses the issue where Dashboard sessions displayed a Delete button that always failed for webchat clients. The implementation adds `canDeleteSessions` and `deleteUnavailableReason` props to properly disable the delete functionality and display an informational callout explaining why deletion is unavailable.
**Key changes:**
- Added new props to `SessionsProps` type for controlling delete availability
- Modified `renderSessions` to show an info callout when delete is unavailable
- Updated `renderRow` to disable delete buttons with a tooltip explanation
- Hardcoded `canDeleteSessions: false` in `app-render.ts` for Dashboard context
- Added test coverage for the disabled-delete scenario
The implementation is sound because the Dashboard UI always operates in webchat mode (confirmed at `app-gateway.ts:142`), where session deletion is correctly rejected server-side.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The changes are well-contained to the UI layer with no gateway/server modifications. The implementation correctly addresses the stated problem by disabling delete functionality in Dashboard sessions where it's server-rejected. Test coverage validates the new behavior, and the changes are backward compatible with no breaking changes to existing functionality.
- No files require special attention
<sub>Last reviewed commit: a005f32</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#22109: fix(gateway): allow Control UI session patch/delete
by lc708 · 2026-02-20
78.1%
#11708: feat(ui): add Delete Session button to /chat page
by andrii-solokh · 2026-02-08
77.1%
#22059: [Bug]: allow CONTROL_UI sessions.patch/delete
by AIflow-Labs · 2026-02-20
74.3%
#18694: fix(ui): reset session key to main after /new in webchat
by Phineas1500 · 2026-02-17
73.0%
#5097: fix(ui): prefer session label over displayName in dropdown
by d-init-d · 2026-01-31
72.4%
#4154: fix(control-ui): preserve URL session parameter over localStorage d...
by joeyfrasier · 2026-01-29
72.3%
#21679: fix: Mission Control dashboard issues for agent status, stale sessi...
by thejawdoc · 2026-02-20
71.9%
#22469: fix(gateway): avoid stale whatsapp labels on direct sessions
by loganprit · 2026-02-21
71.0%
#20650: fix(gateway): include deleted/reset sessions in usage.cost RPC (#20...
by lailoo · 2026-02-19
70.3%
#17527: fix(gateway): allow WebChat to attach to main session regardless of...
by Glucksberg · 2026-02-15
70.0%