← Back to PRs

#10991: feat(gateway): add configurable instance name for Control UI title

by Annaxiebot open 2026-02-07 08:07 View on GitHub →
app: web-ui gateway stale
## 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