Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Routines: warn when a routine's bot is paused, with a way to swap it

Milind Sonie8e1f256b57e
diff --git a/src/components/bot-panel/pages.tsx b/src/components/bot-panel/pages.tsx
index 5e84d10425..478ead718a 100644
--- a/src/components/bot-panel/pages.tsx
+++ b/src/components/bot-panel/pages.tsx
@@ -139,6 +139,7 @@ export function RoutinesPage({ bot, derived }: PageContext) {
<RoutineList
routines={derived.botRoutines}
runs={state.routineRuns}
+ pausedBots={state.config?.pausedBots}
loading={state.routinesLoadState === "loading" && derived.botRoutines.length === 0}
error={state.routinesLoadState === "error"}
onOpen={setEditing}
diff --git a/src/components/bot-settings/RoutinesSection.tsx b/src/components/bot-settings/RoutinesSection.tsx
index d113d90fc0..9cf470cca4 100644
--- a/src/components/bot-settings/RoutinesSection.tsx
+++ b/src/components/bot-settings/RoutinesSection.tsx
@@ -17,7 +17,7 @@ export function RoutinesSection({ bot, routines, runs, defaultRunOn }: { bot: Bo
<button type="button" onClick={() => dispatch({ type: "showRoutines", section: "logs", botId: bot.id })} className="flex items-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[12px] text-ink hover:bg-raised-hover"><FileText size={13} />{t("routines.logs")}</button>
</div>
</div>
- <RoutineList routines={routines} runs={runs} loading={state.routinesLoadState === "loading" && routines.length === 0} error={state.routinesLoadState === "error"} onOpen={setEditing} onLogs={(routine) => dispatch({ type: "showRoutines", section: "logs", botId: bot.id, routineId: routine.id })} onToggle={(routine) => dispatch({ type: "updateRoutine", routineId: routine.id, patch: { enabled: !routine.enabled } })} />
+ <RoutineList routines={routines} runs={runs} pausedBots={state.config?.pausedBots} loading={state.routinesLoadState === "loading" && routines.length === 0} error={state.routinesLoadState === "error"} onOpen={setEditing} onLogs={(routine) => dispatch({ type: "showRoutines", section: "logs", botId: bot.id, routineId: routine.id })} onToggle={(routine) => dispatch({ type: "updateRoutine", routineId: routine.id, patch: { enabled: !routine.enabled } })} />
<button type="button" onClick={() => dispatch({ type: "showRoutines", section: "schedule", view: "list", botId: bot.id })} className="self-start text-[12px] text-accent hover:underline">{t("computer.routines.openTitle")} <ChevronRight size={14} aria-hidden="true" className="inline align-[-2px] rtl:-scale-x-100" /></button>
{editing && <RoutineEditor key={bot.id} routine={editing === "new" ? undefined : editing} bots={[bot]} lockedBotId={bot.id} defaultRunOn={defaultRunOn} onClose={() => setEditing(null)} />}
</div>;
diff --git a/src/components/routines/RoutineList.tsx b/src/components/routines/RoutineList.tsx
index fd25e13338..3f7cd25739 100644
--- a/src/components/routines/RoutineList.tsx
+++ b/src/components/routines/RoutineList.tsx
@@ -1,4 +1,5 @@
import { FileText, Loader2, Repeat2 } from "lucide-react";
+import { showBotLimit } from "@/lib/bot-limit";
import { cn } from "@/lib/cn";
import { t } from "@/lib/i18n";
import type { Routine, RoutineRun } from "@/lib/routines";
@@ -7,10 +8,12 @@ import { latestRoutineRun, routineDateTime, routineFinished, routineHeldNote, ro
import type { Bot } from "@/state/store";
import { Switch } from "../SettingsPrimitives";
-export function RoutineList({ routines, runs, bots, loading, error, onOpen, onLogs, onToggle }: {
+export function RoutineList({ routines, runs, bots, pausedBots, loading, error, onOpen, onLogs, onToggle }: {
routines: Routine[];
runs: RoutineRun[];
bots?: Bot[];
+ /** Bots a Starter Cloud has paused: a routine on one runs nothing until it is swapped in. */
+ pausedBots?: readonly string[];
loading?: boolean;
error?: boolean;
onOpen: (routine: Routine) => void;
@@ -48,6 +51,10 @@ export function RoutineList({ routines, runs, bots, loading, error, onOpen, onLo
{!!routine.failureStreak && <p className="mt-2 text-[12px] text-danger">{t("routines.failureStreak", { count: routine.failureStreak })}</p>}
{routine.weekRuns && <p className="mt-2 text-[12px] text-ink-secondary">{t(routine.weekRuns.total === 1 ? "routines.weekRunsOne" : "routines.weekRuns", routine.weekRuns)}</p>}
{routine.warning && <p className="mt-2 text-[12px] leading-relaxed text-warning">{routine.warning}</p>}
+ {routine.enabled && pausedBots?.includes(routine.botId) && <p className="mt-2 text-[12px] leading-relaxed text-warning" data-routine-bot-paused="">
+ {t("routines.botPaused")}{" "}
+ <button type="button" className="cursor-pointer text-accent hover:underline" onClick={() => showBotLimit("paused")}>{t("routines.botPausedSwap")}</button>
+ </p>}
{routine.heldFor && <p className="mt-2 text-[12px] leading-relaxed text-ink-secondary">{routineHeldNote(routine)}</p>}
{!!routine.skippedRuns && <p className="mt-2 text-[12px] text-ink-secondary">
{t("routines.skippedRuns", { count: routine.skippedRuns })}
diff --git a/src/components/routines/RoutineViews.test.ts b/src/components/routines/RoutineViews.test.ts
index fc9b64d0e5..e1f7cb5f99 100644
--- a/src/components/routines/RoutineViews.test.ts
+++ b/src/components/routines/RoutineViews.test.ts
@@ -19,6 +19,15 @@ function list(props: Partial<Parameters<typeof RoutineList>[0]> = {}) {
afterEach(() => vi.useRealTimers());
describe("routine list", () => {
+ it("warns on an enabled routine whose bot is paused, with a way to swap it in", () => {
+ const paused = list({ pausedBots: ["scout"] });
+ expect(paused).toContain("bot is paused on this plan, so it won&#x27;t run.");
+ expect(paused).toContain("Swap awake bots");
+ expect(list({ pausedBots: ["scout"], routines: [{ ...routine, enabled: false }] })).not.toContain("Swap awake bots");
+ expect(list({ pausedBots: ["other"] })).not.toContain("Swap awake bots");
+ expect(list()).not.toContain("Swap awake bots");
+ });
+
it("shows saved skips and recent failure streaks without claiming all offline occurrences were counted", () => {
const markup = list({ routines: [{ ...routine, skippedRuns: 3, lastSkippedAt: 100, failureStreak: 2 }] });
expect(markup).toContain("Scheduled occurrences skipped while busy: 3");
diff --git a/src/locales/en.json b/src/locales/en.json
index 1354da1a07..a27d8793b7 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -5024,6 +5024,8 @@
"computer.tab.computer": "Screen",
"computer.tab.routines": "Routines",
"routines.list": "Routine list",
+ "routines.botPaused": "This routine's bot is paused on this plan, so it won't run.",
+ "routines.botPausedSwap": "Swap awake bots",
"routines.logs": "Run logs",
"routines.results.label": "Post results to",
"routines.results.keep": "Keep current destination",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 3cc07ce43b..23858e43f3 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -4759,6 +4759,8 @@
"computer.tab.computer": "Tela",
"computer.tab.routines": "Rotinas",
"routines.list": "Lista de rotinas",
+ "routines.botPaused": "O bot desta rotina está pausado neste plano, então ela não será executada.",
+ "routines.botPausedSwap": "Trocar bots ativos",
"routines.logs": "Registros",
"routines.results.label": "Publicar resultados em",
"routines.results.keep": "Manter o destino atual",