Skip to content

[Bug]: tools.exec.ask: "always" fails with "pairing required" on local loopback gateway #59882

@kylekrug-xalt

Description

@kylekrug-xalt

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Title: tools.exec.ask: "always" fails with "pairing required" on local loopback gateway

Summary:

When tools.exec.ask is set to "always" (with security: "full"), all exec commands fail with:

Exec approval registration failed: Error: gateway closed (1008): pairing required
Gateway target: ws://127.0.0.1:18789
Source: local loopback

Environment:

  • OpenClaw 2026.4.1 (da64a97)
  • macOS 15.5 (arm64), Node 25.9.0
  • Gateway mode: local, bind: loopback
  • Auth mode: token (with valid token set)

Steps to reproduce:

  1. Set tools.exec.security: "full" and tools.exec.ask: "always" in openclaw.json
  2. Set host approvals via openclaw approvals set with defaults.ask: "always" and defaults.askFallback: "deny"
  3. Restart gateway
  4. Agent attempts any exec command (e.g., echo hello)

Expected: Approval prompt appears in Control UI; command runs after approval.

Actual: Exec immediately fails with "gateway closed (1008): pairing required" before reaching the approval stage. The approval WebSocket connection to the gateway is rejected.

Workaround: Setting tools.exec.ask: "off" allows exec to function normally. The issue is specific to the approval registration WebSocket, not exec itself.

Diagnostic output:

  • openclaw gateway probe → Reachable: yes, RPC: ok
  • openclaw gateway status → Runtime: running, RPC probe: ok
  • openclaw doctor → no blocking issues
  • openclaw approvals get → file exists, socket path set, defaults configured

Steps to reproduce

Steps to Reproduce:

  1. Fresh install OpenClaw 2026.4.1 on macOS via npm install -g openclaw@latest
  2. Run openclaw onboard --install-daemon (local mode, loopback bind, token auth)
  3. Confirm gateway is running: openclaw gateway status → Runtime: running, RPC probe: ok
  4. Set exec approval policy in ~/.openclaw/openclaw.json:
    "tools": {
      "exec": {
        "security": "full",
        "ask": "always"
      }
    }
  5. Set host-local approvals:
    openclaw approvals set --stdin <<'EOF'
    {
      "version": 1,
      "defaults": {
        "security": "full",
        "ask": "always",
        "askFallback": "deny"
      }
    }
    EOF
  6. Restart gateway: openclaw gateway restart
  7. Confirm gateway is healthy: openclaw gateway probe → Reachable: yes, RPC: ok
  8. Open Control UI at http://127.0.0.1:18789
  9. Send any message that triggers an exec tool call (e.g., "run echo hello")
  10. Observe error in agent response:
    Exec approval registration failed: Error: gateway closed (1008): pairing required
    Gateway target: ws://127.0.0.1:18789
    Source: local loopback
    
  11. Confirm no approval prompt appears in the Control UI
  12. Change ask to "off", restart gateway, retry — exec works normally

Expected behavior

Expected Behavior:

When tools.exec.ask is set to "always", the agent's exec command should be held in a pending state and an approval prompt should appear in the Control UI (or connected companion app), allowing the user to review the command and approve or deny it before execution. After approval, the command should execute normally and return output to the agent.

Actual behavior

Actual Behavior:

The exec command fails immediately without reaching the approval stage. The approval registration WebSocket connection to the gateway is rejected with a 1008: pairing required close code. No approval prompt is shown in the Control UI. The command never executes. This occurs on every exec attempt regardless of the command being run.

OpenClaw version

<v2026.4.1>

Operating system

macOS 15.5

Install method

No response

Model

Claude-Opus-4-6

Provider / routing chain

Agent exec → ask: "always" → approval handler opens WebSocket to ws://127.0.0.1:18789 → gateway rejects with 1008: pairing required → no approval prompt dispatched → command never executes.

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionBehavior that previously worked and now fails

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions