Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
feat(switchdash): re-check one dependency at a time, and detect Codex updates remotely (CHOO-1809)
Louis Amaudruze619f40ee6a5
diff --git a/dash/apps/switchdash-desktop/src/main/core/remote-hosts/controller.ts b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/controller.tsindex 033e58cb3..01347d12f 100644--- a/dash/apps/switchdash-desktop/src/main/core/remote-hosts/controller.ts+++ b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/controller.ts@@ -33,6 +33,7 @@ import {readAllSetupPlans,readSetupPlan,recheckSetup,+ recheckSetupStep,skipSetupStep,} from './setup/host-setup-service';import { listRemoteHosts, removeRemoteHost, upsertRemoteHost, type RemoteHost } from './store';@@ -215,6 +216,10 @@ export const remoteHostsController = createRPCController({/** Probe every step and install nothing — the "Re-check" button. */recheckSetup: (sshHost: string): Promise<HostSetupPlan> => recheckSetup(sshHost),+ /** Re-observe one prerequisite or agent type, installing nothing. */+ recheckSetupStep: (params: { sshHost: string; stepId: string }): Promise<HostSetupPlan> =>+ recheckSetupStep(params.sshHost, params.stepId),+/** Install one prerequisite or agent type on its own, then verify it. */installSetupStep: (params: { sshHost: string; stepId: string }): Promise<HostSetupPlan> =>installSetupStep(params.sshHost, params.stepId),diff --git a/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-runner.test.ts b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-runner.test.tsindex 64b527f93..fad5a2a06 100644--- a/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-runner.test.ts+++ b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-runner.test.ts@@ -52,6 +52,7 @@ function makeRunner(harness: Harness) {const saved: HostSetupPlan[] = [];const published: HostSetupPlan[] = [];const installOrder: string[] = [];+ const checkOrder: string[] = [];const inFlight = { count: 0, max: 0 };const runner = new HostSetupRunner({@@ -60,6 +61,7 @@ function makeRunner(harness: Harness) {save: async (p) => void saved.push(structuredClone(p)),publish: (p) => published.push(structuredClone(p)),check: async (s) => {+ checkOrder.push(s.id);const queue = harness.checks[s.id] ?? [{ outcome: 'satisfied' }];return queue.length > 1 ? queue.shift()! : queue[0]!;},@@ -78,7 +80,7 @@ function makeRunner(harness: Harness) {now: () => new Date('2026-02-02T00:00:00.000Z'),});- return { runner, saved, published, installOrder, inFlight };+ return { runner, saved, published, installOrder, checkOrder, inFlight };}const stateOf = (p: HostSetupPlan, id: string) => p.steps.find((s) => s.id === id)!.state;@@ -366,6 +368,129 @@ describe('checkAll — looking without touching', () => {});});+/**+ * The per-row re-check. `checkAll` costs an SSH round trip per step, which is a+ * lot to pay to answer "is this one thing still installed?".+ */+describe('checkStep — re-checking a single row', () => {+ it('probes only the step asked for', async () => {+ const { runner, checkOrder } = makeRunner({+ checks: { git: [{ outcome: 'satisfied' }], node: [{ outcome: 'missing' }] },+ installs: {},+ });++ await runner.checkStep(plan([step('git'), step('node')]), 'node');++ expect(checkOrder).toEqual(['node']);+ });++ it('installs nothing, whatever it finds', async () => {+ const { runner, installOrder } = makeRunner({+ checks: { node: [{ outcome: 'missing' }] },+ installs: {},+ });++ await runner.checkStep(plan([step('node')]), 'node');++ expect(installOrder).toEqual([]);+ });++ it('records what it saw and leaves the step pending, not failed', async () => {+ // Same distinction the whole-host re-check preserves: "checked, and absent"+ // is not "we tried to fix it and could not".+ const { runner } = makeRunner({ checks: { node: [{ outcome: 'missing' }] }, installs: {} });++ const result = await runner.checkStep(plan([step('node')]), 'node');++ expect(stateOf(result, 'node')).toBe('pending');+ expect(result.steps[0]!.outcome).toBe('missing');+ });++ it('marks a step that is genuinely there as satisfied', async () => {+ const { runner } = makeRunner({+ checks: { git: [{ outcome: 'satisfied', version: '2.43.0' }] },+ installs: {},+ });++ const result = await runner.checkStep(plan([step('git')]), 'git');++ expect(stateOf(result, 'git')).toBe('satisfied');+ expect(result.steps[0]!.version).toBe('2.43.0');+ });++ it('notices something that has gone away since it was last verified', async () => {+ // The question the button exists to answer.+ const { runner } = makeRunner({ checks: { git: [{ outcome: 'missing' }] }, installs: {} });++ const result = await runner.checkStep(+ plan([step('git', { state: 'satisfied', outcome: 'satisfied', version: '2.43.0' })]),+ 'git'+ );++ expect(stateOf(result, 'git')).toBe('pending');+ expect(result.steps[0]!.outcome).toBe('missing');+ });++ it('leaves every other step untouched', async () => {+ const { runner } = makeRunner({ checks: { git: [{ outcome: 'missing' }] }, installs: {} });++ const result = await runner.checkStep(+ plan([step('git'), step('node'), step('tmux', { state: 'satisfied' })]),+ 'git'+ );++ expect(stateOf(result, 'node')).toBe('pending');+ expect(stateOf(result, 'tmux')).toBe('satisfied');+ });++ it('supersedes a previous failure rather than leaving its error behind', async () => {+ const { runner } = makeRunner({+ checks: { node: [{ outcome: 'satisfied', version: '22.0.0' }] },+ installs: {},+ });++ const result = await runner.checkStep(+ plan([step('node', { state: 'failed', error: 'apt-get failed', output: 'E: broken' })]),+ 'node'+ );++ expect(result.steps[0]!.error).toBeNull();+ expect(result.steps[0]!.output).toBeNull();+ });++ it('reports the plan complete once the last outstanding step checks out', async () => {+ const { runner } = makeRunner({ checks: { node: [{ outcome: 'satisfied' }] }, installs: {} });++ const result = await runner.checkStep(+ plan([step('git', { state: 'satisfied' }), step('node')]),+ 'node'+ );++ expect(result.status).toBe('complete');+ });++ it('aborts as unreachable rather than reporting the step missing', async () => {+ const { runner } = makeRunner({ checks: {}, installs: {}, reachable: false });++ await expect(runner.checkStep(plan([step('git')]), 'git')).rejects.toBeInstanceOf(+ HostSetupAbortedError+ );+ });++ it('refuses to interleave with another operation on the same host', async () => {+ // The UI disables the buttons, but the runner is what actually guarantees it.+ const { runner } = makeRunner({ checks: { git: [{ outcome: 'satisfied' }] }, installs: {} });+ const p = plan([step('git')]);++ const [first, second] = await Promise.allSettled([+ runner.checkStep(p, 'git'),+ runner.checkAll(p),+ ]);++ expect([first!.status, second!.status].sort()).toEqual(['fulfilled', 'rejected']);+ });+});+describe('plan completion', () => {it('reports the plan complete once the last outstanding step is installed', async () => {const { runner } = makeRunner({diff --git a/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-runner.ts b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-runner.tsindex a011f1067..2d0217e9b 100644--- a/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-runner.ts+++ b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-runner.ts@@ -127,6 +127,50 @@ export class HostSetupRunner {}}+ /**+ * Observe ONE step, installing nothing — the per-item re-check.+ *+ * Same contract as `checkAll`, narrowed to a single step: a user asking "is+ * this still installed?" should not have to re-probe the whole host, which+ * costs an SSH round trip per step. An unsatisfied step is left `pending`+ * carrying its observed outcome, so the row can say "not installed" without+ * claiming an install was attempted.+ */+ async checkStep(plan: HostSetupPlan, stepId: string): Promise<HostSetupPlan> {+ if (this.running) {+ throw new Error(`Another setup operation is already running for ${this.deps.sshHost}`);+ }+ this.running = true;+ try {+ try {+ this.deps.requireReachable(this.deps.sshHost);+ } catch (error) {+ throw new HostSetupAbortedError(+ `Could not check ${this.deps.sshHost}: the host is not reachable.`,+ error+ );+ }++ let next = await this.patchStep(plan, stepId, {+ state: 'checking',+ error: null,+ output: null,+ });+ next = await this.observe(next, stepId);++ if (findStep(next, stepId).state !== 'satisfied') {+ next = await this.patchStep(next, stepId, { state: 'pending' });+ }++ return await this.transition(next, {+ status: isPlanComplete(next) ? 'complete' : 'idle',+ currentStepId: null,+ });+ } finally {+ this.running = false;+ }+ }+/*** Install ONE step on its own — the per-item Install button.*diff --git a/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-service.ts b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-service.tsindex f7bc36f02..e43cb51cd 100644--- a/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-service.ts+++ b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-service.ts@@ -242,6 +242,23 @@ export async function recheckSetup(sshHost: string): Promise<HostSetupPlan> {* Install one step on its own — the per-item Install button. Checks, installs,* and re-verifies just that step, leaving the rest of the plan alone.*/+/** Re-observe a single step, installing nothing — the per-row re-check. */+export async function recheckSetupStep(sshHost: string, stepId: string): Promise<HostSetupPlan> {+ const plan = await ensureSetupPlan(sshHost);+ const manager = await getRemoteDependencyManager(sshHost);+ try {+ return await runnerFor(sshHost, manager).checkStep(plan, stepId);+ } catch (error) {+ log.warn('[HostSetup] step re-check stopped', {+ event: 'host-setup-step-recheck-stopped',+ sshHost,+ stepId,+ error: String((error as Error)?.message ?? error),+ });+ throw error;+ }+}+export async function installSetupStep(sshHost: string, stepId: string): Promise<HostSetupPlan> {const plan = await ensureSetupPlan(sshHost);const manager = await getRemoteDependencyManager(sshHost);diff --git a/dash/apps/switchdash-desktop/src/main/core/switch-setup/remote-switch-setup.test.ts b/dash/apps/switchdash-desktop/src/main/core/switch-setup/remote-switch-setup.test.tsindex 414661bfb..b165ac21b 100644--- a/dash/apps/switchdash-desktop/src/main/core/switch-setup/remote-switch-setup.test.ts+++ b/dash/apps/switchdash-desktop/src/main/core/switch-setup/remote-switch-setup.test.ts@@ -121,9 +121,36 @@ function claudeExecImpl(installedVersion: string, advertisedVersion: string) {};}-function codexExecImpl(marketplaceSource: string) {- return (_bin: string, args: string[] = []) => {+const CODEX_MARKET_ROOT = '/home/dev/.codex/marketplaces/switch-plugins';++/** The two manifests the marketplace fallback reads, keyed by absolute path. */+function codexManifests(advertisedVersion: string): Record<string, string> {+ return {+ [`${CODEX_MARKET_ROOT}/.claude-plugin/marketplace.json`]: JSON.stringify({+ plugins: [{ name: 'switch-connector-codex', source: 'connectors/codex-plugin' }],+ }),+ [`${CODEX_MARKET_ROOT}/connectors/codex-plugin/.codex-plugin/plugin.json`]: JSON.stringify({+ version: advertisedVersion,+ }),+ };+}++function codexExecImpl(marketplaceSource: string, manifests: Record<string, string> = {}) {+ return (bin: string, args: string[] = []) => {const a = args.join(' ');+ if (bin === 'cat') {+ const body = manifests[args[0] ?? ''];+ if (body === undefined) {+ return Promise.reject(+ Object.assign(new Error('cat: No such file or directory'), {+ code: 1,+ stdout: '',+ stderr: 'cat: No such file or directory',+ })+ );+ }+ return Promise.resolve({ stdout: body, stderr: '' });+ }if (a === 'plugin list --json') {return Promise.resolve({stdout: JSON.stringify({@@ -149,7 +176,7 @@ function codexExecImpl(marketplaceSource: string) {marketplaces: [{name: 'switch-plugins',- root: '/home/dev/.codex/marketplaces/switch-plugins',+ root: CODEX_MARKET_ROOT,marketplaceSource: { sourceType: 'github', source: marketplaceSource },},],@@ -190,21 +217,86 @@ describe('RemoteSwitchSetupService.getStatus', () => {});});- it('issues exactly one plugin list and one marketplace list for codex', async () => {- // Codex advertises no versions, so an unknown latest is the correct answer —- // re-reading the plugin list to look for one would only cost another SSH exec.- mocks.exec.mockImplementation(codexExecImpl('sandbox-quantum/switch'));+ /**+ * Codex's marketplace listing carries no plugin versions, so the CLI alone can+ * never say whether an update exists. It does not follow that none does — the+ * versions are in the marketplace's manifests on the host, which is where the+ * local driver has always read them from.+ */+ describe('codex, whose CLI advertises no versions', () => {+ it('reads the advertised version from the marketplace manifests', async () => {+ mocks.exec.mockImplementation(+ codexExecImpl('sandbox-quantum/switch', codexManifests('0.2.0'))+ );++ const service = await getRemoteSwitchSetupService(SSH_HOST);+ const status = await service.getStatus('codex');++ expect(status).toMatchObject({+ supported: true,+ installed: true,+ installedVersion: '0.1.0',+ latestVersion: '0.2.0',+ updateAvailable: true,+ });+ });- const service = await getRemoteSwitchSetupService(SSH_HOST);- const status = await service.getStatus('codex');+ it('reports no update when the manifest matches what is installed', async () => {+ mocks.exec.mockImplementation(+ codexExecImpl('sandbox-quantum/switch', codexManifests('0.1.0'))+ );- expect(status).toMatchObject({- supported: true,- installed: true,- installedVersion: '0.1.0',- latestVersion: null,- updateAvailable: false,+ const service = await getRemoteSwitchSetupService(SSH_HOST);++ expect(await service.getStatus('codex')).toMatchObject({+ latestVersion: '0.1.0',+ updateAvailable: false,+ });});++ it('reports the latest version as unknown when the manifests cannot be read', async () => {+ // Unreadable manifests mean we do not know, which must not be rendered as+ // "up to date" — the stale-green this surface exists to avoid.+ mocks.exec.mockImplementation(codexExecImpl('sandbox-quantum/switch'));++ const service = await getRemoteSwitchSetupService(SSH_HOST);+ const status = await service.getStatus('codex');++ expect(status).toMatchObject({+ installed: true,+ installedVersion: '0.1.0',+ latestVersion: null,+ updateAvailable: false,+ });+ });++ it('reads each manifest once and does not re-read the plugin list', async () => {+ mocks.exec.mockImplementation(+ codexExecImpl('sandbox-quantum/switch', codexManifests('0.2.0'))+ );++ const service = await getRemoteSwitchSetupService(SSH_HOST);+ await service.getStatus('codex');++ expect(calls()).toEqual([+ 'plugin list --json',+ 'plugin marketplace list --json',+ `${CODEX_MARKET_ROOT}/.claude-plugin/marketplace.json`,+ `${CODEX_MARKET_ROOT}/connectors/codex-plugin/.codex-plugin/plugin.json`,+ ]);+ });+ });++ it('does not read manifests when the CLI already advertises versions', async () => {+ // Claude Code reports them in `marketplace list --json`, so the fallback is+ // dead weight there — two SSH round trips per status read.+ mocks.getPlugin.mockReturnValue(CLAUDE_AGENT);+ mocks.resolveCommandPath.mockResolvedValue('/usr/bin/claude');+ mocks.exec.mockImplementation(claudeExecImpl('0.1.0', '0.2.0'));++ const service = await getRemoteSwitchSetupService(SSH_HOST);+ await service.getStatus('claude');+expect(calls()).toEqual(['plugin list --json', 'plugin marketplace list --json']);});});diff --git a/dash/apps/switchdash-desktop/src/main/core/switch-setup/remote-switch-setup.ts b/dash/apps/switchdash-desktop/src/main/core/switch-setup/remote-switch-setup.tsindex 26474ccf2..a93da5211 100644--- a/dash/apps/switchdash-desktop/src/main/core/switch-setup/remote-switch-setup.ts+++ b/dash/apps/switchdash-desktop/src/main/core/switch-setup/remote-switch-setup.ts@@ -12,6 +12,20 @@ const EXEC_TIMEOUT_MS = 120_000;type RunResult = { code: number; stdout: string; stderr: string };+/**+ * Join path segments for the remote host, which is POSIX regardless of what+ * switchdash is running on. `node:path`'s `join` would emit backslashes on a+ * Windows desktop and the `cat` would fail on the host.+ */+function posixJoin(...segments: string[]): string {+ return segments+ .map((segment, index) =>+ index === 0 ? segment.replace(/\/+$/, '') : segment.replace(/^\/+|\/+$/g, '')+ )+ .filter((segment) => segment.length > 0)+ .join('/');+}+function unsupported(agentId: string): SwitchSetupStatus {return {agentId,@@ -59,10 +73,14 @@ function parseJsonLoose(stdout: string): unknown {* Remote counterpart of SwitchSetupService: drives an agent type's* plugin-marketplace CLI (`<bin> plugin ...`) on an SSH host to manage its* Switch connector plugin, taking the host's verbs, flags and JSON shapes from- * the same dialect table the local driver uses. Versions come from the CLI's own- * JSON output (not on-disk manifests) so no SFTP round-trips are needed — which- * is why a dialect that advertises no versions (Codex) reports "unknown" here- * rather than "up to date".+ * the same dialect table the local driver uses.+ *+ * Advertised versions come from the CLI's JSON where the dialect reports them,+ * and otherwise from the marketplace's on-disk manifests — the same two files+ * the local driver reads, fetched with `cat` over the exec channel already+ * open. This used to stop at the CLI output, so Codex — whose marketplace+ * listing carries no plugin versions — could never report an available update+ * on a remote host, even though the manifests were sitting there.*/export class RemoteSwitchSetupService {constructor(private readonly ctx: SshExecutionContext) {}@@ -110,10 +128,13 @@ export class RemoteSwitchSetupService {}/**- * Advertised version from CLI output alone — no SFTP round-trip to read- * manifests. Null means "unknown", which callers must not read as up to date;- * a dialect that does not report versions for uninstalled plugins always- * returns null here.+ * The version the marketplace advertises, or null when it genuinely cannot be+ * determined — which callers must not read as "up to date".+ *+ * Preferred source is the CLI's own JSON, which costs nothing extra. Codex+ * does not report versions there, so fall back to the marketplace manifests+ * on the host: the same path the local driver takes, and dialect-agnostic+ * because each dialect names its own manifest directories.*/private async advertisedVersion(bin: string,@@ -122,9 +143,38 @@ export class RemoteSwitchSetupService {rules: SwitchSetupCliRules): Promise<string | null> {const { stdout } = await this.run(bin, ['plugin', 'marketplace', 'list', '--json']);- return (- rules.parseAdvertisedVersions(parseJsonLoose(stdout), marketplaceName).get(pluginName) ?? null+ const parsed = parseJsonLoose(stdout);++ const fromCli = rules.parseAdvertisedVersions(parsed, marketplaceName).get(pluginName);+ if (fromCli) return fromCli;++ const market = rules+ .parseMarketplaceList(parsed)+ .find((m) => m.name === marketplaceName && m.root !== null);+ if (!market?.root) return null;++ const manifest = await this.readRemoteJson<{+ plugins?: Array<{ name?: string; source?: string }>;+ }>(posixJoin(market.root, rules.marketplaceManifestDir, 'marketplace.json'));+ const entry = manifest?.plugins?.find((p) => p.name === pluginName);+ if (!entry?.source) return null;++ const pluginManifest = await this.readRemoteJson<{ version?: string }>(+ posixJoin(market.root, entry.source, rules.pluginManifestDir, 'plugin.json'));+ return pluginManifest?.version ?? null;+ }++ /**+ * Read and parse a JSON file on the host. Null for anything that did not+ * produce parseable JSON — a missing manifest is an ordinary outcome here+ * (the marketplace may be laid out differently, or not checked out yet), and+ * the caller already treats null as "unknown" rather than as a version.+ */+ private async readRemoteJson<T>(path: string): Promise<T | null> {+ const res = await this.run('cat', [path]);+ if (res.code !== 0) return null;+ return (parseJsonLoose(res.stdout) as T | null) ?? null;}/**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.tsxindex 0f7378e71..f182db1c3 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@@ -7,7 +7,15 @@* for detail — so a host reads like the rest of the product.*/-import { GitBranch, Github, KeyRound, Package, Server, SquareTerminal } from 'lucide-react';+import {+ GitBranch,+ Github,+ KeyRound,+ Package,+ RefreshCw,+ Server,+ SquareTerminal,+} from 'lucide-react';import { Loader2 } from 'lucide-react';import { AgentIcon } from '@renderer/lib/components/agent-icon';import { Button } from '@renderer/lib/ui/button';@@ -106,6 +114,43 @@ function Row({);}+/**+ * Re-observe just this row.+ *+ * Always offered, including on a satisfied row: "is this still installed?" is a+ * fair question about something that was verified at some point in the past,+ * and answering it host-wide costs an SSH round trip per step. Disabled while+ * any host-level operation is in flight, so a whole-host re-check and a single+ * row cannot race for the runner.+ */+function RecheckAction({+ rechecking,+ disabled,+ label,+ onRecheck,+}: {+ rechecking: boolean;+ disabled: boolean;+ label: string;+ onRecheck: () => void;+}) {+ return (+ <Button+ size="icon-sm"+ variant="ghost"+ disabled={disabled || rechecking}+ aria-label={`Re-check ${label}`}+ title={`Re-check ${label}`}+ onClick={(event) => {+ event.stopPropagation();+ onRecheck();+ }}+ >+ <RefreshCw className={cn('size-3.5', rechecking && 'animate-spin')} />+ </Button>+ );+}+/** The inline Install / Retry control, shown only when there is something to do. */function InstallAction({step,@@ -143,9 +188,12 @@ export function PrerequisiteRow({plan,isCurrent,installing,+ rechecking,+ hostBusy,activity,authenticating,onInstall,+ onRecheck,onAuthenticate,onOpen,}: {@@ -154,10 +202,14 @@ export function PrerequisiteRow({plan: HostSetupPlan | null;isCurrent: boolean;installing: boolean;+ rechecking: boolean;+ /** True while any operation is running on this host. */+ hostBusy: boolean;activity: string | null;/** True while the sign-in terminal for this step is already open. */authenticating: boolean;onInstall: () => void;+ onRecheck: () => void;onAuthenticate: () => void;onOpen: () => void;}) {@@ -170,23 +222,33 @@ export function PrerequisiteRow({badge={stepBadge(step)}highlighted={isCurrent}action={- // Signing in is this row's install: it is the one action that makes the- // step satisfied, so it belongs beside it rather than one click away- // inside the detail sheet.- canSignIn(step, plan) ? (- <Button- size="xs"- disabled={authenticating}- onClick={(event) => {- event.stopPropagation();- onAuthenticate();- }}- >- {signInLabel(step)}- </Button>- ) : (- <InstallAction step={step} installing={installing} onInstall={onInstall} />- )+ <>+ <RecheckAction+ rechecking={rechecking}+ disabled={hostBusy}+ label={step.name}+ onRecheck={onRecheck}+ />+ {/*+ Signing in is this row's install: it is the one action that makes the+ step satisfied, so it belongs beside it rather than one click away+ inside the detail sheet.+ */}+ {canSignIn(step, plan) ? (+ <Button+ size="xs"+ disabled={authenticating}+ onClick={(event) => {+ event.stopPropagation();+ onAuthenticate();+ }}+ >+ {signInLabel(step)}+ </Button>+ ) : (+ <InstallAction step={step} installing={installing} onInstall={onInstall} />+ )}+ </>}onClick={onOpen}/>@@ -197,16 +259,25 @@ export function AgentTypeRowItem({row,isCurrent,installingStepId,+ rechecking,+ hostBusy,activityFor,onInstall,+ onRecheck,onOpen,}: {row: AgentTypeRow;isCurrent: boolean;installingStepId: string | null;+ /** True while either of this row's two steps is being re-checked. */+ rechecking: boolean;+ /** True while any operation is running on this host. */+ hostBusy: boolean;/** A row covers two steps, so it asks per step which one is talking. */activityFor: (stepId: string) => string | null;onInstall: (stepId: string) => void;+ /** Re-checks both of the row's steps — it presents them as one thing. */+ onRecheck: () => void;onOpen: () => void;}) {// Fix whichever half is outstanding: the CLI first, then its connector. One@@ -225,13 +296,21 @@ export function AgentTypeRowItem({badge={agentTypeBadge(row)}highlighted={isCurrent}action={- next ? (- <InstallAction- step={next}- installing={installingStepId === next.id}- onInstall={() => onInstall(next.id)}+ <>+ <RecheckAction+ rechecking={rechecking}+ disabled={hostBusy}+ label={row.name}+ onRecheck={onRecheck}/>- ) : null+ {next ? (+ <InstallAction+ step={next}+ installing={installingStepId === next.id}+ onInstall={() => onInstall(next.id)}+ />+ ) : null}+ </>}onClick={onOpen}/>diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/use-host-setup.ts b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/use-host-setup.tsindex 90dea4697..9f94acb7d 100644--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/use-host-setup.ts+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/use-host-setup.ts@@ -90,6 +90,21 @@ export function useRecheckSetup(sshHost: string) {});}+/**+ * Re-observe one step on its own — the per-row re-check button.+ *+ * Whole-host re-check costs an SSH round trip per step, which is a lot to pay+ * to answer "is this one still installed?".+ */+export function useRecheckSetupStep(sshHost: string) {+ const queryClient = useQueryClient();+ return useMutation({+ mutationFn: (stepId: string) => rpc.remoteHosts.recheckSetupStep({ sshHost, stepId }),+ onSuccess: (plan) => queryClient.setQueryData(setupPlanQueryKey(sshHost), plan),+ onError: (error) => log.error('Could not re-check a setup step', { sshHost, error }),+ });+}+/** Install one step on its own — the per-row Install button. */export function useInstallSetupStep(sshHost: string) {const queryClient = useQueryClient();diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/views/remote-host-view.tsx b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/views/remote-host-view.tsxindex a550c769e..5a12a2296 100644--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/views/remote-host-view.tsx+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/views/remote-host-view.tsx@@ -41,12 +41,13 @@ import {PrerequisiteRow,SectionLabel,} from '../setup/setup-rows';-import { groupPlanSteps } from '../setup/step-presentation';+import { groupPlanSteps, type AgentTypeRow } from '../setup/step-presentation';import {useHostSetupPlan,useInstallSetupStep,usePrepareSetup,useRecheckSetup,+ useRecheckSetupStep,useSkipSetupStep,} from '../setup/use-host-setup';import { REMOTE_HOSTS_QUERY_KEY } from './remote-hosts-view';@@ -70,6 +71,7 @@ export const RemoteHostMainPanel = observer(function RemoteHostMainPanel() {const recheck = useRecheckSetup(sshHost);const skip = useSkipSetupStep(sshHost);const installStep = useInstallSetupStep(sshHost);+ const recheckStep = useRecheckSetupStep(sshHost);const [authenticatingGh, setAuthenticatingGh] = useState(false);const [sheetTarget, setSheetTarget] = useState<SheetTarget | null>(null);@@ -95,9 +97,24 @@ export const RemoteHostMainPanel = observer(function RemoteHostMainPanel() {() => groupPlanSteps(plan.data ?? null),[plan.data]);- const busy = prepare.isPending || recheck.isPending || installStep.isPending;+ const busy =+ prepare.isPending || recheck.isPending || installStep.isPending || recheckStep.isPending;const installingStepId = installStep.isPending ? (installStep.variables ?? null) : null;+ const recheckingStepId = recheckStep.isPending ? (recheckStep.variables ?? null) : null;const currentStepId = plan.data?.currentStepId ?? null;++ // An agent type is presented as one thing, so its re-check covers both of its+ // steps. Sequential because the runner takes one operation per host at a time+ // — firing them together would only make the second fail.+ const recheckAgentType = async (row: AgentTypeRow) => {+ try {+ await recheckStep.mutateAsync(row.cli.id);+ if (row.plugin) await recheckStep.mutateAsync(row.plugin.id);+ } catch {+ // The mutation's onError already reports it; this only stops the second+ // step running after the first failed.+ }+ };// Read inside render so mobx tracks it: the line changes several times a// second while an install runs, and nothing else re-renders on that.const activityFor = (stepId: string) => hostSetupStore.activityFor(sshHost, stepId);@@ -200,9 +217,12 @@ export const RemoteHostMainPanel = observer(function RemoteHostMainPanel() {plan={plan.data ?? null}isCurrent={step.id === currentStepId}installing={installingStepId === step.id}+ rechecking={recheckingStepId === step.id}+ hostBusy={busy}activity={activityFor(step.id)}authenticating={authenticatingGh && step.kind === 'gh-auth'}onInstall={() => installStep.mutate(step.id)}+ onRecheck={() => recheckStep.mutate(step.id)}onAuthenticate={() => setAuthenticatingGh(true)}onOpen={() => setSheetTarget({ kind: 'prerequisite', step })}/>@@ -240,8 +260,14 @@ export const RemoteHostMainPanel = observer(function RemoteHostMainPanel() {row.cli.id === currentStepId || row.plugin?.id === currentStepId}installingStepId={installingStepId}+ rechecking={+ recheckingStepId === row.cli.id ||+ (row.plugin != null && recheckingStepId === row.plugin.id)+ }+ hostBusy={busy}activityFor={activityFor}onInstall={(stepId) => installStep.mutate(stepId)}+ onRecheck={() => void recheckAgentType(row)}onOpen={() => setSheetTarget({ kind: 'agent-type', row })}/></div>diff --git a/dash/apps/switchdash-desktop/src/renderer/tests/browser/remote-host-prerequisite-row.test.tsx b/dash/apps/switchdash-desktop/src/renderer/tests/browser/remote-host-prerequisite-row.test.tsxindex 9f2d5f701..e38d04e78 100644--- a/dash/apps/switchdash-desktop/src/renderer/tests/browser/remote-host-prerequisite-row.test.tsx+++ b/dash/apps/switchdash-desktop/src/renderer/tests/browser/remote-host-prerequisite-row.test.tsx@@ -77,16 +77,23 @@ async function render(node: React.ReactNode): Promise<HTMLDivElement> {return container;}-function row(auth: HostSetupStep, ghState: HostSetupStep['state'] = 'satisfied') {+function row(+ auth: HostSetupStep,+ ghState: HostSetupStep['state'] = 'satisfied',+ overrides: { hostBusy?: boolean; rechecking?: boolean; onRecheck?: () => void } = {}+) {return (<PrerequisiteRowstep={auth}plan={planWith(auth, ghState)}isCurrent={false}installing={false}+ rechecking={overrides.rechecking ?? false}+ hostBusy={overrides.hostBusy ?? false}activity={null}authenticating={false}onInstall={() => {}}+ onRecheck={overrides.onRecheck ?? (() => {})}onAuthenticate={() => {}}onOpen={() => {}}/>@@ -97,6 +104,10 @@ function buttonLabels(el: HTMLElement): string[] {return [...el.querySelectorAll('button')].map((b) => b.textContent?.trim() ?? '');}+function recheckButton(el: HTMLElement): HTMLButtonElement | null {+ return el.querySelector('button[aria-label^="Re-check"]');+}+describe('the GitHub login row', () => {it('offers Sign in on the row itself, not only inside the sheet', async () => {const el = await render(row(step({})));@@ -136,3 +147,59 @@ describe('the GitHub login row', () => {expect(buttonLabels(el)).not.toContain('Install');});});++/**+ * Re-checking one row exists because the whole-host re-check costs an SSH round+ * trip per step, which is a lot to pay to answer "is this one still there?".+ */+describe('the per-row re-check', () => {+ it('is offered on a row that still needs work', async () => {+ const el = await render(row(step({})));++ expect(recheckButton(el)).not.toBeNull();+ });++ it('is offered on a satisfied row too — that is the question it answers', async () => {+ // "Is this still installed?" is fair to ask of something verified at some+ // point in the past, and it is the only way to find out short of re-probing+ // the entire host.+ const el = await render(+ row(step({ state: 'satisfied', outcome: 'satisfied', version: 'amaudruz' }))+ );++ expect(recheckButton(el)).not.toBeNull();+ });++ it('calls back with the row it belongs to', async () => {+ const onRecheck = vi.fn();+ const el = await render(row(step({}), 'satisfied', { onRecheck }));++ await act(async () => recheckButton(el)!.click());++ expect(onRecheck).toHaveBeenCalledTimes(1);+ });++ it('is disabled while the host is already doing something', async () => {+ // One operation per host at a time: a whole-host re-check and a single row+ // would otherwise race for the runner, and the loser reports an error that+ // reads like the dependency's fault.+ const el = await render(row(step({}), 'satisfied', { hostBusy: true }));++ expect(recheckButton(el)!.disabled).toBe(true);+ });++ it('does not fire while the host is busy', async () => {+ const onRecheck = vi.fn();+ const el = await render(row(step({}), 'satisfied', { hostBusy: true, onRecheck }));++ await act(async () => recheckButton(el)!.click());++ expect(onRecheck).not.toHaveBeenCalled();+ });++ it('is disabled while this row is the one being re-checked', async () => {+ const el = await render(row(step({}), 'satisfied', { rechecking: true }));++ expect(recheckButton(el)!.disabled).toBe(true);+ });+});