Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Calendar: a room goal whose room is gone cannot be saved, and a run keeps its own group
Caleb Arumugam3f2a56786328
diff --git a/src/components/RoutineCalendarPage.dialogs.test.ts b/src/components/RoutineCalendarPage.dialogs.test.tsindex 6104a07438..42ca4d47e3 100644--- a/src/components/RoutineCalendarPage.dialogs.test.ts+++ b/src/components/RoutineCalendarPage.dialogs.test.ts@@ -2,7 +2,7 @@ import { Children, createElement, isValidElement, type ReactElement, type ReactNimport { renderToStaticMarkup } from "react-dom/server";import { afterAll, beforeEach, describe, expect, it, vi } from "vitest";import type { Bot } from "@/state/store";-import type { Routine } from "../../shared/routines";+import type { Routine, RoutineRun } from "../../shared/routines";const fixture = vi.hoisted(() => {vi.stubGlobal("window", {});@@ -23,7 +23,7 @@ vi.mock("./DesktopCapabilities", async (importOriginal) => ({vi.mock("@/lib/analytics", () => ({ track: vi.fn() }));const { t } = await import("@/lib/i18n");-const { EventDetails, PausedList } = await import("./RoutineCalendarPage");+const { EventDetails, EventEditor, PausedList } = await import("./RoutineCalendarPage");const bot = {id: "runner", threadId: "execution", name: "Runner", title: "", description: "", color: "green",@@ -103,6 +103,17 @@ describe("calendar event details drawer", () => {expect(html).not.toContain("Open group");});+ it("shows a goal run that had no group as the bot's own, even after the routine was given a room", () => {+ const roomGoal: Routine = { ...routine, target: "room-goal", groupId: "room" };+ const run: RoutineRun = { id: "run", routineId: roomGoal.id, routineName: roomGoal.name, target: "room-goal", botId: bot.id, runOn: "maus", scheduledFor: 1, status: "running", manual: false, createdAt: 1 };+ const html = renderToStaticMarkup(createElement(() => EventDetails({+ item: { kind: "routine", id: roomGoal.id, at: 1, durationMinutes: 30, routine: roomGoal, run },+ bots: [bot], onClose: vi.fn(), onEdit: vi.fn(), onCallChanged: vi.fn(), onOpenRoom: vi.fn(),+ })));+ expect(html).toContain("Runner");+ expect(html).not.toContain("Group unavailable");+ });+it("names its close button", () => {const onClose = vi.fn();const close = render(() => drawer(onClose)).find((node) => node.type === "button" && node.props["aria-label"] === t("routines.drawer.close"));@@ -111,3 +122,15 @@ describe("calendar event details drawer", () => {expect(onClose).toHaveBeenCalledOnce();});});++describe("calendar event editor", () => {+ it("cannot save a room goal whose room is gone until another room is chosen", () => {+ const orphaned: Routine = { ...routine, target: "room-goal", groupId: "gone" };+ const html = renderToStaticMarkup(createElement(() => EventEditor({+ seed: { kind: "routine", at: 1, durationMinutes: 30, botIds: [bot.id], routine: orphaned },+ bots: [bot], onClose: vi.fn(), onSavedCall: vi.fn(),+ })));+ expect(html).toContain("Room no longer exists");+ expect(html).toMatch(/<button[^>]*\bdisabled=""[^>]*>(?:(?!<\/button>).)*Save<\/button>/s);+ });+});diff --git a/src/components/RoutineCalendarPage.tsx b/src/components/RoutineCalendarPage.tsxindex ff1f80f1a3..bcd4cdf996 100644--- a/src/components/RoutineCalendarPage.tsx+++ b/src/components/RoutineCalendarPage.tsx@@ -542,7 +542,7 @@ export function EventEditor({&& (kind === "call"? botIds.length > 0: routineTarget === "room-goal"- ? botIds[0] && roomMembers.some((bot) => bot.id === botIds[0])+ ? (!groupId || selectedRoom) && botIds[0] && roomMembers.some((bot) => bot.id === botIds[0]): botIds.length > 0)&& !intervalInvalid&& !intervalDaysInvalid@@ -923,7 +923,7 @@ export function EventEditor({<div><label htmlFor="routine-goal-room" className="mb-2 block text-[13px] font-medium text-ink">{t("routines.editor.goalWhere")}</label><Select id="routine-goal-room" value={groupId} onChange={(event) => selectRoom(event.target.value)} className="w-full">- <option value="">{t("routines.editor.goalOneOnOne")}</option>+ {groupId && !selectedRoom && <option value={groupId} disabled>Room no longer exists. Choose another.</option>}<option value="">{t("routines.editor.goalOneOnOne")}</option>{rooms.map((room) => <option key={room.id} value={room.id}>{room.name}</option>)}</Select></div>@@ -1319,7 +1319,7 @@ export function EventDetails({: submittedRun && (state.routineRuns.find((candidate) => candidate.id === submittedRun.id) ?? submittedRun);const call = item.kind === "call" ? item.call : null;const isRoomGoal = !isCall && (run?.target ?? routine?.target) === "room-goal";- const goalGroupId = isRoomGoal ? run?.groupId ?? routine?.groupId : undefined;+ const goalGroupId = isRoomGoal ? (run ? run.groupId : routine?.groupId) : undefined;const goalGroup = state.groups.find((group) => group.id === goalGroupId);const executionThreadId = run?.executionThreadId ?? run?.threadId;const botIds = call?.botIds ?? [run?.botId ?? routine?.botId ?? ""];