Skip to content

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

fix(switchdash): clear the agent type when the run location changes (CHOO-1809)

Louis Amaudruz1f30671d31fe
diff --git a/dash/apps/switchdash-desktop/src/renderer/features/locations/components/add-agent-modal/add-agent-modal.tsx b/dash/apps/switchdash-desktop/src/renderer/features/locations/components/add-agent-modal/add-agent-modal.tsx
index b52a0b871..fc2fda7ab 100644
--- a/dash/apps/switchdash-desktop/src/renderer/features/locations/components/add-agent-modal/add-agent-modal.tsx
+++ b/dash/apps/switchdash-desktop/src/renderer/features/locations/components/add-agent-modal/add-agent-modal.tsx
@@ -157,12 +157,21 @@ export const AddAgentModal = observer(function AddAgentModal({ onClose }: AddLoc
}
}, [allowedHosts, runHost]);
- // Reset the remote working dir when the run host changes so a committed dir
- // from a previous host does not leak into discovery for the new one.
+ // Everything chosen below the run location belongs to the machine it was
+ // chosen on, so changing machines clears it.
+ //
+ // The working directory is the obvious case — a path from one host means
+ // nothing on another. The agent type is the one that bit: availability is
+ // per-machine, so picking Codex locally and then switching to a host without
+ // Codex left Codex selected, and the form went on looking valid for a choice
+ // the new machine cannot honour. Clearing it sends the picker back through
+ // its own availability check for the host now selected.
+ const { setProviderId } = pickState;
useEffect(() => {
setRemoteRepoDir('');
setRemoteRepoDirDraft('');
- }, [runHost]);
+ setProviderId(null);
+ }, [runHost, setProviderId]);
// Advanced definition attributes (model, effort, tools, system prompt, …) the
// user set in the collapsed Advanced section. Held in a ref (not state) so the