Skip to content

Control UI loses gateway token when switching between agent sessions #43037

Description

@navendugoyal19

Bug Description

The Control UI (webchat) successfully authenticates with the gateway token for the default (main) agent, but when switching to a different agent session (e.g. navi-coder), the WebSocket reconnects without sending the stored token, resulting in:

unauthorized: gateway token missing (open the dashboard URL and paste the token in Control UI settings)

Steps to Reproduce

  1. Configure gateway auth with mode: "token" (default after openclaw gateway install --force)
  2. Open the dashboard via openclaw dashboard — main agent connects fine
  3. Navigate to a second agent session, e.g.:
    http://127.0.0.1:18789/chat?session=agent%3Anavi-coder%3Amain
    
  4. Control UI shows "unauthorized: gateway token missing"

Even appending #token=<token> to the navi-coder URL doesn't persist — the UI drops it on the WebSocket reconnect.

Gateway Error Logs

[ws] unauthorized conn=... remote=127.0.0.1 client=openclaw-control-ui webchat v2026.3.8 reason=token_missing
[ws] closed before connect conn=... code=1008 reason=unauthorized: gateway token missing

These repeat on every attempt to switch to a non-default agent session.

Expected Behavior

The Control UI should include the stored gateway token on all WebSocket connections, including when switching between agent sessions.

Workaround

Set gateway.auth.mode to "none" in ~/.openclaw/openclaw.json (safe when gateway bind is loopback):

"gateway": {
  "auth": {
    "mode": "none"
  }
}

Then restart the gateway (launchctl unload/load the plist or openclaw gateway install --force).

Environment

  • OpenClaw: 2026.3.8 (3caab92)
  • OS: macOS (Darwin 25.3.0)
  • Browser: Chrome 145
  • Gateway bind: loopback
  • Agents: main (default) + navi-coder (secondary)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions