Skip to content

fix(gateway): no pairing code shown when running gateway start on alternate port #5266

@JordanTheJet

Description

@JordanTheJet

Summary

When running zeroclaw gateway start -p <port> on a non-default port (e.g. for testing), the startup banner shows:

🔒 Pairing: ACTIVE (bearer token required)
   To pair a new device: zeroclaw gateway get-paircode --new

...but no pairing code is displayed. The get-paircode --new command also fails because it tries to reach the gateway on the default config port, not the one specified via -p.

Root cause

The gateway shares ~/.zeroclaw/ config state. If a device has already paired on the default port, pairing_code() returns None on alternate-port instances (since the pairing state shows "already paired"). But the browser on the new port has no bearer token, so the user is stuck at the pairing screen with no code to enter.

The only workaround is:

curl -s -X POST http://127.0.0.1:<port>/admin/paircode/new

Expected behavior

Either:

  1. gateway start -p <port> should print a fresh pairing code when the port differs from config, OR
  2. get-paircode --new should accept a --port flag to target the correct instance, OR
  3. The startup banner should print the curl command as a fallback when no code is available

Reproduction

# Start gateway on non-default port
zeroclaw gateway start -p 3001

# Open http://127.0.0.1:3001/ → pairing screen, no code
# Run get-paircode → fails (targets default port)
zeroclaw gateway get-paircode --new  # error: 400 Bad Request

Environment

  • OS: macOS
  • ZeroClaw: built from master (7c54334)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggatewayAuto scope: src/gateway/** changed.onboardAuto scope: src/onboard/** changed.priority:p1High priorityrisk: highAuto risk: security/runtime/gateway/tools/workflows.securityAuto scope: src/security/** changed.security: pairingAuto module: security/pairing changed.status:acceptedRFC or work item accepted and ratified by the team.status:no-staleExempt from the 60-day stale auto-close policy.

    Type

    No type

    Projects

    Status

    In Progress

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions