Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-6742: describe long-offline runtimes factually (#7676)
Multica Eve6d5dd5df3653
diff --git a/packages/core/agents/derive-presence.test.ts b/packages/core/agents/derive-presence.test.tsindex ae85ac6ee7..8c21b122fd 100644--- a/packages/core/agents/derive-presence.test.ts+++ b/packages/core/agents/derive-presence.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import type { Agent, AgentRuntime, AgentTask } from "../types";import {@@ -106,10 +108,10 @@ describe("deriveAgentAvailability", () => {).toBe("offline");});- it("collapses about_to_gc into offline (it's a runtime-card concern, not the dot)", () => {+ it("collapses long_offline into offline (it's a runtime-card concern, not the dot)", () => {expect(deriveAgentAvailability(- // 6.5 days ago — past the 6-day about_to_gc threshold.+ // 6.5 days ago — past the 6-day long_offline threshold.makeRuntime({ status: "offline", last_seen_at: "2026-04-21T00:00:00Z" }),NOW,),diff --git a/packages/core/agents/derive-presence.ts b/packages/core/agents/derive-presence.tsindex 28a301d2b0..a3427fc8f6 100644--- a/packages/core/agents/derive-presence.ts+++ b/packages/core/agents/derive-presence.ts@@ -20,9 +20,9 @@ import type {} from "./types";// AgentAvailability mirrors RuntimeHealth's reachability buckets but folds-// `about_to_gc` into `offline` — both mean "long unreachable" from the-// user's standpoint; the GC-warning copy belongs to the runtime card, not-// the agent dot.+// `long_offline` into `offline` — both mean "unreachable" from the agent+// availability standpoint; the duration detail belongs to the runtime card,+// not the agent dot.export function deriveAgentAvailability(runtime: AgentRuntime | null,now: number,@@ -31,7 +31,7 @@ export function deriveAgentAvailability(const health = deriveRuntimeHealth(runtime, now);if (health === "online") return "online";if (health === "recently_lost") return "unstable";- return "offline"; // offline | about_to_gc collapse here+ return "offline"; // offline | long_offline collapse here}// Atomic workload derivation: pure 3-way classification of running/queueddiff --git a/packages/core/runtimes/derive-health.test.ts b/packages/core/runtimes/derive-health.test.tsindex c6d4ac1103..aaf9e56d3f 100644--- a/packages/core/runtimes/derive-health.test.ts+++ b/packages/core/runtimes/derive-health.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import type { AgentRuntime } from "../types";import { deriveRuntimeHealth } from "./derive-health";@@ -56,7 +58,7 @@ describe("deriveRuntimeHealth", () => {).toBe("offline");});- it("returns about_to_gc when offline beyond 6 days (within 1 day of GC)", () => {+ it("returns long_offline when offline beyond 6 days", () => {expect(deriveRuntimeHealth(makeRuntime({@@ -65,17 +67,17 @@ describe("deriveRuntimeHealth", () => {}),FIXED_NOW,),- ).toBe("about_to_gc");+ ).toBe("long_offline");});- it("treats null last_seen_at as long-offline (about_to_gc)", () => {+ it("treats null last_seen_at as long_offline", () => {// last_seen_at = null means lastSeen = 0 (epoch), so offlineFor is huge.expect(deriveRuntimeHealth(makeRuntime({ status: "offline", last_seen_at: null }),FIXED_NOW,),- ).toBe("about_to_gc");+ ).toBe("long_offline");});it("respects the 5-minute boundary (just inside → recently_lost)", () => {diff --git a/packages/core/runtimes/derive-health.ts b/packages/core/runtimes/derive-health.tsindex f19fab7303..44c8fa9c28 100644--- a/packages/core/runtimes/derive-health.ts+++ b/packages/core/runtimes/derive-health.ts@@ -7,10 +7,9 @@ import type { AgentRuntime } from "../types";import type { RuntimeHealth } from "./types";const FIVE_MINUTES_MS = 5 * 60 * 1000;-// The runtime sweeper GCs runtimes that have been offline for 7 days. We-// flag the last 24 hours of that window so users can rescue a runtime-// before it disappears silently.-const ABOUT_TO_GC_THRESHOLD_MS = 6 * 24 * 3600 * 1000; // 6 days+// Long-offline is a display state based on observed reachability. It does+// not promise when or whether server-side cleanup will happen.+const LONG_OFFLINE_THRESHOLD_MS = 6 * 24 * 3600 * 1000; // 6 daysexport function deriveRuntimeHealth(runtime: AgentRuntime, now: number): RuntimeHealth {if (runtime.status === "online") return "online";@@ -22,6 +21,6 @@ export function deriveRuntimeHealth(runtime: AgentRuntime, now: number): Runtimeconst offlineFor = now - lastSeen;if (offlineFor < FIVE_MINUTES_MS) return "recently_lost";- if (offlineFor > ABOUT_TO_GC_THRESHOLD_MS) return "about_to_gc";+ if (offlineFor > LONG_OFFLINE_THRESHOLD_MS) return "long_offline";return "offline";}diff --git a/packages/core/runtimes/types.ts b/packages/core/runtimes/types.tsindex 79dffaa185..e33e886a5c 100644--- a/packages/core/runtimes/types.ts+++ b/packages/core/runtimes/types.ts@@ -6,5 +6,5 @@export type RuntimeHealth =| "online" // green — within heartbeat threshold| "recently_lost" // amber — offline < 5 minutes (likely transient)- | "offline" // grey — offline 5 minutes ~ 7 days- | "about_to_gc"; // dim — within 1 day of the 7-day GC threshold+ | "offline" // grey — offline 5 minutes ~ 6 days+ | "long_offline"; // destructive — offline beyond 6 daysdiff --git a/packages/core/runtimes/use-runtime-health.ts b/packages/core/runtimes/use-runtime-health.tsindex 776e54b7f9..018139c715 100644--- a/packages/core/runtimes/use-runtime-health.ts+++ b/packages/core/runtimes/use-runtime-health.ts@@ -20,7 +20,7 @@ function useHealthTick(): number {}/**- * Derived runtime health (online / recently_lost / offline / about_to_gc),+ * Derived runtime health (online / recently_lost / offline / long_offline),* or "loading" while the runtime list is still resolving.** Accepts wsId as a parameter so the hook works outside WorkspaceIdProvider.diff --git a/packages/views/locales/en/runtimes.json b/packages/views/locales/en/runtimes.jsonindex 73bea48306..a51db08ab2 100644--- a/packages/views/locales/en/runtimes.json+++ b/packages/views/locales/en/runtimes.json@@ -104,9 +104,9 @@"label": "Offline","description": "No heartbeat for 5+ minutes. Restart the daemon or investigate the host."},- "about_to_gc": {- "label": "About to GC",- "description": "Offline 6+ days. Auto-deleted at 7 days unless it reconnects."+ "long_offline": {+ "label": "Long offline",+ "description": "No heartbeat for 6+ days. If this host will stay offline, rebind its agents to another runtime or delete this runtime."}},"detail": {diff --git a/packages/views/locales/ja/runtimes.json b/packages/views/locales/ja/runtimes.jsonindex a2d81295fa..3b6626d9db 100644--- a/packages/views/locales/ja/runtimes.json+++ b/packages/views/locales/ja/runtimes.json@@ -100,9 +100,9 @@"label": "オフライン","description": "5 分以上 heartbeat がありません。デーモンを再起動するか、ホストを調べてください。"},- "about_to_gc": {- "label": "まもなく削除",- "description": "6 日以上オフラインです。再接続しない限り、7 日目に自動削除されます。"+ "long_offline": {+ "label": "長期オフライン",+ "description": "6 日以上 heartbeat がありません。このホストを復旧しない場合は、紐づくエージェントを別のランタイムに再割り当てするか、このランタイムを削除してください。"}},"detail": {diff --git a/packages/views/locales/ko/runtimes.json b/packages/views/locales/ko/runtimes.jsonindex ed49873fcf..659e88fb7f 100644--- a/packages/views/locales/ko/runtimes.json+++ b/packages/views/locales/ko/runtimes.json@@ -100,9 +100,9 @@"label": "오프라인","description": "5분 넘게 heartbeat가 없습니다. 데몬을 다시 시작하거나 호스트를 확인하세요."},- "about_to_gc": {- "label": "곧 정리됨",- "description": "6일 넘게 오프라인입니다. 다시 연결되지 않으면 7일째 자동 삭제됩니다."+ "long_offline": {+ "label": "장기 오프라인",+ "description": "6일 넘게 heartbeat가 없습니다. 이 호스트를 복구하지 않을 경우 연결된 에이전트를 다른 런타임에 다시 할당하거나 이 런타임을 삭제하세요."}},"detail": {diff --git a/packages/views/locales/zh-Hans/runtimes.json b/packages/views/locales/zh-Hans/runtimes.jsonindex 4aacf60e87..c1d7148212 100644--- a/packages/views/locales/zh-Hans/runtimes.json+++ b/packages/views/locales/zh-Hans/runtimes.json@@ -100,9 +100,9 @@"label": "离线","description": "5 分钟以上没有心跳。请重启守护进程或排查主机。"},- "about_to_gc": {- "label": "即将清理",- "description": "离线 6 天以上。如不重连,将在 7 天时自动删除。"+ "long_offline": {+ "label": "长期离线",+ "description": "6 天以上没有心跳。如果这台主机不会恢复,请将关联智能体改绑到其他运行时,或删除此运行时。"}},"detail": {diff --git a/packages/views/runtimes/components/runtime-detail.tsx b/packages/views/runtimes/components/runtime-detail.tsxindex 5150095984..07adaa894b 100644--- a/packages/views/runtimes/components/runtime-detail.tsx+++ b/packages/views/runtimes/components/runtime-detail.tsx@@ -67,7 +67,7 @@ function shortDaemonId(id: string | null): string | null {}// 30s tick keeps derived runtime health honest as time-based windows-// (recently_lost → offline → about_to_gc) cross thresholds without any new+// (recently_lost → offline → long_offline) cross thresholds without any new// query data arriving. Agent presence has no time windows anymore, so it// doesn't need this — but useWorkspacePresenceMap is the dependency we// already mounted on this page, and that's wired to query data, not `now`.diff --git a/packages/views/runtimes/components/runtime-list.tsx b/packages/views/runtimes/components/runtime-list.tsxindex f8aa94865b..66551cbd93 100644--- a/packages/views/runtimes/components/runtime-list.tsx+++ b/packages/views/runtimes/components/runtime-list.tsx@@ -343,7 +343,7 @@ function HealthCell({}const health = deriveRuntimeHealth(runtime, now);- const offline = health === "offline" || health === "about_to_gc";+ const offline = health === "offline" || health === "long_offline";const lastSeen = runtime.last_seen_at ? timeAgo(runtime.last_seen_at) : null;const active = workload.runningCount + workload.queuedCount;diff --git a/packages/views/runtimes/components/runtime-machines.test.ts b/packages/views/runtimes/components/runtime-machines.test.tsindex 0386d92d95..79a91581b2 100644--- a/packages/views/runtimes/components/runtime-machines.test.ts+++ b/packages/views/runtimes/components/runtime-machines.test.ts@@ -1,3 +1,5 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";import type { AgentRuntime } from "@multica/core/types";import {@@ -127,6 +129,29 @@ describe("runtime machine grouping", () => {expect(filterRuntimeMachines(machines, "", "issues")).toHaveLength(1);});+ it("keeps long_offline as the highest-severity machine health", () => {+ const machines = buildRuntimeMachines(+ [+ makeRuntime({+ id: "rt-offline",+ provider: "claude",+ status: "offline",+ last_seen_at: new Date(NOW - 10 * 60_000).toISOString(),+ }),+ makeRuntime({+ id: "rt-long-offline",+ provider: "codex",+ status: "offline",+ last_seen_at: new Date(NOW - 6.5 * 24 * 60 * 60_000).toISOString(),+ }),+ ],+ { now: NOW },+ );++ expect(machines).toHaveLength(1);+ expect(machines[0]?.health).toBe("long_offline");+ });+it("does not surface agent CLI version branding as the machine subtitle", () => {// Reproduces the bug where every machine row's subtitle read// "Claude Code …" because compactDeviceInfo flipped the parentheticaldiff --git a/packages/views/runtimes/components/runtime-machines.ts b/packages/views/runtimes/components/runtime-machines.tsindex b991414799..30da26f8cf 100644--- a/packages/views/runtimes/components/runtime-machines.ts+++ b/packages/views/runtimes/components/runtime-machines.ts@@ -66,7 +66,7 @@ const HEALTH_SEVERITY: Record<RuntimeHealth, number> = {online: 0,recently_lost: 1,offline: 2,- about_to_gc: 3,+ long_offline: 3,};export function splitRuntimeName(name: string): {diff --git a/packages/views/runtimes/components/shared.tsx b/packages/views/runtimes/components/shared.tsxindex e05da66b79..a8e785a7c8 100644--- a/packages/views/runtimes/components/shared.tsx+++ b/packages/views/runtimes/components/shared.tsx@@ -27,13 +27,12 @@ export function ProviderChip({ provider }: { provider: string }) {// The mapping intentionally reuses our existing tokens (success/warning/// muted-foreground/destructive) instead of introducing runtime-specific// colours — keeps the palette small and consistent with Skills.-// Maps each derived 4-state runtime health to a semantic colour class.// Labels flow through useT — see useHealthLabel below.const HEALTH_VISUAL: Record<RuntimeHealth, { dot: string; tone: string }> = {online: { dot: "bg-success", tone: "bg-success/10 text-success" },recently_lost: { dot: "bg-warning", tone: "bg-warning/10 text-warning" },offline: { dot: "bg-muted-foreground/40", tone: "bg-muted text-muted-foreground" },- about_to_gc: { dot: "bg-destructive", tone: "bg-destructive/10 text-destructive" },+ long_offline: { dot: "bg-destructive", tone: "bg-destructive/10 text-destructive" },};export function HealthDot({@@ -65,7 +64,7 @@ export function HealthDot({// online → Wifi (full bars, success)// recently_lost → WifiHigh (fewer bars, warning) — transient hiccup// offline → WifiOff (slashed, muted) — long unreachable-// about_to_gc → WifiOff (slashed, destructive) — sweeper coming+// long_offline → WifiOff (slashed, destructive) — prolonged outageconst HEALTH_ICON: Record<RuntimeHealth,{ Icon: typeof Wifi; tone: string }@@ -73,7 +72,7 @@ const HEALTH_ICON: Record<online: { Icon: Wifi, tone: "text-success" },recently_lost: { Icon: WifiHigh, tone: "text-warning" },offline: { Icon: WifiOff, tone: "text-muted-foreground" },- about_to_gc: { Icon: WifiOff, tone: "text-destructive" },+ long_offline: { Icon: WifiOff, tone: "text-destructive" },};export function HealthIcon({@@ -97,7 +96,7 @@ const HEALTH_LABEL_EN: Record<RuntimeHealth, string> = {online: "Online",recently_lost: "Recently lost",offline: "Offline",- about_to_gc: "About to GC",+ long_offline: "Long offline",};export function healthLabel(health: RuntimeHealth | "loading"): string {