#5097: fix(ui): prefer session label over displayName in dropdown
app: web-ui
Cluster:
UI Enhancements and Fixes
## Summary
When using sub-agents with labels (via `sessions_spawn`), the Gateway Dashboard session dropdown displays the raw session key (e.g., `webchat:g-agent-main-subagent-b0b644c5-...`) rather than the human-readable `label` field.
## Changes
- Modified `ui/src/ui/views/sessions.ts` to prioritize `label` field over `displayName`
- Fallback chain: `label` → `displayName` → `key`
## Before
Session dropdown showed:
- `webchat:g-agent-main-subagent-b0b644c5-...`
- `webchat:g-agent-main-subagent-a1d2e3f4-...`
## After
Session dropdown now shows:
- `dept-engineering` ✅
- `dept-finance` ✅
## Testing
- [x] `pnpm lint` passes with no errors
- [ ] Manual testing (requires Gateway setup)
## Use Case
Running a department system with multiple labeled sub-agents becomes much easier when you can identify sessions by their labels rather than UUID-based keys.
Fixes #5088
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the Gateway Dashboard sessions table to display a human-friendly session label in the “Key” column when available. Specifically, `renderRow` now chooses the session name using `label → displayName → key`, so labeled sub-agent sessions don’t appear as long raw session keys in the dropdown/table, while links and routing still use the underlying `row.key` for URL params.
The change is localized to `ui/src/ui/views/sessions.ts` and does not modify session identity, navigation, or patch/delete behavior—only the displayed text for the session link.
<h3>Confidence Score: 4.5/5</h3>
- This PR is safe to merge with minimal risk.
- The change is a small, localized UI-only tweak that adjusts a display fallback chain without altering session identifiers, routing, or mutation logic. The only noteworthy behavioral difference is that `label` values that are empty/whitespace will now be treated as truthy and displayed, potentially resulting in blank-looking entries, but this is limited to presentation.
- ui/src/ui/views/sessions.ts
<!-- greptile_other_comments_section -->
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#8210: ui: show subagent labels in chat session dropdown
by pborgen · 2026-02-03
86.3%
#22977: fix(ui): resolve agent names from config in session dropdown
by NikhilGaddam · 2026-02-21
82.7%
#21679: fix: Mission Control dashboard issues for agent status, stale sessi...
by thejawdoc · 2026-02-20
79.2%
#8774: Fix/frontend session key normalization
by zhaodageng · 2026-02-04
78.9%
#4693: fix: keep main session displayName on outbound sends
by ManojINaik · 2026-01-30
76.3%
#6840: Fix assistant identity default agent for global sessions
by JorgeAlan · 2026-02-02
76.1%
#22469: fix(gateway): avoid stale whatsapp labels on direct sessions
by loganprit · 2026-02-21
76.1%
#15726: fix(sessions): use model contextWindow instead of agent contextToke...
by lailoo · 2026-02-13
75.7%
#15982: fix: pass agentId to resolveSessionFilePath in reply flow (NX-003)
by automagik-genie · 2026-02-14
75.6%
#14309: fix(ui): resolve chat event session key mismatch
by justonlyforyou · 2026-02-11
75.2%