Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.
Shell agent-teamsai-agentai-automationanthropicautonomous-agentawsbusiness-operationsclaudeclaude-codeclaude-code-plugindevopsecommerceinbox-zeroklaviyomarketingmcpmorning-briefingpr-automationshopifyterminal
fix(agent-dash): an unreachable remote reports unknown, not zero agents (#842)
Aurora Capital029055e753d5
diff --git a/claude-ops/scripts/agent-dash/collect.mjs b/claude-ops/scripts/agent-dash/collect.mjsindex 8d4b734b..4f756197 100644--- a/claude-ops/scripts/agent-dash/collect.mjs+++ b/claude-ops/scripts/agent-dash/collect.mjs@@ -91,44 +91,63 @@ function probeRemoteHost(sshHost, probeSrc) {}export function collectRemote({ force = false } = {}) {+ // No remote configured is not the same as a remote that failed to answer.+ // Report it as its own state so the dashboard never prints a confident 0.+ if (FRA_HOSTS.length === 0) {+ return { agents: [], stale: false, source: 'not-configured', cached: false, known: true };+ }+const cache = readCache();if (!force && cache && nowTs() - cache.ts < REMOTE_TTL_MS) {- return { agents: cache.agents, stale: false, source: cache.meta?.source || 'cache', cached: true };+ return { agents: cache.agents, stale: false, source: cache.meta?.source || 'cache', cached: true, known: true };}let probeSrc;try {probeSrc = readFileSync(PROBE, 'utf8');} catch {- return { agents: cache?.agents || [], stale: true, source: 'no-probe', cached: !!cache };+ return { agents: cache?.agents || [], stale: true, source: 'no-probe', cached: !!cache, known: !!cache };}for (const h of FRA_HOSTS) {try {const agents = probeRemoteHost(h.trim(), probeSrc);writeCache(agents, { source: h.trim() });- return { agents, stale: false, source: h.trim(), cached: false };+ return { agents, stale: false, source: h.trim(), cached: false, known: true };} catch {/* try next host */}}// all FRA hosts failed — serve last-known cache, flagged stale- if (cache) return { agents: cache.agents, stale: true, source: cache.meta?.source || 'cache', cached: true };- return { agents: [], stale: true, source: 'unreachable', cached: false };+ if (cache) {+ return { agents: cache.agents, stale: true, source: cache.meta?.source || 'cache', cached: true, known: true };+ }+ // Configured, tried, no answer, and nothing cached: the agent count is UNKNOWN,+ // not zero. `known: false` tells consumers they may not report a number here.+ return { agents: [], stale: true, source: 'unreachable', cached: false, known: false };}// --- unified ---------------------------------------------------------------export function collect({ force = false, localOnly = false } = {}) {const local = collectLocal();- let remote = { agents: [], stale: false, source: 'skipped', cached: false };+ let remote = { agents: [], stale: false, source: 'skipped', cached: false, known: true };if (!localOnly) remote = collectRemote({ force });return {ts: nowTs(),hosts: {mac: { count: local.length },- fra: { count: remote.agents.length, stale: remote.stale, source: remote.source, cached: remote.cached },+ // `count` is null — never 0 — when the remote could not be reached and no+ // cache exists. Zero would read as "no agents there", which is a claim the+ // probe cannot support. Consumers must render null as unknown.+ fra: {+ count: remote.known === false ? null : remote.agents.length,+ known: remote.known !== false,+ stale: remote.stale,+ source: remote.source,+ cached: remote.cached,+ },},agents: [...local, ...remote.agents],};diff --git a/claude-ops/scripts/agent-dash/render.mjs b/claude-ops/scripts/agent-dash/render.mjsindex 43acfe91..bf39f045 100644--- a/claude-ops/scripts/agent-dash/render.mjs+++ b/claude-ops/scripts/agent-dash/render.mjs@@ -113,17 +113,25 @@ export function renderDashboard(snapshot, { width = 100, selectedIdx = 0, statusconst total = agents.length;const needs = agents.filter((a) => a.status === 'needs-sam').length;const fra = snapshot.hosts?.fra || {};- const fraTag = fra.stale- ? `${C.red}stale${C.reset}`- : fra.cached- ? `${C.gray}cached${C.reset}`- : `${C.green}live${C.reset}`;+ const fraUnknown = fra.known === false || fra.count === null || fra.count === undefined;+ const fraTag = fraUnknown+ ? `${C.red}unreachable${C.reset}`+ : fra.source === 'not-configured'+ ? `${C.gray}not configured${C.reset}`+ : fra.stale+ ? `${C.red}stale${C.reset}`+ : fra.cached+ ? `${C.gray}cached${C.reset}`+ : `${C.green}live${C.reset}`;+ // "?" not "0": an unreachable host has an unknown agent count, and printing a+ // number there is indistinguishable from a genuinely idle host.+ const fraCount = fraUnknown ? '?' : fra.count;// headerlines.push(`${C.bold}${C.cyan}AGENT-DASH${C.reset} ${C.bold}${total}${C.reset} agents` +` ${C.dim}·${C.reset} mac ${snapshot.hosts?.mac?.count ?? 0}` +- ` ${C.dim}·${C.reset} fra ${fra.count ?? 0} (${fraTag})` ++ ` ${C.dim}·${C.reset} fra ${fraCount} (${fraTag})` +(needs ? ` ${C.brightYellow}${C.bold}◆ ${needs} need you${C.reset}` : '') +` ${C.gray}${new Date(snapshot.ts).toLocaleTimeString()}${C.reset}`,);