Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

feat(switchdash): show which version an update would bring, and flag it in the sidebar (CHOO-1809)

Louis Amaudruzb1fb967bc32c
diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-trouble-indicator.tsx b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-trouble-indicator.tsx
index 060cd5974..16f91bccb 100644
--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-trouble-indicator.tsx
+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-trouble-indicator.tsx
@@ -15,19 +15,39 @@
* as broken because Codex is absent.
*/
-import { PlugZap, Wrench } from 'lucide-react';
+import { CircleFadingArrowUp, PlugZap, Wrench } from 'lucide-react';
import { observer } from 'mobx-react-lite';
import { useEffect } from 'react';
import { Tooltip, TooltipContent, TooltipTrigger } from '@renderer/lib/ui/tooltip';
import { deriveAgentTypeStatus } from '@shared/core/remote-hosts/host-status';
import {
+ agentTypeSteps,
outstandingRequiredHostSteps,
outstandingRequiredStepsFor,
+ type HostSetupPlan,
+ type HostSetupStep,
} from '@shared/core/remote-hosts/setup';
import { hostReachabilityStore } from './host-reachability-store';
import { hostSetupStore } from './host-setup-store';
const ICON = 'h-3.5 w-3.5 shrink-0 text-foreground-warning';
+const UPDATE_ICON = 'h-3.5 w-3.5 shrink-0 text-foreground-muted';
+
+/**
+ * This agent type's steps that are installed but behind — its CLI, its Switch
+ * connector, or both.
+ *
+ * Only steps carrying a known newer version qualify. `updateAvailable` is never
+ * set off a version we could not read, and it is additionally gated on the
+ * update being one switchdash could actually perform, so an icon here always
+ * corresponds to a button that works.
+ */
+function staleStepsFor(plan: HostSetupPlan | null, agentId: string): HostSetupStep[] {
+ if (!plan) return [];
+ return agentTypeSteps(plan, agentId).filter(
+ (step) => step.state === 'satisfied' && step.updateAvailable && step.latestVersion
+ );
+}
export const HostTroubleIndicator = observer(function HostTroubleIndicator({
sshHost,
@@ -55,7 +75,7 @@ export const HostTroubleIndicator = observer(function HostTroubleIndicator({
return (
<Tooltip>
<TooltipTrigger>
- <PlugZap className={ICON} />
+ <PlugZap className={ICON} aria-label="Host unavailable" />
</TooltipTrigger>
<TooltipContent>
{status.kind === 'auth-failed'
@@ -67,14 +87,32 @@ export const HostTroubleIndicator = observer(function HostTroubleIndicator({
);
}
- if (status.kind !== 'setup-required') return null;
+ // Nothing wrong, but something newer exists. Reported last and only when the
+ // row is otherwise clean: an out-of-date connector still works, so it must
+ // never displace a reason the agent is actually stuck.
+ if (status.kind !== 'setup-required') {
+ const stale = agentId ? staleStepsFor(plan, agentId) : [];
+ if (stale.length === 0) return null;
+ return (
+ <Tooltip>
+ <TooltipTrigger>
+ <CircleFadingArrowUp className={UPDATE_ICON} aria-label="Update available" />
+ </TooltipTrigger>
+ <TooltipContent>
+ {`Update available on ${sshHost}: ${stale
+ .map((step) => `${step.name} ${step.latestVersion}`)
+ .join(', ')}`}
+ </TooltipContent>
+ </Tooltip>
+ );
+ }
const missing = plan ? outstandingRequiredStepsFor(plan, agentId).map((step) => step.name) : [];
const hostItself = !plan || outstandingRequiredHostSteps(plan).length > 0;
return (
<Tooltip>
<TooltipTrigger>
- <Wrench className={ICON} />
+ <Wrench className={ICON} aria-label="Setup required" />
</TooltipTrigger>
<TooltipContent>
{hostItself
diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-detail-sheet.tsx b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-detail-sheet.tsx
index 7f745287a..3bab5a640 100644
--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-detail-sheet.tsx
+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-detail-sheet.tsx
@@ -115,6 +115,14 @@ function ObservationCard({
</span>
)}
<span className="ml-1">on this host</span>
+ {step.updateAvailable && step.latestVersion && (
+ <>
+ <span className="ml-1">·</span>
+ <span className="ml-1 text-foreground-warning">
+ {step.latestVersion} available
+ </span>
+ </>
+ )}
</>
) : step.state === 'checking' ? (
<span className="text-foreground-muted">Checking…</span>
diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-rows.tsx b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-rows.tsx
index e2ebf953b..6d04d5187 100644
--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-rows.tsx
+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-rows.tsx
@@ -35,6 +35,7 @@ import {
canUpdate,
signInLabel,
stepBadge,
+ versionSubtitle,
type AgentTypeRow,
type BadgeSpec,
} from './step-presentation';
@@ -262,7 +263,7 @@ export function PrerequisiteRow({
<Row
icon={<PrerequisiteIcon step={step} />}
name={step.name}
- subtitle={step.state === 'satisfied' ? step.version : null}
+ subtitle={versionSubtitle(step)}
progress={activity}
badge={stepBadge(step)}
highlighted={isCurrent}
@@ -405,7 +406,7 @@ export function AgentTypeRowItem({
<Row
icon={<AgentIcon id={row.agentId} size={16} />}
name={row.name}
- subtitle={row.cli.state === 'satisfied' ? row.cli.version : null}
+ subtitle={versionSubtitle(row.cli)}
progress={activityFor(row.cli.id)}
badge={stepBadge(row.cli)}
highlighted={currentStepId === row.cli.id}
@@ -432,13 +433,7 @@ export function AgentTypeRowItem({
<Row
icon={<Puzzle className="size-4 text-foreground-muted" />}
name="Switch connector"
- subtitle={
- cliReady
- ? plugin.state === 'satisfied'
- ? plugin.version
- : null
- : `Needs ${row.name} first`
- }
+ subtitle={cliReady ? versionSubtitle(plugin) : `Needs ${row.name} first`}
progress={activityFor(plugin.id)}
badge={stepBadge(plugin)}
highlighted={currentStepId === plugin.id}
diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/step-presentation.test.ts b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/step-presentation.test.ts
index fbfc33e2a..3be6e67cf 100644
--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/step-presentation.test.ts
+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/step-presentation.test.ts
@@ -12,6 +12,7 @@ import {
outcomeLabel,
signInLabel,
stepBadge,
+ versionSubtitle,
} from './step-presentation';
function step(patch: Partial<HostSetupStep> = {}): HostSetupStep {
@@ -385,3 +386,53 @@ describe('stepBadge — a failed action over something that is installed', () =>
expect(stepBadge(step({ state: 'failed', outcome: 'missing' })).label).toBe('Not installed');
});
});
+
+/**
+ * How far behind, not just that you are behind (CHOO-1809).
+ *
+ * The badge can only say an update exists. The number you want before taking
+ * one was hidden in the Update button's tooltip, invisible to anyone not
+ * already hovering it.
+ */
+describe('versionSubtitle', () => {
+ it('shows both versions when something newer exists', () => {
+ expect(
+ versionSubtitle(
+ step({
+ state: 'satisfied',
+ version: '0.146.0',
+ latestVersion: '0.147.0',
+ updateAvailable: true,
+ })
+ )
+ ).toBe('0.146.0 → 0.147.0');
+ });
+
+ it('shows just the installed version when nothing newer is known', () => {
+ expect(versionSubtitle(step({ state: 'satisfied', version: '0.146.0' }))).toBe('0.146.0');
+ });
+
+ it('does not promise an update we hold no version for', () => {
+ // `updateAvailable` without a `latestVersion` should not happen, but an
+ // arrow pointing at nothing is a worse way to find out than a plain version.
+ expect(
+ versionSubtitle(
+ step({ state: 'satisfied', version: '0.146.0', latestVersion: null, updateAvailable: true })
+ )
+ ).toBe('0.146.0');
+ });
+
+ it('says nothing about a step that is not installed', () => {
+ expect(
+ versionSubtitle(step({ state: 'pending', outcome: 'missing', version: null }))
+ ).toBeNull();
+ });
+
+ it('never describes a version on something absent, even if one lingers', () => {
+ // A stale `version` left on a step that has since gone missing must not be
+ // rendered as though it were found.
+ expect(
+ versionSubtitle(step({ state: 'pending', outcome: 'missing', version: '0.146.0' }))
+ ).toBeNull();
+ });
+});
diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/step-presentation.ts b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/step-presentation.ts
index 1b95af804..6ddcbcc9a 100644
--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/step-presentation.ts
+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/step-presentation.ts
@@ -142,6 +142,25 @@ export function signInLabel(step: HostSetupStep): string {
return step.error?.includes('read:packages') ? 'Re-authenticate' : 'Sign in';
}
+/**
+ * The version line under a row's name.
+ *
+ * When something newer exists, both numbers are shown — `0.146.0 → 0.147.0`.
+ * The badge can only say *that* an update exists; what you usually want to know
+ * before taking one is how far behind you are, and hiding that in the Update
+ * button's tooltip made it invisible to anyone not already hovering it.
+ *
+ * Only for a satisfied step: a version on a row that is not installed would be
+ * describing something that is not there.
+ */
+export function versionSubtitle(step: HostSetupStep): string | null {
+ if (step.state !== 'satisfied') return null;
+ if (!step.updateAvailable || !step.latestVersion) return step.version;
+ // `updateAvailable` is only ever true off a real comparison, so a missing
+ // installed version here would be a contradiction — say what we do know.
+ return step.version ? `${step.version} → ${step.latestVersion}` : `→ ${step.latestVersion}`;
+}
+
export type BadgeSpec = { tone: StatusTone; label: string };
/**
diff --git a/dash/apps/switchdash-desktop/src/renderer/tests/browser/host-trouble-indicator.test.tsx b/dash/apps/switchdash-desktop/src/renderer/tests/browser/host-trouble-indicator.test.tsx
new file mode 100644
index 000000000..e3b44a708
--- /dev/null
+++ b/dash/apps/switchdash-desktop/src/renderer/tests/browser/host-trouble-indicator.test.tsx
@@ -0,0 +1,225 @@
+import { act } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+vi.hoisted(() => {
+ window.electronAPI ??= {
+ invoke: () => Promise.resolve(undefined),
+ eventOn: () => () => {},
+ eventSend: () => {},
+ } as unknown as typeof window.electronAPI;
+});
+
+const stores = vi.hoisted(() => ({
+ reachability: new Map<string, unknown>(),
+ plans: new Map<string, unknown>(),
+}));
+
+vi.mock('@renderer/features/remote-hosts/host-reachability-store', () => ({
+ hostReachabilityStore: {
+ get: (sshHost: string) =>
+ stores.reachability.get(sshHost) ?? {
+ sshHost,
+ status: 'reachable',
+ lastError: null,
+ lastCheckedAt: null,
+ lastReachableAt: null,
+ consecutiveFailures: 0,
+ nextProbeAt: null,
+ probing: false,
+ },
+ },
+}));
+
+vi.mock('@renderer/features/remote-hosts/host-setup-store', () => ({
+ hostSetupStore: {
+ hydrate: () => Promise.resolve(),
+ get: (sshHost: string | null) => (sshHost ? (stores.plans.get(sshHost) ?? null) : null),
+ },
+}));
+
+/**
+ * An out-of-date connector on the agent's own row (CHOO-1809).
+ *
+ * Asked for so a stale Switch connector is visible without opening every host
+ * page. It is strictly lower priority than the trouble icons: an old connector
+ * still works, so it must never take the place of the reason an agent is stuck.
+ */
+import { HostTroubleIndicator } from '@renderer/features/remote-hosts/host-trouble-indicator';
+import { TooltipProvider } from '@renderer/lib/ui/tooltip';
+import type { HostSetupPlan, HostSetupStep } from '@shared/core/remote-hosts/setup';
+
+let container: HTMLDivElement | null = null;
+let root: Root | null = null;
+
+beforeEach(() => {
+ stores.reachability.clear();
+ stores.plans.clear();
+});
+
+afterEach(async () => {
+ if (root) await act(async () => root!.unmount());
+ container?.remove();
+ container = null;
+ root = null;
+});
+
+function step(patch: Partial<HostSetupStep>): HostSetupStep {
+ return {
+ id: 'git',
+ kind: 'core-dependency',
+ name: 'Git',
+ state: 'satisfied',
+ outcome: 'satisfied',
+ version: '2.43.0',
+ latestVersion: null,
+ updateAvailable: false,
+ error: null,
+ output: null,
+ optional: false,
+ dependsOn: [],
+ updatedAt: '2026-02-02T00:00:00.000Z',
+ ...patch,
+ };
+}
+
+function plan(steps: HostSetupStep[]): HostSetupPlan {
+ return {
+ sshHost: 'dev-vm',
+ status: 'idle',
+ steps,
+ currentStepId: null,
+ createdAt: '2026-02-02T00:00:00.000Z',
+ updatedAt: '2026-02-02T00:00:00.000Z',
+ };
+}
+
+/** A healthy host running Claude Code, with the connector optionally behind. */
+function healthyPlan(pluginPatch: Partial<HostSetupStep> = {}): HostSetupPlan {
+ return plan([
+ step({}),
+ step({ id: 'claude', kind: 'agent-cli', name: 'Claude Code', version: '2.1.0' }),
+ step({
+ id: 'claude:plugin',
+ kind: 'agent-plugin',
+ name: 'Switch connector',
+ version: '0.7.7',
+ dependsOn: ['claude'],
+ ...pluginPatch,
+ }),
+ ]);
+}
+
+async function render(node: React.ReactNode): Promise<HTMLDivElement> {
+ container = document.createElement('div');
+ document.body.appendChild(container);
+ root = createRoot(container);
+ // The indicator's only output is a tooltip, which needs its provider.
+ await act(async () => root!.render(<TooltipProvider>{node}</TooltipProvider>));
+ return container;
+}
+
+const indicator = () => <HostTroubleIndicator sshHost="dev-vm" agentId="claude" />;
+const icons = (el: HTMLElement) => [...el.querySelectorAll('svg')].length;
+/** Tooltip *content* only renders on hover, so assert on the trigger's label. */
+const shows = (el: HTMLElement, label: string) =>
+ el.querySelector(`[aria-label="${label}"]`) !== null;
+
+describe('the update indicator', () => {
+ it('appears when this agent’s connector is behind', async () => {
+ stores.plans.set('dev-vm', healthyPlan({ latestVersion: '0.8.0', updateAvailable: true }));
+
+ expect(shows(await render(indicator()), 'Update available')).toBe(true);
+ });
+
+ it('stays away when everything is current', async () => {
+ // A tick on every healthy row is noise that trains people to stop reading.
+ stores.plans.set('dev-vm', healthyPlan());
+
+ expect(icons(await render(indicator()))).toBe(0);
+ });
+
+ it('stays away when the newer version is not actually known', async () => {
+ stores.plans.set('dev-vm', healthyPlan({ latestVersion: null, updateAvailable: true }));
+
+ expect(icons(await render(indicator()))).toBe(0);
+ });
+
+ it('ignores another agent type being out of date', async () => {
+ // Codex being stale is not this Claude Code agent's problem, exactly as a
+ // missing Codex is not.
+ stores.plans.set(
+ 'dev-vm',
+ plan([
+ step({}),
+ step({ id: 'claude', kind: 'agent-cli', name: 'Claude Code' }),
+ step({
+ id: 'codex',
+ kind: 'agent-cli',
+ name: 'Codex',
+ version: '0.146.0',
+ latestVersion: '0.147.0',
+ updateAvailable: true,
+ }),
+ ])
+ );
+
+ expect(icons(await render(indicator()))).toBe(0);
+ });
+
+ it('says nothing for a local agent, which has no host', async () => {
+ stores.plans.set('dev-vm', healthyPlan({ latestVersion: '0.8.0', updateAvailable: true }));
+
+ const el = await render(<HostTroubleIndicator sshHost={null} agentId="claude" />);
+
+ expect(icons(el)).toBe(0);
+ });
+});
+
+/**
+ * Priority. An available update is information; unreachable and setup-required
+ * are reasons the agent cannot work, and they win.
+ */
+describe('what the indicator shows first', () => {
+ it('reports the host being down rather than an available update', async () => {
+ stores.reachability.set('dev-vm', {
+ sshHost: 'dev-vm',
+ status: 'unreachable',
+ lastError: 'connection refused',
+ lastCheckedAt: null,
+ lastReachableAt: null,
+ consecutiveFailures: 3,
+ nextProbeAt: null,
+ probing: false,
+ });
+ stores.plans.set('dev-vm', healthyPlan({ latestVersion: '0.8.0', updateAvailable: true }));
+
+ const el = await render(indicator());
+
+ expect(shows(el, 'Host unavailable')).toBe(true);
+ expect(shows(el, 'Update available')).toBe(false);
+ });
+
+ it('reports missing setup rather than an available update', async () => {
+ stores.plans.set(
+ 'dev-vm',
+ plan([
+ step({ id: 'node', name: 'Node.js', state: 'pending', outcome: 'missing' }),
+ step({ id: 'claude', kind: 'agent-cli', name: 'Claude Code' }),
+ step({
+ id: 'claude:plugin',
+ kind: 'agent-plugin',
+ name: 'Switch connector',
+ latestVersion: '0.8.0',
+ updateAvailable: true,
+ dependsOn: ['claude'],
+ }),
+ ])
+ );
+
+ const el = await render(indicator());
+
+ expect(shows(el, 'Setup required')).toBe(true);
+ expect(shows(el, 'Update available')).toBe(false);
+ });
+});