Skip to content

ping_all misreports path: count>1 parses only the first pong, and peer relays are labeled direct #33

Closed

Description

@TMHSDigital

Why it matters

ping_all's main selling point is telling a direct path apart from a relayed one (README: "works but relayed" vs "fast direct path"). Two parsing issues make that answer wrong in common cases.

Evidence

src/providers/cli.ts:257-271:

const pong = /pong from \S+ \(([^)]+)\) via (DERP\(([^)]+)\)|\S+) in (\d+)ms/.exec(result.stdout);
...
path: derp ? "derp" : "direct",
  1. count > 1 reports the first pong, not the settled path. tailscale ping keeps pinging (through DERP) until a direct path comes up and then stops. With count: 3 the output is usually via DERP(...) followed by via 1.2.3.4:41641. exec takes the first line, so the tool reports derp and the DERP latency even though the connection just went direct.
  2. Anything that isn't DERP(...) is classified direct. Tailscale's peer relays (1.86+) print a via peer-relay(...)-style endpoint, which the regex labels "direct". That's misleading in exactly the "why is this slow" case. Please verify the exact string against a current CLI.
  3. Only one latency number is reported for multi-attempt pings. There's no min/avg or loss count.

Suggested approach

  • Parse all pong lines. Report the final path plus latencyMs (last or min), attempts, and replies.
  • Make path a closed enum (direct | derp | peer-relay | unknown) and keep the raw via string.
  • Add fixture tests from captured multi-pong and peer-relay output.

Done when

A DERP→direct upgrade within one call reports direct, a peer-relay path is never reported as direct, and fixtures cover both.

Activity

  1. added
    bug
    priority: P2
    on Oct 25, 2026
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

    bugpriority: P2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions