## What Problem This Solves Fixes: `openclaw tui` on a machine with no running Gateway (for example a node-only host) fails with `Missing gateway auth token` and tells the user to set a token for a Gateway that does not exist. ## User Impact User impact: the error now says no Gateway is running here and names the next step: `openclaw chat` for local chat without a Gateway, `openclaw gateway` to start one, or `openclaw tui <Gateway URL>` once with that Gateway's token or password plus a pairing approval for a Gateway on another machine. Token errors for a running or explicitly targeted Gateway are unchanged. ## Why This Change Was Made With no explicit target, `tui` resolves credentials for the implicit loopback Gateway before connecting. A local Gateway started with a generated token pairs the CLI at startup, so a missing configured token only fails when no Gateway owns the lock. In that case (implicit target, no active Gateway lock, missing shared auth, no stored device token) the CLI now reports the missing Gateway instead. A node host's pairing has the node role, so it cannot be reused for operator chat; the docs note this. ## Evidence - Real CLI against isolated state with no Gateway: `pnpm openclaw tui` printed the new three-line message and exited 1. The installed build printed `Missing gateway auth token.` plus the token hint. - New case in `src/tui/gateway-chat.connection.test.ts` fails with `main`'s `gateway-chat.ts` (1 failed, 10 passed) and passes here: no Gateway → new message; active Gateway lock without credentials → still `Missing gateway auth token.` Cost: file ≈ 16 s wall with `--maxWorkers=1`, new test ≈ 1 ms. - `node scripts/check-changed.mjs`: all green (typecheck core + core tests) except the dead-export scan, which lists only unchanged `ui/` and `src/` exports already present on `main`. Co-authored-by: Ayaan Zaidi <hi@obviy.us>
9.8 KiB
| summary | read_when | title | ||||
|---|---|---|---|---|---|---|
| CLI reference for `openclaw tui` (Gateway-backed or local embedded terminal UI) |
|
openclaw tui |
openclaw tui
Open the terminal UI connected to the Gateway, or run it in local embedded mode.
openclaw tui [target]
target can be a Control UI session URL, a compact host/agent/ref, a bare
short reference such as movies-a1166b81, or a literal agent:... session key.
A URL or host target authoritatively selects that Gateway; a bare reference
uses the configured or default Gateway. You can also paste a Control UI URL
directly as openclaw <url> and place the TUI options before or after it, for example
openclaw <url> --token <token> --deliver.
The bare-URL form accepts --token, --password, --tls-fingerprint,
--deliver, --thinking, --message, --timeout-ms, and --history-limit.
URL-valued messages work in either position, including
openclaw --message https://example.com/article <url>.
Use openclaw tui <url> when you need another TUI option; --local, --url,
and --session conflict with a session URL.
Related guide: TUI
Options
| Flag | Default | Description |
|---|---|---|
--local |
false |
Run against the local embedded agent runtime instead of a Gateway. |
--url <url> |
gateway.remote.url from config |
Gateway WebSocket URL. |
--token <token> |
(none) | Gateway token if required. |
--password <pass> |
(none) | Gateway password if required. |
--tls-fingerprint <sha256> |
gateway.remote.tlsFingerprint |
Expected TLS certificate fingerprint for a pinned wss:// Gateway. |
--session <key> |
main (or global when scope is global) |
Session key. Inside an agent workspace it auto-selects that agent unless prefixed. |
--deliver |
false |
Deliver assistant replies through configured channels. |
--thinking <level> |
(model default) | Thinking level override. |
--message <text> |
(none) | Send an initial message after connecting. |
--timeout-ms <ms> |
agents.defaults.timeoutSeconds |
Agent timeout. Invalid values log a warning and are ignored. |
--history-limit <n> |
200 |
History entries to load on attach. |
Aliases: openclaw chat and openclaw terminal invoke this command with
--local implied.
Notes
--localcannot combine with--url,--token,--password, or--tls-fingerprint.- Pass only one Gateway target. A URL target cannot combine with
--url, and any positional target cannot combine with--sessionor local mode. - A URL or host target never reuses configured credentials or
OPENCLAW_GATEWAY_TOKEN/OPENCLAW_GATEWAY_PASSWORD. It uses the stored device token for that exact Gateway origin, or explicit--token/--passwordcredentials. On first contact, pass one of those credentials once, approve the pairing request in that Gateway's Control UI, and retry; see Devices. - Session URLs must stay credential-free. Userinfo and sensitive query or
fragment parameters such as
tokenandpasswordare rejected. - Short references resolve through the Gateway. If a short reference is ambiguous, the CLI prints candidate names and longer ID prefixes without attaching to either session.
- With no URL/host target or explicit
--url,tuiresolves configured Gateway auth SecretRefs for token/password auth when possible (env/file/exec/storeproviders). - When the configured remote Gateway is behind an identity-aware proxy,
tuiresolvesgateway.remote.edgeAuthSecretInputs and sends those headers only to that configured Gateway scope. URL or host targets for other origins never inherit them. - With no explicit URL or port,
tuifollows the active local Gateway port recorded by the running Gateway. Explicit--url,OPENCLAW_GATEWAY_URL,OPENCLAW_GATEWAY_PORT, and remote Gateway config keep precedence. - With no explicit target and no running local Gateway,
tuistops before connecting and points toopenclaw chatinstead of asking for a token. A local Gateway started with a generated token pairs this CLI automatically. A node host has no local Gateway: its pairing has the node role, so operator chat with its Gateway usesopenclaw tui <Gateway URL>with--tokenor--passwordonce, plus a one-time pairing approval. - Launched from inside a configured agent workspace directory, TUI auto-selects
that agent for the session key default (unless
--sessionis explicitlyagent:<id>:...). - Local mode uses the embedded agent runtime directly. Most local tools work, but Gateway-only features are unavailable.
- Local mode requires exclusive ownership of the configured state directory. It
refuses to start while a Gateway or another embedded writer owns that state;
run without
--localto use the active Gateway, or stop it first withopenclaw gateway stop. - Local mode adds
/auth [provider]to the TUI command surface. - Plugin approval gates still apply in local mode: tools that require approval prompt for a decision in the terminal, nothing is silently auto-approved.
ask_userquestions appear as interactive prompts in both modes. Esc collapses a prompt without answering;/questionreopens it.- Gateway mode accepts
secretsrequests in a masked input with a read-only allowed-host list. Local mode cannot fulfill store-bound requests; useopenclaw secrets storeor the Control UI with a running Gateway. - Session goals appear in the footer and can be managed with
/goal.
Session target errors
| Failure | Recovery |
|---|---|
| The Gateway predates short-link resolution | Copy the full session key from that Gateway's Control UI. |
| Session missing or short ref ambiguous | For the configured/local Gateway, run openclaw sessions list; for a URL/host target, choose a longer or full key in that Gateway's Control UI. |
| Gateway unreachable | The error names the selected origin. For a *.ts.net host, connect Tailscale and confirm the Gateway is reachable on the tailnet. |
| Identity-aware proxy rejected the upgrade | Configure gateway.remote.edgeAuth for the configured remote Gateway; the error includes the relevant remote-access docs link. |
| Stored device token revoked or rotated | Rotate it with openclaw devices rotate --device <deviceId> --role operator, then reconnect. |
| TLS certificate pin mismatch | The original TLS fingerprint error passes through unchanged; verify the configured or explicit pin before retrying. |
Examples
openclaw chat
openclaw tui --local
openclaw tui
openclaw tui https://gateway.example/dashboard/main/movies-a1166b81
openclaw https://gateway.example/dashboard/main/movies-a1166b81 --token <token>
openclaw tui movies-a1166b81
openclaw tui --url ws://127.0.0.1:18789 --token <token>
openclaw tui --session main --deliver
openclaw chat --message "Compare my config to the docs and tell me what to fix"
# when run inside an agent workspace, infers that agent automatically
openclaw tui --session bugfix
Config repair loop
Use local mode to have the embedded agent inspect the current config, compare it against the docs, and help repair it from the same terminal.
If openclaw config validate is already failing, run openclaw configure or
openclaw doctor --fix first; openclaw chat does not bypass the
invalid-config guard.
openclaw chat
Then inside the TUI:
!openclaw config file
!openclaw docs gateway auth token secretref
!openclaw config validate
!openclaw doctor
Apply targeted fixes with openclaw config set or openclaw configure, then
rerun openclaw config validate. See TUI and
Config.
Related
- CLI reference
- TUI
- Control UI URLs
- Devices
- Goal
openclaw attach— launch Claude Code with a temporary session-scoped Gateway MCP grantopenclaw resume— attach this TUI to an existing Gateway session