Skip to content

Permanent Cloudflare setup does not safely reuse existing tunnels #5

Closed

Description

@codepilotios

Setup path

scripts/setup-cloudflare-remote-access.sh configure-permanent --hostname ... --tunnel-name codepilot and the Mac Cloudflare wizard permanent-hostname flow.

Friction

Docs and wizard copy say the setup can create or reuse a tunnel. The script currently runs cloudflared tunnel create "$tunnel_name" 2>&1 || true, parses an ID from that output, and continues. If the tunnel already exists or creation fails without an ID, the script can proceed with an empty tunnel_id and write a config with credentials-file: ~/.cloudflared/.json. That leaves users with a broken LaunchAgent/config instead of a reusable tunnel or a specific recovery action.

Expected

Either:

  • Detect and reuse an existing tunnel by name and write the correct credentials file, or
  • Stop before writing config when no tunnel ID can be determined, with recovery copy telling the user to choose another tunnel name or clean up the existing tunnel.

Add tests for the existing-tunnel/no-ID path.

Activity

  1. added
    setupFirst-run setup and onboarding friction
    macMac app
    cloudflareCloudflare Tunnel setup
    bugSomething isn't working
    severity: mediumModerate user impact or setup friction
    on Jul 1, 2026
  2. codepilotios commented on Jul 1, 2026

    @codepilotios
    OwnerAuthor

    Triage update (2026-07-01): reproduced the no-ID path with a focused shell test. configure-permanent continued after cloudflared tunnel create returned no tunnel ID, which allowed config/metadata writes with an empty credentials path.

    Draft fix opened in #9. Validation: scripts/test-cloudflare-setup.sh and swift test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcloudflareCloudflare Tunnel setupmacMac appsetupFirst-run setup and onboarding frictionseverity: mediumModerate user impact or setup friction

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions