#10991: feat(gateway): add configurable instance name for Control UI title
app: web-ui
gateway
stale
Cluster:
Slack Integration Enhancements
## Summary
This PR adds a new config field `gateway.instanceName` that allows users to set a custom name for their OpenClaw instance, which is displayed in the Control UI page title.
## Problem
Users running OpenClaw on multiple machines (laptop, VM, Raspberry Pi, VPS, etc.) cannot easily tell which instance's Control UI they're looking at. The title is always just "OpenClaw Control".
Currently, the only workaround is to manually edit the `index.html` file to add a machine name, but this gets overwritten on every update.
## Solution
Add a `gateway.instanceName` config field that:
- Accepts a custom name (max 50 characters)
- Prepends it to the Control UI page title when set (e.g., "MacOS VM - OpenClaw Control")
- Falls back to "OpenClaw Control" when not set (backward compatible)
## Example Config
```yaml
gateway:
instanceName: MacOS VM
```
Result: Browser tab shows **MacOS VM - OpenClaw Control**
## Changes
| File | Change |
|------|--------|
| `src/config/zod-schema.ts` | Add `gateway.instanceName` field (string, max 50 chars, optional) |
| `src/config/schema.ts` | Add UI label and help text for the new field |
| `src/gateway/control-ui.ts` | Inject `window.__OPENCLAW_INSTANCE_NAME__` into Control UI HTML |
| `ui/src/ui/app.ts` | Apply instance name to `document.title` on load |
**4 files changed, 17 insertions, 1 deletion** — minimal and focused.
## Testing
1. Set `gateway.instanceName: "Test Instance"` in config
2. Open Control UI
3. ✅ Page title should show "Test Instance - OpenClaw Control"
4. Remove the config, page title should remain "OpenClaw Control"
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
- Adds a new `gateway.controlUi.title` config field (schema + types) to let users prepend an instance name to the Control UI browser tab title.
- Injects the configured instance name into the served Control UI HTML as `window.__OPENCLAW_INSTANCE_NAME__`.
- Also rewrites the `<title>` tag server-side to avoid a flash of the default title, with a client-side `document.title` set as backup.
- Keeps existing behavior when the field is unset (default title remains).
<h3>Confidence Score: 2/5</h3>
- This PR should not be merged as-is due to an HTML/JS injection risk in the server-side <title> rewrite.
- Most changes are straightforward config plumbing, but the server-side title replacement interpolates config into HTML without robust escaping, which can enable XSS if the Control UI is reachable by others or config can be influenced. Fixing the escaping (or removing the HTML interpolation path) would make the change low risk.
- src/gateway/control-ui.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
#11528: feat(control-ui): configurable page title with hostname default
by Annaxiebot · 2026-02-07
85.3%
#8318: feat(webchat): Add configurable user display name
by vishaltandale00 · 2026-02-03
79.9%
#11663: fix: prevent config page header overlap with settings form
by shogunsea · 2026-02-08
75.6%
#19429: Fix/custom bind host validation
by frudas24 · 2026-02-17
75.3%
#11455: fix(gateway): default gateway.mode to local when unset
by AnonO6 · 2026-02-07
75.2%
#12168: feat: integrate Mission Control dashboard into Control UI
by riftagent-git · 2026-02-08
73.7%
#8260: fix(macOS): gateway readiness detection + reversible Configure later
by xksteven · 2026-02-03
73.4%
#23364: Gateway: add risk-ack interlock for dangerous Control UI flags
by bmendonca3 · 2026-02-22
73.1%
#13960: fix(ui): preserve structured config validation error details
by constansino · 2026-02-11
72.8%
#5823: fix(config): exit cleanly on invalid config instead of high CPU loop
by gavinbmoore · 2026-02-01
72.7%