swarm-ui: give hive-reported-but-unknown agents their own status label
An agent whose freshness is "unknown" is a distinct case, not a
fallback: it reported into the KV bucket but isn't in the swarm-identity
roster. The label used to just reuse the enum name ("unknown"), which
doesn't tell an operator what to do about it. Give it a label that
names the actual situation ("not in swarm identity") plus a tooltip
spelling out the fix (register/migrate it), so an operator scanning the
roster during a migration can immediately tell which agents still need
work.
No backend change needed — GET /api/agents/status already emits a row
for every hive-reported agent outside the roster (AgentStatusReader,
unit-tested as an_agent_outside_the_roster_is_surfaced_as_unknown), and
the page already renders every row it gets back.
This commit is contained in:
parent
3b038425f2
commit
8d29ebf53c
1 changed files with 16 additions and 3 deletions
|
|
@ -78,13 +78,21 @@ interface AgentRow {
|
||||||
wanted: Wanted;
|
wanted: Wanted;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Same tone/label pairing as HivesPage — one freshness enum shared by both
|
// Same tone pairing as HivesPage — one freshness enum shared by both
|
||||||
// endpoints, so the same rendering rule applies to both pages.
|
// endpoints, so the same tone rule applies to both pages — but `unknown`'s
|
||||||
|
// label diverges deliberately: an agent outside the swarm-identity roster
|
||||||
|
// has a concrete next step (register it), while an unrecognized *hive* on
|
||||||
|
// HivesPage doesn't carry the same actionable meaning.
|
||||||
const FRESHNESS: Record<Freshness, { tone: BadgeTone; label: string }> = {
|
const FRESHNESS: Record<Freshness, { tone: BadgeTone; label: string }> = {
|
||||||
fresh: { tone: "positive", label: "fresh" },
|
fresh: { tone: "positive", label: "fresh" },
|
||||||
stale: { tone: "warning", label: "stale" },
|
stale: { tone: "warning", label: "stale" },
|
||||||
never_reported: { tone: "neutral", label: "never reported" },
|
never_reported: { tone: "neutral", label: "never reported" },
|
||||||
unknown: { tone: "negative", label: "unknown" },
|
// `unknown` means the agent reported into the KV bucket but isn't in
|
||||||
|
// the swarm-identity roster — a real, distinct case ("hive-reported,
|
||||||
|
// not yet in swarm level"), not just a fallback default, so it gets a
|
||||||
|
// label that says what to do about it rather than reusing the enum
|
||||||
|
// name as the label.
|
||||||
|
unknown: { tone: "negative", label: "not in swarm identity" },
|
||||||
};
|
};
|
||||||
|
|
||||||
// Same 30s default + same reasoning as HivesPage: no inputs on this page
|
// Same 30s default + same reasoning as HivesPage: no inputs on this page
|
||||||
|
|
@ -214,6 +222,11 @@ export function AgentsPage() {
|
||||||
return (
|
return (
|
||||||
<Badge
|
<Badge
|
||||||
tone={tone}
|
tone={tone}
|
||||||
|
title={
|
||||||
|
a.freshness === "unknown"
|
||||||
|
? "reported by its hive but not registered in swarm-level identity — needs migration"
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
value={
|
value={
|
||||||
<>
|
<>
|
||||||
{text ? `${text} — ` : ""}
|
{text ? `${text} — ` : ""}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue