Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
feat(routines): let the server's environment set the default run limit
David Neyra7963f67b2b37
diff --git a/docs/routine-schedules.md b/docs/routine-schedules.mdindex adc5edc7b2..8423bdd69d 100644--- a/docs/routine-schedules.md+++ b/docs/routine-schedules.md@@ -252,7 +252,8 @@ use an appropriate event/webhook workflow instead of a fake weekly schedule.questions were open. Without one, the default applies to every run, whetherthe schedule, an event or **Run now** started it: 3 hours of work for abot's run, 12 hours for a room goal's run (which stays running across every- member's turn). Work is the time the run spent running since its current+ member's turn). A server whose routines run longer may set another default+ (`OMB_ROUTINE_RUN_LIMIT_HOURS`). Work is the time the run spent running since its currentstart: the time it is queued (behind a busy bot, for its one retry, for ausage limit's reset) and the time it waits (on your approval or answer, on aconversation left with you, on work it handed to teammates) is not in it.diff --git a/docs/self-hosting.md b/docs/self-hosting.mdindex 7ccfe8ec86..64462c42e2 100644--- a/docs/self-hosting.md+++ b/docs/self-hosting.md@@ -1853,6 +1853,12 @@ routine's run row, or in the Chief's "Problems to look at" chat.| `OMB_STARTUP_ROUTINE_GAP_MS` | `1800000` (30 minutes) | On a server not started by the desktop app, how soon after the start that last ran them routines set to "Also run when OpenMausBot starts" may run again. A start within that time leaves one row per routine: "Not run at 4 starts because OpenMausBot started again soon after the start that last ran it". `0` runs them at every start. || `OMB_ROUTINE_RESTART_STAGGER_MS` | `30000` (30 seconds) | The time between the runs a restart cut off as each starts again, so they do not all start at once. From `0`. || `OMB_BURST_PART_MAX_RESTARTS` | `2` | The times a burst's part, or its merge, starts again after a restart cut it off. Past that the part fails with "Not started again: OpenMausBot restarted while this part ran 3 times.", and the parts are posted as they came instead of merged. From `0`. |+| `OMB_ROUTINE_RUN_LIMIT_HOURS` | `3` | The hours of work a routine run may do when its routine sets no limit of its own. From `1` to `24`. |+| `OMB_ROUTINE_GOAL_RUN_LIMIT_HOURS` | `12` | The same for a room goal's run, which stays running across every member's turn. From `1` to `24`. |++A run stops when it has worked for its limit, and names it: "Stopped: this run+ran longer than the 3-hour limit". A routine that sets a limit of its own keeps+it, whatever the server's environment says.A routine every minute (`* * * * *`) is still accepted and is spaced out thesame way. Identical failures are told to you and to the Chief once: twodiff --git a/packages/phone-protocol/src/routines.ts b/packages/phone-protocol/src/routines.tsindex 9386da0849..31324ea897 100644--- a/packages/phone-protocol/src/routines.ts+++ b/packages/phone-protocol/src/routines.ts@@ -109,6 +109,13 @@ export type RoutineRetryCause = "stalled" | "restarted" | "rate_limited" | "prov* not been acknowledged. */export const ROUTINE_PROBLEM_STATUSES: readonly RoutineRunStatus[] = ["failed", "missed"];+/** The limits the server applies to the runs that set none of their own: the minutes of work a bot's run may do,+ * and the same for a room goal's run, which stays running across every member's turn. */+export interface RoutineRunLimits {+ runMinutes: number;+ goalMinutes: number;+}+/** Minutes of work a run may do when its routine sets no limit of its own: a bot's run, and a room goal's run, which* stays running across every member's turn. */export const ROUTINE_RUN_LIMIT_MINUTES = 180;diff --git a/server/index.ts b/server/index.tsindex 2785c558d7..0c8411c175 100644--- a/server/index.ts+++ b/server/index.ts@@ -436,7 +436,7 @@ import { claudeUserSkillsEnabled } from "./turn-settings.ts";import { addHeldSecretScrubber, redactSecretsInText, scrubHeldSecrets } from "./redact.ts";import * as vps from "./vps-computer.ts";import { vpsConfigForBot, vpsSshAliasForBot } from "./vps-hosts.ts";-import { ROUTINE_RESTARTED, RoutineManager, type Routine, type RoutineRun, type RoutineRunOn, type RoutineRunTrigger } from "./routines.ts"; import { routineModelRefusal, routineThreadModel, type RoutineModelChecks } from "./routine-input.ts"; import { routineHistoryFor, routineRunsFor } from "./routine-run-window.ts"; import { runTurnLive } from "./routine-turn-live.ts"; import { batchSaves, flushLaterSaves } from "./save-batch.ts";+import { ROUTINE_RESTARTED, RoutineManager, type Routine, type RoutineRun, type RoutineRunOn, type RoutineRunTrigger } from "./routines.ts"; import { routineModelRefusal, routineThreadModel, type RoutineModelChecks } from "./routine-input.ts"; import { routineHistoryFor, routineRunsFor } from "./routine-run-window.ts"; import { routineRunLimits } from "./routine-run-limits.ts"; import { runTurnLive } from "./routine-turn-live.ts"; import { batchSaves, flushLaterSaves } from "./save-batch.ts";import { CalendarCallManager, type CalendarCall } from "./calendar-calls.ts";import { BROWSER_UPLOAD_TOOL, browserRuntimeEnv } from "./browser-runtime.ts";import { BrowserUploadRefusal, uploadableFiles } from "./browser-upload.ts";@@ -14414,6 +14414,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {return json(res, 200, {routines: routines!.listRoutines().filter((routine) => routineVisible(routine, visible)).map((routine) => routineForViewer(routine, visible)),runs: routineRunsFor((from, to) => routines!.listRuns(from, to), url.searchParams).filter((run) => routineRunVisible(run, visible)), ...routineHistoryFor(routines!, url.searchParams, (routine) => routineVisible(routine, visible)),+ runLimits: routineRunLimits(),});}const routineBodyRefusal = (body: unknown, existing?: Routine): { status: number; error: string } | null => {diff --git a/server/routine-bounds.test.ts b/server/routine-bounds.test.tsindex 3192242187..916266bf8e 100644--- a/server/routine-bounds.test.ts+++ b/server/routine-bounds.test.ts@@ -19,7 +19,7 @@ const passes = (row: RoutineRun, clock: RunClock, from: number, to: number) => {return over;};-afterEach(() => { vi.useRealTimers(); vi.restoreAllMocks(); });+afterEach(() => { vi.useRealTimers(); vi.restoreAllMocks(); vi.unstubAllEnvs(); });describe("the work a run has done", () => {it("is added up pass by pass while it is running, from its start", () => {@@ -72,6 +72,21 @@ describe("the run limit", () => {expect(runOverLimit(row, clock, 3 * HOUR)).toEqual({ text: "Stopped: this run ran longer than the 3-hour limit", codes: { errorCode: "routines.server.overLimit", errorParams: { hours: 3 } } });});+ it("stops a bot's run at the limit the environment names", () => {+ vi.stubEnv("OMB_ROUTINE_RUN_LIMIT_HOURS", "6");+ const row = run(), clock = new RunClock();+ clock.from(row, "workedMs", 0);+ expect(passes(row, clock, MINUTE, 6 * HOUR - MINUTE)).toBeNull();+ expect(runOverLimit(row, clock, 6 * HOUR)).toEqual({ text: "Stopped: this run ran longer than the 6-hour limit", codes: { errorCode: "routines.server.overLimit", errorParams: { hours: 6 } } });+ });++ it("keeps a routine's own limit when the environment names another default", () => {+ vi.stubEnv("OMB_ROUTINE_RUN_LIMIT_HOURS", "6");+ const own = run({ timeoutMinutes: 10 }), clock = new RunClock();+ expect(runOverLimit(own, clock, 10 * MINUTE)).toEqual({ text: "Stopped after reaching the 10-minute run limit", codes: { errorCode: "routines.server.overOwnLimit", errorParams: { minutes: 10 } } });+ expect(runLimitAt(own, 5 * MINUTE)).toBe(10 * MINUTE);+ });+it("gives a room goal's run, which stays running across its members' turns, twelve hours", () => {expect(ROUTINE_GOAL_RUN_LIMIT_MINUTES).toBe(720);const row = run({ target: "room-goal" }), clock = new RunClock();diff --git a/server/routine-bounds.ts b/server/routine-bounds.tsindex a28d62ecc2..523eaa772b 100644--- a/server/routine-bounds.ts+++ b/server/routine-bounds.ts@@ -2,10 +2,10 @@// scheduled run queued behind its busy bot is given up after an hour, and stopping a turn never keeps the scheduler// from its other routines. Each ends with its reason on the run's row. The work and the busy wait are added up one// scheduler pass at a time, each step capped, so the hours a computer slept, or a clock that jumped, are in neither.-import { ROUTINE_GOAL_RUN_LIMIT_MINUTES, ROUTINE_RUN_LIMIT_MINUTES } from "../shared/routines.ts";import { DUE_CLOCK_MS } from "./due-timer.ts";import { codedLine, type RoutineLine } from "./routine-lines.ts";import { ROUTINE_BUSY_WAIT_MS } from "./routine-recovery.ts";+import { routineRunLimits, type RoutineRunLimits } from "./routine-run-limits.ts";import { activeMs } from "./routine-waits.ts";import type { RoutineManagerOptions, RoutineRun } from "./routines.ts";@@ -60,26 +60,26 @@ export class RunClock {}type Started = Pick<RoutineRun, "status" | "startedAt" | "timeoutMinutes" | "waitedMs" | "workedMs" | "asked" | "target">;-const defaultLimitMs = (run: Pick<RoutineRun, "target">) => (run.target === "room-goal" ? ROUTINE_GOAL_RUN_LIMIT_MINUTES : ROUTINE_RUN_LIMIT_MINUTES) * 60_000;+const defaultLimitMs = (run: Pick<RoutineRun, "target">, limits: RoutineRunLimits) => (run.target === "room-goal" ? limits.goalMinutes : limits.runMinutes) * 60_000;const started = (run: Started) => run.startedAt != null && (run.status === "running" || run.status === "waiting");/** When the scheduler must next look at a started run: when a routine's own limit is reached, or, under the default* limit, at the next step of counting its work. Null while neither applies (it is not started, it waits under the* default limit, or a request of its own is open, which no limit counts). */-export function runLimitAt(run: Started, now: number): number | null {+export function runLimitAt(run: Started, now: number, limits = routineRunLimits()): number | null {if (!started(run)) return null;if (run.timeoutMinutes != null) return run.asked ? null : now + Math.max(0, run.timeoutMinutes * 60_000 - activeMs(run, now));- return run.status === "running" ? now + Math.min(COUNT_STEP_MS, Math.max(0, defaultLimitMs(run) - (run.workedMs ?? 0))) : null;+ return run.status === "running" ? now + Math.min(COUNT_STEP_MS, Math.max(0, defaultLimitMs(run, limits) - (run.workedMs ?? 0))) : null;}/** Counts this pass's work for a running run, and says why a started run must stop now; null while it is within its* limit. A routine's own limit counts as it always has (`activeMs`: the time since the run started, less its open* approvals and questions). The default one counts work only, so it never ends a run that waits. */-export function runOverLimit(run: RoutineRun, clock: RunClock, now: number): RoutineLine | null {+export function runOverLimit(run: RoutineRun, clock: RunClock, now: number, limits = routineRunLimits()): RoutineLine | null {if (!started(run)) return null;const worked = run.status === "running" ? clock.count(run, "workedMs", now) : run.workedMs ?? 0;if (run.timeoutMinutes != null) return activeMs(run, now) >= run.timeoutMinutes * 60_000 ? codedLine("error", "routines.server.overOwnLimit", { minutes: run.timeoutMinutes }) : null;- return run.status === "running" && worked >= defaultLimitMs(run) ? codedLine("error", "routines.server.overLimit", { hours: defaultLimitMs(run) / 3_600_000 }) : null;+ return run.status === "running" && worked >= defaultLimitMs(run, limits) ? codedLine("error", "routines.server.overLimit", { hours: defaultLimitMs(run, limits) / 3_600_000 }) : null;}/** A queued run that cannot start because its bot is busy. While `counts` (a scheduled occurrence, not one of checkeddiff --git a/server/routine-requests.ts b/server/routine-requests.tsindex 45e30f5e43..8e7d43f0f0 100644--- a/server/routine-requests.ts+++ b/server/routine-requests.ts@@ -1,7 +1,7 @@import { instructionsUpdateRefusal } from "./automation-instructions.ts";import { createHash } from "node:crypto";import { isDeepStrictEqual } from "node:util";-import { ROUTINE_RUN_LIMIT_MINUTES } from "../shared/routines.ts";+import { routineRunLimits } from "./routine-run-limits.ts";import { formatInstant, routineCronText } from "./routine-cron-text.ts";import { conversationLanguage, serverLine } from "./server-lines.ts";import { plainClock, plainTimeZone, plainWeekdays } from "../shared/plain-time-zone.ts";@@ -677,7 +677,7 @@ function cardCopy(// Credential-shaped values never travel back through the bot's MCP response or into the transcript.const visibleInstructions = redactSecretsInText(definition.instructions);const runLimit = definition.timeoutMinutes === undefined- ? `default run limit (${ROUTINE_RUN_LIMIT_MINUTES / 60} hours of work)`+ ? `default run limit (${routineRunLimits().runMinutes / 60} hours of work)`: `${definition.timeoutMinutes} min limit`;return {title,diff --git a/server/routine-run-limits.test.ts b/server/routine-run-limits.test.tsnew file mode 100644index 0000000000..a3b3dbcfd9--- /dev/null+++ b/server/routine-run-limits.test.ts@@ -0,0 +1,25 @@+import { describe, expect, it } from "vitest";++import { ROUTINE_GOAL_RUN_LIMIT_MINUTES, ROUTINE_RUN_LIMIT_MINUTES } from "../shared/routines.ts";+import { routineRunLimits } from "./routine-run-limits.ts";++describe("the limit a routine run works under", () => {+ it("is three hours of work, and twelve for a room goal, when the environment says nothing", () => {+ expect(ROUTINE_RUN_LIMIT_MINUTES).toBe(180);+ expect(ROUTINE_GOAL_RUN_LIMIT_MINUTES).toBe(720);+ expect(routineRunLimits({})).toEqual({ runMinutes: 180, goalMinutes: 720 });+ });++ it("is what the environment names, in whole hours", () => {+ expect(routineRunLimits({ OMB_ROUTINE_RUN_LIMIT_HOURS: "6" })).toEqual({ runMinutes: 360, goalMinutes: 720 });+ expect(routineRunLimits({ OMB_ROUTINE_RUN_LIMIT_HOURS: "6", OMB_ROUTINE_GOAL_RUN_LIMIT_HOURS: "18" })).toEqual({ runMinutes: 360, goalMinutes: 1080 });+ expect(routineRunLimits({ OMB_ROUTINE_RUN_LIMIT_HOURS: " 8 " })).toEqual({ runMinutes: 480, goalMinutes: 720 });+ });++ it("keeps the defaults for anything that is not a whole number of hours in range", () => {+ for (const raw of ["0", "-2", "2.5", "25", "six", "", " "]) {+ expect(routineRunLimits({ OMB_ROUTINE_RUN_LIMIT_HOURS: raw })).toEqual({ runMinutes: 180, goalMinutes: 720 });+ expect(routineRunLimits({ OMB_ROUTINE_GOAL_RUN_LIMIT_HOURS: raw })).toEqual({ runMinutes: 180, goalMinutes: 720 });+ }+ });+});diff --git a/server/routine-run-limits.ts b/server/routine-run-limits.tsnew file mode 100644index 0000000000..c2d3680fd7--- /dev/null+++ b/server/routine-run-limits.ts@@ -0,0 +1,25 @@+// The limit a routine run works under when its routine sets no limit of its own: three hours of work for a bot's+// run, and twelve for a room goal's, which stays running across every member's turn. A server whose routines run+// longer may raise them (OMB_ROUTINE_RUN_LIMIT_HOURS, OMB_ROUTINE_GOAL_RUN_LIMIT_HOURS); a routine that sets a+// limit of its own keeps it, so the environment moves only the runs that set none.+import { ROUTINE_GOAL_RUN_LIMIT_MINUTES, ROUTINE_RUN_LIMIT_MINUTES, type RoutineRunLimits } from "../shared/routines.ts";+import { envWhole } from "./env-limits.ts";++/** The longest limit the environment may name, in hours: the longest a routine may set for itself (1,440 minutes). */+export const RUN_LIMIT_HOURS_MAX = 24;++/** The hours the environment names, or the default: a whole number of hours, never more than the longest limit a+ * routine may set for itself. */+const limitHours = (raw: string | undefined, fallback: number): number => {+ const hours = envWhole(raw, fallback, 1);+ return hours <= RUN_LIMIT_HOURS_MAX ? hours : fallback;+};++/** OMB_ROUTINE_RUN_LIMIT_HOURS and OMB_ROUTINE_GOAL_RUN_LIMIT_HOURS: whole hours from 1 to 24, as a routine's own+ * limit may be; anything else leaves the default. */+export function routineRunLimits(env: NodeJS.ProcessEnv = process.env): RoutineRunLimits {+ return {+ runMinutes: limitHours(env.OMB_ROUTINE_RUN_LIMIT_HOURS, ROUTINE_RUN_LIMIT_MINUTES / 60) * 60,+ goalMinutes: limitHours(env.OMB_ROUTINE_GOAL_RUN_LIMIT_HOURS, ROUTINE_GOAL_RUN_LIMIT_MINUTES / 60) * 60,+ };+}diff --git a/src/components/RoutineCalendarPage.tsx b/src/components/RoutineCalendarPage.tsxindex e92e284c3c..bfab6e9806 100644--- a/src/components/RoutineCalendarPage.tsx+++ b/src/components/RoutineCalendarPage.tsx@@ -766,7 +766,7 @@ export function EventEditor({)}</>);- const defaultRunLimit = durationLabel(isRoomGoal ? ROUTINE_GOAL_RUN_LIMIT_MINUTES : ROUTINE_RUN_LIMIT_MINUTES), runLimitControls = kind === "routine" && (+ const defaultRunLimit = durationLabel(isRoomGoal ? (state.routineRunLimits?.goalMinutes ?? ROUTINE_GOAL_RUN_LIMIT_MINUTES) : (state.routineRunLimits?.runMinutes ?? ROUTINE_RUN_LIMIT_MINUTES)), runLimitControls = kind === "routine" && (<details className="rounded-xl border border-hairline/40 bg-inset/40 px-3 py-2.5"><summary className="cursor-pointer select-none text-[12px] font-medium text-ink-secondary hover:text-ink">{timeoutMinutes == null ? t("routines.runLimit.none", { duration: defaultRunLimit }) : t("routines.runLimit.some", { duration: durationLabel(timeoutMinutes) })}@@ -1468,7 +1468,7 @@ export function EventDetails({)}{!isCall && !isRoomGoal && <DrawerField label={t("routines.results.label")}><div className="text-[13px] text-ink">{resultsTitle}</div></DrawerField>}{attachments.length > 0 && <DrawerField label={t("routines.drawer.attachments")}><AttachmentChips attachments={attachments} />{call && <div className="mt-1.5 text-[11px] leading-relaxed text-ink-secondary">{t(call.botIds.length > 1 ? "routines.drawer.callSharedHelp" : "routines.drawer.callKeptHelp")}</div>}</DrawerField>}- {advanced && !isCall && <DrawerField label={t("routines.drawer.runLimit")}><div className="text-[13px] text-ink">{safetyLimit == null ? t("routines.drawer.noTimeLimit", { duration: durationLabel(isRoomGoal ? ROUTINE_GOAL_RUN_LIMIT_MINUTES : ROUTINE_RUN_LIMIT_MINUTES) }) : t("routines.drawer.stopsAfter", { duration: durationLabel(safetyLimit) })}</div></DrawerField>}+ {advanced && !isCall && <DrawerField label={t("routines.drawer.runLimit")}><div className="text-[13px] text-ink">{safetyLimit == null ? t("routines.drawer.noTimeLimit", { duration: durationLabel(isRoomGoal ? (state.routineRunLimits?.goalMinutes ?? ROUTINE_GOAL_RUN_LIMIT_MINUTES) : (state.routineRunLimits?.runMinutes ?? ROUTINE_RUN_LIMIT_MINUTES)) }) : t("routines.drawer.stopsAfter", { duration: durationLabel(safetyLimit) })}</div></DrawerField>}{!isCall && (<DrawerField label={t("routines.logs")} action={routine && <button type="button" onClick={() => { dispatch({ type: "showRoutines", section: "logs", routineId: routine.id, botId: routine.botId }); onClose(); }} className="flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] text-accent-text hover:bg-raised"><FileText size={11} />{t("routines.drawer.allRuns")}</button>}>{recentRuns.length === 0diff --git a/src/lib/routines.ts b/src/lib/routines.tsindex 0c0c5a69f5..74820e960e 100644--- a/src/lib/routines.ts+++ b/src/lib/routines.ts@@ -12,4 +12,4 @@ export type {RoutineRun,RoutineInput,} from "../../shared/routines";-export { ROUTINE_GOAL_RUN_LIMIT_MINUTES, ROUTINE_HANDOFF_WAIT, ROUTINE_PROBLEM_STATUSES, ROUTINE_RUN_LIMIT_MAX_MINUTES, ROUTINE_RUN_LIMIT_MINUTES, isCountedSkip, isRoutineProblemRun, type RoutineRunStatusFilter } from "../../shared/routines";+export { ROUTINE_GOAL_RUN_LIMIT_MINUTES, ROUTINE_HANDOFF_WAIT, ROUTINE_PROBLEM_STATUSES, ROUTINE_RUN_LIMIT_MAX_MINUTES, ROUTINE_RUN_LIMIT_MINUTES, isCountedSkip, isRoutineProblemRun, type RoutineRunLimits, type RoutineRunStatusFilter } from "../../shared/routines";diff --git a/src/state/store.tsx b/src/state/store.tsxindex 3f491d43de..1b745fd2e6 100644--- a/src/state/store.tsx+++ b/src/state/store.tsx@@ -45,7 +45,7 @@ import {skillRequestBehavior,type SkillRequestCardData,} from "../../shared/skill-request";-import type { Routine, RoutineInput, RoutineRun, RoutineRunStatusFilter } from "@/lib/routines";+import type { Routine, RoutineInput, RoutineRun, RoutineRunLimits, RoutineRunStatusFilter } from "@/lib/routines";import type { WebhookAttempt, WebhookIngressStatus, WebhookTrigger } from "@/lib/webhooks";import { duplicateBotProfile, restrictedCopyRequest } from "@/lib/bot-duplicate";import { markVisibleBotThreadsRead, markVisibleGroupThreadsRead } from "./read-visible";@@ -510,7 +510,7 @@ export interface AppState {activeView: "chat" | "team-map" | "routines" | "files" | "web-panel" | "published-apps" | "team-files" | "announcements";/** Folders a finished move left on this computer, for Files to offer sharing. */filesSuggest: string[] | null; webPanelId?: string;- routines: Routine[];+ routines: Routine[]; routineRunLimits?: RoutineRunLimits;routineRuns: RoutineRun[];routinesLoadState: "loading" | "ready" | "error"; routineRunsSince: number | null;routinesFocus: { section?: "schedule" | "logs"; view?: "calendar" | "list"; botId?: string; routineId?: string; runStatus?: RoutineRunStatusFilter; nonce: number };@@ -593,7 +593,7 @@ export type Action =| { type: "showTeamMap" } | { type: "showPublishedApps" } | { type: "showTeamFiles" } | { type: "showAnnouncements" } | { type: "showWebPanel"; id: string }| { type: "showFiles"; suggest?: string[] }| { type: "showChat" }- | { type: "routinesHydrated"; routines: Routine[]; runs: RoutineRun[]; since?: number }+ | { type: "routinesHydrated"; routines: Routine[]; runs: RoutineRun[]; since?: number; runLimits?: RoutineRunLimits }| { type: "routinesLoadFailed" } | { type: "routineRunsLoaded"; runs: RoutineRun[]; from?: number; to?: number }| { type: "routinePatched"; routine: Routine }| { type: "routineDeleted"; routineId: string }@@ -951,7 +951,7 @@ export function reducer(state: AppState, action: Action): AppState {settingsOpen: false, computerOpen: false, inspectorOpen: false, activityOpen: false, appSettingsOpen: false, pluginsOpen: false,};case "routinesHydrated":- return { ...state, routines: action.routines, routineRuns: trimRoutineRuns(action.runs), routineRunsSince: action.since ?? null, routinesLoadState: "ready" };+ return { ...state, routines: action.routines, routineRuns: trimRoutineRuns(action.runs), routineRunsSince: action.since ?? null, routinesLoadState: "ready", routineRunLimits: action.runLimits };case "routinesLoadFailed":return { ...state, routinesLoadState: "error" };case "routinePatched": {@@ -2898,8 +2898,8 @@ export function StoreProvider({ children }: { children: ReactNode }) {{key: "routines",request: async () => {- const since = Date.now() - ROUTINE_RUNS_WINDOW_MS, { routines, runs } = snapshotArrays(await api(`/api/routines?since=${since}`), "routines", "runs");- return () => rawDispatch({ type: "routinesHydrated", routines, runs, since });+ const since = Date.now() - ROUTINE_RUNS_WINDOW_MS, answer = await api(`/api/routines?since=${since}`), { routines, runs } = snapshotArrays(answer, "routines", "runs");+ return () => rawDispatch({ type: "routinesHydrated", routines, runs, since, runLimits: answer.runLimits });},},{