#8318: feat(webchat): Add configurable user display name
app: web-ui
gateway
stale
Cluster:
Slack Integration Enhancements
Fixes #8263
## Summary
Adds the ability to customize the user display name in the webchat interface via the `ui.user.name` config option, providing feature parity with the existing `ui.assistant.name` option.
## Problem
Currently, the webchat interface hardcodes "You" as the label for user messages. Users who have established identities (like "Architect") would benefit from consistent naming across their OpenClaw interactions.
## Solution
Added `ui.user.name` configuration option that:
- Allows users to customize their display name in the webchat UI
- Falls back to "You" if not configured (default behavior unchanged)
- Follows the same pattern as `ui.assistant.name`
## Changes
**Config layer:**
- Added `ui.user.name` field to `OpenClawConfig` type
- Added Zod schema validation (max 50 characters)
- Added schema label "User Name" for config UI
**Server injection:**
- Modified `control-ui.ts` to inject `window.__OPENCLAW_USER_NAME__`
- Reads from `config?.ui?.user?.name` and passes to HTML injection
**UI layer:**
- Added `resolveInjectedUserName()` function in `assistant-identity.ts`
- Added `userName` state to app and view state types
- Passed `userName` through component chain: `app` → `chat` → `grouped-render`
- Updated `renderMessageGroup()` to use `userName` instead of hardcoded "You"
- Updated test fixtures
## Usage
### Config file:
```json
{
"ui": {
"user": {
"name": "Architect"
}
}
}
```
### Result:
User messages now display "Architect" instead of "You" in the webchat interface.
## Backward Compatibility
✅ Default behavior unchanged (falls back to "You" if not configured)
✅ No breaking changes to existing API or config
✅ Purely additive feature
## Testing
- Updated existing test fixture to include `userName`
- Manually verified default fallback behavior
🤖 Generated by agent-4bf217745721 via [AgentGit](https://github.com/agentgit)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Adds support for a configurable user display name in the webchat UI via new `ui.user.name` config. The server (`src/gateway/control-ui.ts`) injects the value into the rendered HTML as `window.__OPENCLAW_USER_NAME__`, and the UI resolves it (`ui/src/ui/assistant-identity.ts`) and threads it through app/view state into chat grouped rendering so user message groups show the configured label instead of the hardcoded "You".
<h3>Confidence Score: 4/5</h3>
- This PR is generally safe to merge and is additive, with one small injection-guard robustness issue worth addressing.
- Changes are straightforward config plumbing and UI display logic with minimal surface area. The main concern is the injection guard in `injectControlUiConfig()` only checking for assistant injection, which could cause the new user-name var to be skipped in some scenarios; otherwise the behavior is low risk.
- src/gateway/control-ui.ts
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#10991: feat(gateway): add configurable instance name for Control UI title
by Annaxiebot · 2026-02-07
79.9%
#21147: feat(slack): support chat:write.customize for custom bot name/avatar
by bernardclaw · 2026-02-19
76.1%
#22798: feat(webchat): ChatGPT-style multi-chat threads with generated titles
by opnsec · 2026-02-21
73.7%
#11528: feat(control-ui): configurable page title with hostname default
by Annaxiebot · 2026-02-07
73.4%
#10802: feat: add ui.waitingPhrases config for custom spinner verbs
by eyekron · 2026-02-07
73.0%
#3721: fix(ui): webchat not displaying chat responses
by maxmaxrouge-rgb · 2026-01-29
72.4%
#20047: fix(googlechat): typing indicator shows 'OpenClaw' instead of agent...
by xinhuagu · 2026-02-18
72.3%
#14309: fix(ui): resolve chat event session key mismatch
by justonlyforyou · 2026-02-11
72.0%
#14966: fix(webchat): preserve user message visibility after chat.send
by BenediktSchackenberg · 2026-02-12
71.4%
#22977: fix(ui): resolve agent names from config in session dropdown
by NikhilGaddam · 2026-02-21
70.9%