hives report an agent being updated: its status shows updating from the update's stop until the container is back up
A hive marks an agent updating when StopForUpdate stops its running container and clears it when the tail Reconcile or Start settles it, success or failure. The flag rides in the agent status snapshot (absent when false, so older readers and documents are unchanged), the status publisher sends a change at once instead of at the next sweep, and the swarm UI card shows an updating badge.
This commit is contained in:
parent
ca1e25b21e
commit
748ef2da08
2 changed files with 227 additions and 12 deletions
|
|
@ -15,6 +15,9 @@ export interface AgentStatusSnapshot {
|
|||
status_text: string | null;
|
||||
status_set_at: number | null;
|
||||
running: boolean;
|
||||
// The hive is updating the agent: down from the update's stop until the
|
||||
// container is back up. Absent from a hive that does not publish it.
|
||||
updating?: boolean;
|
||||
}
|
||||
|
||||
// `"up"` / `"offline"` / `"destroyed"`, wire-spelled by
|
||||
|
|
@ -72,6 +75,12 @@ export function hivePauseReason(
|
|||
return row.paused_by_hive ? row.paused_by_hive : null;
|
||||
}
|
||||
|
||||
// Whether the hive is updating the agent right now, so it reads as stopped for
|
||||
// a reason. Only a snapshot that says so counts; none shows nothing.
|
||||
export function isUpdating(row: Pick<AgentRow, "snapshot">): boolean {
|
||||
return row.snapshot?.updating === true;
|
||||
}
|
||||
|
||||
// Same tone pairing as HivesCard — one freshness enum shared by both
|
||||
// endpoints, so the same tone rule applies to both pages — but
|
||||
// `unknown`'s label diverges deliberately: an agent outside the
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import { StatusMessage } from "../detail/StatusMessage.js";
|
|||
import { termPaths } from "../terminal/term-paths.js";
|
||||
import {
|
||||
hivePauseReason,
|
||||
isUpdating,
|
||||
showsLoginNeeded,
|
||||
type AgentRow,
|
||||
} from "../AgentTypes.js";
|
||||
|
|
@ -66,6 +67,13 @@ export function AgentCard({
|
|||
name={<span class="ui-agent-card-name">{row.name}</span>}
|
||||
status={
|
||||
<>
|
||||
{isUpdating(row) ? (
|
||||
<Badge
|
||||
tone="accent"
|
||||
value="updating"
|
||||
title="the hive is updating this agent: it is stopped until the update brings it back up"
|
||||
/>
|
||||
) : null}
|
||||
{hivePauseReason(row) !== null ? (
|
||||
<Badge
|
||||
tone="warning"
|
||||
|
|
|
|||
Loading…
Reference in a new issue