Skip to content

Bound wall-clock time: CLI calls have no timeout and ping_all can run for many minutes #34

Closed

Description

@TMHSDigital

Why it matters

If tailscaled is wedged (common right after sleep/resume, during an upgrade, or with a stuck LocalAPI), every tool can hang until the MCP client gives up. The agent then gets a generic timeout instead of the server's structured DAEMON_NOT_RUNNING remedy, which undercuts one of its main promises.

Evidence

  • src/providers/cli.ts:191 (status), :225 (version), :304 (serveStatus), and :311 (serveReset) call this.run(args) with no timeoutMs. defaultCliRunner (:40-62) only sets a timer when one is passed in.
  • ping_all has the opposite problem. With count: 10 and timeoutMs: 60000 (both allowed by src/tools/ping.ts:57-70), one peer can take ~605 s, and with 5-wide concurrency a 50-peer tailnet can take close to two hours. Most MCP clients time tool calls out at 60-120 s.
  • A timeout currently comes back as status 124, which surfaces as a generic CLI_ERROR "exit 124" rather than its own code.

Suggested approach

  • Set a default per-call timeout in CliProvider.run (e.g. 10 s, configurable through TAILSCALE_MCP_TIMEOUT_MS).
  • Map a runner timeout to a new TIMEOUT error code with a remedy (tailscale status manually; restart the service).
  • Give ping_all an overall deadline (e.g. 45 s). Return partial results with timedOut: true and emit MCP progress notifications while it runs (already on the roadmap for v0.4).
  • On timeout, kill the process tree on Windows, not just the direct child.

Done when

No tool call can run longer than a documented maximum, and a hung daemon produces a structured TIMEOUT error. Tests use a runner that never resolves.

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