Gateway runbook
Use this page for day-1 startup and day-2 operations of the Gateway service.Deep troubleshooting
Symptom-first diagnostics with exact command ladders and log signatures.
Configuration
Task-oriented setup guide + full configuration reference.
5-minute local startup
Gateway config reload watches the active config file path (resolved from profile/state defaults, or
OPENCLAW_CONFIG_PATH when set).
Default mode is gateway.reload.mode="hybrid".Runtime model
- One always-on process for routing, control plane, and channel connections.
- Single multiplexed port for:
- WebSocket control/RPC
- HTTP APIs (OpenAI-compatible, Responses, tools invoke)
- Control UI and hooks
- Default bind mode:
loopback. - Auth is required by default (
gateway.auth.token/gateway.auth.password, orOPENCLAW_GATEWAY_TOKEN/OPENCLAW_GATEWAY_PASSWORD).
Port and bind precedence
| Setting | Resolution order |
|---|---|
| Gateway port | --port → OPENCLAW_GATEWAY_PORT → gateway.port → 18789 |
| Bind mode | CLI/override → gateway.bind → loopback |
Hot reload modes
gateway.reload.mode | Behavior |
|---|---|
off | No config reload |
hot | Apply only hot-safe changes |
restart | Restart on reload-required changes |
hybrid (default) | Hot-apply when safe, restart when required |
Operator command set
Remote access
Preferred: Tailscale/VPN. Fallback: SSH tunnel.ws://127.0.0.1:18789 locally.
See: Remote Gateway, Authentication, Tailscale.
Supervision and service lifecycle
Use supervised runs for production-like reliability.- macOS (launchd)
- Linux (systemd user)
- Linux (system service)
ai.openclaw.gateway (default) or ai.openclaw.<profile> (named profile). openclaw doctor audits and repairs service config drift.Multiple gateways on one host
Most setups should run one Gateway. Use multiple only for strict isolation/redundancy (for example a rescue profile). Checklist per instance:- Unique
gateway.port - Unique
OPENCLAW_CONFIG_PATH - Unique
OPENCLAW_STATE_DIR - Unique
agents.defaults.workspace
Dev profile quick path
19001.
Protocol quick reference (operator view)
- First client frame must be
connect. - Gateway returns
hello-oksnapshot (presence,health,stateVersion,uptimeMs, limits/policy). - Requests:
req(method, params)→res(ok/payload|error). - Common events:
connect.challenge,agent,chat,presence,tick,health,heartbeat,shutdown.
- Immediate accepted ack (
status:"accepted") - Final completion response (
status:"ok"|"error"), with streamedagentevents in between.
Operational checks
Liveness
- Open WS and send
connect. - Expect
hello-okresponse with snapshot.
Readiness
Gap recovery
Events are not replayed. On sequence gaps, refresh state (health, system-presence) before continuing.
Common failure signatures
| Signature | Likely issue |
|---|---|
refusing to bind gateway ... without auth | Non-loopback bind without token/password |
another gateway instance is already listening / EADDRINUSE | Port conflict |
Gateway start blocked: set gateway.mode=local | Config set to remote mode |
unauthorized during connect | Auth mismatch between client and gateway |
Safety guarantees
- Gateway protocol clients fail fast when Gateway is unavailable (no implicit direct-channel fallback).
- Invalid/non-connect first frames are rejected and closed.
- Graceful shutdown emits
shutdownevent before socket close.
Related: