Skip to content

share_port: pre-flight check that the local port is listening, post-flight URL verification, and dryRun #58

Open

Description

@TMHSDigital

Why it matters

The most common failure when sharing a dev server is that nothing is listening on the port yet, or the app is bound to an interface the Serve proxy can't reach. Today share_port happily creates the share and returns a URL that serves a 502. Then the agent tells the user "here's your link" and the user debugs it by hand. A pre-flight and post-flight check fits the project's "dry-run, structured, verified" identity (ROADMAP: no server offers stateful dry-run pre-flights).

Evidence

  • src/tools/share.ts:27-37 calls provider.serve and returns the URLs directly, with no check of the local port or the resulting endpoint.

Suggested approach

  • Pre-flight: before calling tailscale serve, try a TCP connect to 127.0.0.1:<port> (and ::1). If nothing answers, return a structured NOTHING_LISTENING warning (or an error, overridable with a force flag) with a remedy ("start your dev server first, or check it is bound to localhost").
  • Post-flight: after the share is created, do one HEAD/GET against the returned tailnet URL with a short timeout and report verified: true | false plus the status code. Skip this for Funnel unless asked, to avoid making public requests.
  • Add a dryRun: true mode that reports what would be shared (URL, scope, conflicting existing mounts from share_status: return structured endpoints with an explicit public/Funnel flag #43) without changing anything, matching generate_ssh_config's dry-run default.

Done when

share_port on an idle port returns an actionable warning instead of a dead URL, successful shares report verified, and dryRun exists and is tested.

Activity

  1. added
    priority: P3
    feature
    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

    featurepriority: P3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions