From 23c6e9836e2735c562086288d3ed8bf88ff7f4a2 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 1 Mar 2026 12:37:32 -0800 Subject: [PATCH] Status scan: overlap non-JSON async checks --- src/commands/status.scan.ts | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/commands/status.scan.ts b/src/commands/status.scan.ts index f47827ff12b..3a15bdf764b 100644 --- a/src/commands/status.scan.ts +++ b/src/commands/status.scan.ts @@ -194,16 +194,25 @@ export async function scanStatus( progress.setLabel("Loading config…"); const cfg = loadConfig(); const osSummary = resolveOsSummary(); + const tailscaleMode = cfg.gateway?.tailscale?.mode ?? "off"; + const tailscaleDnsPromise = + tailscaleMode === "off" + ? Promise.resolve(null) + : getTailnetHostname((cmd, args) => + runExec(cmd, args, { timeoutMs: 1200, maxBuffer: 200_000 }), + ).catch(() => null); + const updateTimeoutMs = opts.all ? 6500 : 2500; + const updatePromise = getUpdateCheckResult({ + timeoutMs: updateTimeoutMs, + fetchGit: true, + includeRegistry: true, + }); + const agentStatusPromise = getAgentLocalStatuses(); + const summaryPromise = getStatusSummary(); progress.tick(); progress.setLabel("Checking Tailscale…"); - const tailscaleMode = cfg.gateway?.tailscale?.mode ?? "off"; - const tailscaleDns = - tailscaleMode === "off" - ? null - : await getTailnetHostname((cmd, args) => - runExec(cmd, args, { timeoutMs: 1200, maxBuffer: 200_000 }), - ).catch(() => null); + const tailscaleDns = await tailscaleDnsPromise; const tailscaleHttpsUrl = tailscaleMode !== "off" && tailscaleDns ? `https://${tailscaleDns}${normalizeControlUiBasePath(cfg.gateway?.controlUi?.basePath)}` @@ -211,16 +220,11 @@ export async function scanStatus( progress.tick(); progress.setLabel("Checking for updates…"); - const updateTimeoutMs = opts.all ? 6500 : 2500; - const update = await getUpdateCheckResult({ - timeoutMs: updateTimeoutMs, - fetchGit: true, - includeRegistry: true, - }); + const update = await updatePromise; progress.tick(); progress.setLabel("Resolving agents…"); - const agentStatus = await getAgentLocalStatuses(); + const agentStatus = await agentStatusPromise; progress.tick(); progress.setLabel("Probing gateway…"); @@ -289,7 +293,7 @@ export async function scanStatus( progress.tick(); progress.setLabel("Reading sessions…"); - const summary = await getStatusSummary(); + const summary = await summaryPromise; progress.tick(); progress.setLabel("Rendering…");