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
fix(switchdash): refuse to create an agent for a type nobody checked (CHOO-1809)
Louis Amaudruze1e5fadaa090
diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-readiness-notice.tsx b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-readiness-notice.tsxindex cbc40b70f..3297b0b21 100644--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-readiness-notice.tsx+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-readiness-notice.tsx@@ -101,12 +101,32 @@ export const HostReadinessNotice = observer(function HostReadinessNotice({<div className="flex min-w-0 flex-col gap-1.5"><span><span className="font-medium">{sshHost}</span>{' '}- {readiness.scope === 'agent-type'- ? 'is ready, but is not set up for this agent type'- : 'is not set up to run agents'}- {readiness.missing.length > 0 ? `: ${readiness.missing.join(', ')} ` : ' '}- {readiness.missing.length === 1 ? 'is missing.' : 'are missing.'} An agent created here- would fail to start.+ {/*+ Two different messages, because "we looked and X is missing" and "we+ never looked" are different facts. Reading the second as the first+ invented a missing dependency; reading it as ready is what let an+ agent be created for a type nobody had checked for.+ */}+ {readiness.missing.length > 0 ? (+ <>+ {readiness.scope === 'agent-type'+ ? 'is ready, but is not set up for this agent type'+ : 'is not set up to run agents'}+ {`: ${readiness.missing.join(', ')} `}+ {readiness.missing.length === 1 ? 'is missing.' : 'are missing.'} An agent created+ here would fail to start.+ </>+ ) : readiness.scope === 'agent-type' ? (+ <>+ has never been checked for this agent type, so there is no telling whether it can run+ one. Check the host, then try again.+ </>+ ) : (+ <>+ has never been checked, so there is no telling whether it can run agents. Check the+ host, then try again.+ </>+ )}</span><Buttonsize="sm"diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-readiness.test.ts b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-readiness.test.tsindex e6449b80e..10ac56887 100644--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-readiness.test.ts+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-readiness.test.ts@@ -185,12 +185,43 @@ describe('resolveReadiness — the agent-creation gate', () => {expect(readiness.missing).toEqual(['node']);});- it('does not hold an unmanaged agent type against a ready host', () => {- // A type whose connector switchdash does not manage has no steps; there is- // nothing type-specific to satisfy, so the host's verdict stands.+ /**+ * Reversed deliberately (CHOO-1809). This previously asserted that a type+ * with no steps was "not held against a ready host", on the reading that+ * there was nothing type-specific to satisfy.+ *+ * That reading was wrong in the direction this whole gate exists to prevent.+ * No steps does not mean nothing to satisfy — it means nobody looked for+ * this type's CLI or its Switch connector. An agent whose connector is+ * absent starts and has no Switch tools, which is precisely the silent+ * failure being designed out. Louis hit it: a host reading Ready let an+ * agent be created for a type that was not set up on it.+ */+ it('refuses a type the plan has never looked for, even on a ready host', () => {const p = plan([step('git', 'satisfied')]);- expect(resolveReadiness(statusFor(p, 'mistral'), p, 'mistral', false).blocked).toBe(false);+ const readiness = resolveReadiness(statusFor(p, 'mistral'), p, 'mistral', false);++ expect(readiness.blocked).toBe(true);+ expect(readiness.scope).toBe('agent-type');+ });++ it('names nothing as missing when the truth is that nothing was checked', () => {+ // Listing a dependency here would invent a finding. The notice reads off+ // the empty list to say "never checked" rather than "X is missing".+ const p = plan([step('git', 'satisfied')]);++ expect(resolveReadiness(statusFor(p, 'mistral'), p, 'mistral', false).missing).toEqual([]);+ });++ it('still allows a type the plan checked and found complete', () => {+ const p = plan([+ step('git', 'satisfied'),+ step('claude', 'satisfied', 'agent-cli'),+ step('claude:plugin', 'satisfied', 'agent-plugin'),+ ]);++ expect(resolveReadiness(statusFor(p, 'claude'), p, 'claude', false).blocked).toBe(false);});});});diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-readiness.ts b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-readiness.tsindex eabfbb02a..2705bd755 100644--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-readiness.ts+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-readiness.ts@@ -8,6 +8,7 @@import type { HostStatus } from '@shared/core/remote-hosts/host-status';import {+ agentTypeSteps,outstandingRequiredHostSteps,outstandingRequiredStepsFor,type HostSetupPlan,@@ -57,6 +58,18 @@ export function resolveReadiness(): HostReadiness {if (!status) return READY;if (probing) return { blocked: false, checking: true, missing: [], scope: null };++ // A chosen agent type with no steps in the plan is one nobody has looked for.+ // `deriveAgentTypeStatus` falls back to the host's verdict there, which is+ // correct when describing the *host* and wrong as permission to create: it+ // means this type's CLI and connector were never checked. An agent whose+ // connector is absent starts with no Switch tools at all, which is the+ // failure this gate exists to prevent — and "we never looked" is not evidence+ // against it happening.+ if (status.kind === 'ready' && agentId && plan && agentTypeSteps(plan, agentId).length === 0) {+ return { blocked: true, checking: false, missing: [], scope: 'agent-type' };+ }+if (status.kind !== 'setup-required') return READY;if (!plan) return { blocked: true, checking: false, missing: [], scope: 'host' };