Skip to content
This repository was archived by the owner on Feb 14, 2026. It is now read-only.
This repository was archived by the owner on Feb 14, 2026. It is now read-only.

Authentication stuck: Mobile shows success but CLI remains at 'Waiting for authentication...' #171

@YizhouWang777

Description

@YizhouWang777

Bug Description

The CLI authentication flow gets stuck after the mobile app successfully scans the QR code. The mobile app shows authentication successful, but the CLI remains stuck at "Waiting for authentication..." indefinitely and never saves credentials.

Steps to Reproduce

  1. Run happy auth login
  2. Select "1. Mobile App"
  3. Scan QR code with Happy mobile app
  4. Mobile app shows "Authentication successful"
  5. CLI remains stuck at "Waiting for authentication..."
  6. No credentials are saved to ~/.happy/

Expected Behavior

  • CLI should receive authentication response from server
  • CLI should save credentials to ~/.happy/
  • CLI should exit successfully
  • Subsequent happy commands should work without re-authentication

Actual Behavior

  • Mobile app completes authentication successfully
  • CLI never receives confirmation
  • Authentication polling appears to timeout or fail silently
  • happy doctor shows: ⚠️ Not authenticated (no credentials)
  • No JSON credential files are created in ~/.happy/

Environment

CLI Information:

System Information:

Happy Home: /Users/virus./.happy
Logs Dir: /Users/virus./.happy/logs

From happy doctor:

🔐 Authentication
⚠️  Not authenticated (no credentials)

🤖 Daemon Status
❌ Daemon is not running

Logs

All authentication attempts show the same pattern:

[AUTH] Starting auth and machine setup... 
[AUTH] No credentials found, starting authentication flow...

Then the log stops with no success or failure message.

Impact

  • Cannot use Happy CLI at all
  • Mobile app shows "No devices" because CLI never registers as a machine
  • Blocking all Happy Coder functionality

Possible Root Cause

Based on code analysis, the issue appears to be in the authentication polling logic:

  1. CLI sends auth request (POST /v1/auth/request)
  2. Mobile scans and approves (POST /v1/auth/response)
  3. CLI should poll status endpoint (GET /v1/auth/request/status)
  4. Polling appears to timeout or not receive server response

The authentication response likely completes on the server side (mobile sees success) but the CLI's polling mechanism fails to retrieve or process the response.

Workarounds Attempted

  • Waited 5+ minutes for authentication to complete
  • Killed and restarted CLI multiple times
  • Tried both Mobile App and Web Browser authentication methods
  • All attempts result in same stuck behavior

Additional Context

Server API health check confirms server is reachable:

$ curl https://api.cluster-fluster.com/health
{"status":"ok","timestamp":"2026-02-14T04:09:18.343Z","service":"happy-server"}

Network connectivity is confirmed working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions