The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Round dial: leave the Swarm face when the desktop goes to another tab (#2204)
0xdiego253364a68b6f49
diff --git a/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c b/devices/harness-device/firmware/main/ui/habitat/ui_habitat.cindex fced4cc35..483198412 100644--- a/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c+++ b/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c@@ -4841,11 +4841,21 @@ static void swarms_apply(void)if (changed && (workspace.touching || s.view == TABS)) input_cancel();s.tab_count=bounded;if (bounded) memcpy(s.tabs,rows,(size_t)bounded*sizeof *rows);+ char was[ID_MAX];+ COPY(was,s.selected_tab);COPY(s.selected_tab,selected);// The desktop closed the desk tab of the Swarm on the face: the dial leaves it too, for TABS on the app's tab.if (swarm_mode() && sw.desk[0] && workspace_index(sw.desk) < 0) {swarm_leave();if (s.view == HOME || s.view == AGENT || s.view == AGENTS) tabs_open();+ } else if (swarm_mode() && sw.desk[0] && selected_changed && !strcmp(was, sw.desk) && s.selected_tab[0] &&+ !s.voice_open && (s.view == HOME || s.view == AGENT || s.view == AGENTS)) {+ // The desktop went from the Swarm's desk tab to another (Diego's dial, 2026-10-29): the dial follows it onto+ // that tab's panes, as it follows the desktop in. It stayed on the Swarm face until that desk tab was closed;+ // the daemon's focus for the new tab only moves `s.active`, which a Swarm face never shows. Only FROM the desk+ // tab: right after the dial's own pick the desktop has not moved yet, and a frame naming its old tab is no move.+ swarm_leave();+ view(HOME);} else {swarm_desk_note();}@@ -5025,8 +5035,9 @@ void ui_supertab_focus(const char *tab, const char *lead)if (t && (i >= 0 || !lead[0]) && free) {if (swarm_mode() && !strcmp(sw.tab, tab)) {if (i >= 0 && strcmp(sw.lead, lead)) swarm_show(t, i, false);- } else if (!swarm_mode() && t->tab[0] && swarm_may_follow()) {- // The desktop opened this Swarm's tab: the dial goes in with it, or as soon as the `swarms` frame says so.+ } else if (t->tab[0] && swarm_may_follow()) {+ // The desktop opened this Swarm's tab: the dial goes in with it, or as soon as the `swarms` frame says so. From+ // another Swarm too: that frame takes the dial out of the one it is in first (swarms_apply).if (!strcmp(s.selected_tab, t->tab)) swarm_enter(t, lead, false);else COPY(sw.pending, tab);}diff --git a/devices/harness-device/firmware/test/test_touch_ui.py b/devices/harness-device/firmware/test/test_touch_ui.pyindex 51bf0c875..44f4630d2 100644--- a/devices/harness-device/firmware/test/test_touch_ui.py+++ b/devices/harness-device/firmware/test/test_touch_ui.py@@ -1660,6 +1660,30 @@ static void swarm_pane_checks(const char *dir) {// The window going to another tab first spends it.swarm_leave(); ui_swarms_replace(rows, 3, "t0"); ui_supertab_focus("s1", "L3");ui_swarms_replace(rows, 3, "t2"); ui_swarms_replace(rows, 3, "t1"); assert(!swarm_mode());+ // Diego's dial, 2026-10-29: the window leaving the Swarm's desk tab for another takes the dial out with it,+ // onto that tab's panes. It used to stay on the Swarm face until its desk tab was closed.+ ui_swarms_replace(rows, 3, "t0"); ui_supertab_focus("s1", "L2"); ui_swarms_replace(rows, 3, "t1");+ assert(swarm_mode() && !strcmp(sw.desk, "t1"));+ s.view = AGENTS; ui_swarms_replace(rows, 3, "t0"); assert(!swarm_mode() && s.view == HOME);+ // Not while talking or answering: the face keeps its recipient, as a focus does.+ ui_supertab_focus("s1", "L2"); ui_swarms_replace(rows, 3, "t1"); assert(swarm_mode());+ s.voice_open = true; ui_swarms_replace(rows, 3, "t0"); assert(swarm_mode()); s.voice_open = false;+ swarm_leave(); ui_supertab_focus("s1", "L2"); ui_swarms_replace(rows, 3, "t1"); assert(swarm_mode());+ s.view = QUESTION; ui_swarms_replace(rows, 3, "t0"); assert(swarm_mode());+ // A frame that keeps the same tab, or names none, leaves the face alone.+ s.view = HOME; swarm_leave(); ui_supertab_focus("s1", "L2"); ui_swarms_replace(rows, 3, "t1");+ ui_swarms_replace(rows, 3, "t1"); assert(swarm_mode()); ui_swarms_replace(rows, 3, ""); assert(swarm_mode());+ // Only from the Swarm's own desk tab: a frame still naming another tab, just after the dial's own pick and before+ // the desktop moved, keeps the face (review of #2204).+ swarm_leave(); ui_swarms_replace(rows, 3, "t0"); enter_at("s1", "L2");+ assert(swarm_mode() && !strcmp(sw.desk, "t1") && !strcmp(s.selected_tab, "t0"));+ ui_swarms_replace(rows, 3, "t2"); assert(swarm_mode() && !strcmp(sw.tab, "s1"));+ ui_swarms_replace(rows, 3, "t1"); assert(swarm_mode() && !strcmp(sw.tab, "s1"));+ // The desktop from one Swarm's desk tab to another's: its focus comes first, then the frame, and the dial ends on+ // that Swarm's face, not on a plain HOME.+ card_begin("s2", "t2", "playground"); card_lead("P0", "sandbox", "claude", "h9", "work", 0, 12); card_send();+ ui_supertab_focus("s2", "P0"); assert(!strcmp(sw.tab, "s1"));+ ui_swarms_replace(rows, 3, "t2"); assert(swarm_mode() && !strcmp(sw.tab, "s2") && !strcmp(sw.lead, "P0"));}// The side button: STOP for a busy Lead on this computer (its harness id), HOME for a remote one.swarm_setup(); enter_at("s1", "L0"); ui_boot_pressed(); assert(s.view == STOP && !strcmp(s.stop_agent, "h0"));