Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): scope library "Scheduled" status to the user's own schedule (#13419)

Krzysztof Czerwinski630432f268f1
diff --git a/autogpt_platform/frontend/src/app/(platform)/library/__tests__/filter.test.tsx b/autogpt_platform/frontend/src/app/(platform)/library/__tests__/filter.test.tsx
index ea522caf1c..d8329e0deb 100644
--- a/autogpt_platform/frontend/src/app/(platform)/library/__tests__/filter.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/library/__tests__/filter.test.tsx
@@ -121,6 +121,40 @@ describe("LibraryAgentList — Scheduled status filter", () => {
});
});
+ test("excludes agents that only have recommended_schedule_cron (not actually scheduled by the user) from the scheduled filter", async () => {
+ setupHandlers([
+ makeAgent({
+ id: "a-recommendation-only",
+ graph_id: "g-recommendation-only",
+ name: "Recommendation Only Agent",
+ is_scheduled: false,
+ recommended_schedule_cron: "0 9 * * *",
+ }),
+ ]);
+
+ renderList("scheduled");
+
+ await waitFor(() => {
+ expect(screen.queryByText("Recommendation Only Agent")).toBeNull();
+ });
+ });
+
+ test("includes agents that only have recommended_schedule_cron in the idle filter", async () => {
+ setupHandlers([
+ makeAgent({
+ id: "a-recommendation-only",
+ graph_id: "g-recommendation-only",
+ name: "Recommendation Only Agent",
+ is_scheduled: false,
+ recommended_schedule_cron: "0 9 * * *",
+ }),
+ ]);
+
+ renderList("idle");
+
+ expect(await screen.findByText("Recommendation Only Agent")).toBeDefined();
+ });
+
test("excludes idle agents (no schedule, no recommendation) from the scheduled filter", async () => {
setupHandlers([
makeAgent({
diff --git a/autogpt_platform/frontend/src/app/(platform)/library/hooks/executionHelpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/library/hooks/executionHelpers.test.ts
index 44644c1369..ee37f957e8 100644
--- a/autogpt_platform/frontend/src/app/(platform)/library/hooks/executionHelpers.test.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/library/hooks/executionHelpers.test.ts
@@ -3,48 +3,22 @@ import { isAgentScheduled } from "./executionHelpers";
describe("isAgentScheduled", () => {
it("returns true when is_scheduled is set", () => {
- expect(
- isAgentScheduled({ is_scheduled: true, recommended_schedule_cron: null }),
- ).toBe(true);
+ expect(isAgentScheduled({ is_scheduled: true })).toBe(true);
});
- it("returns true when recommended_schedule_cron is a non-empty string", () => {
- expect(
- isAgentScheduled({
- is_scheduled: false,
- recommended_schedule_cron: "0 9 * * *",
- }),
- ).toBe(true);
+ it("returns false when is_scheduled is false", () => {
+ expect(isAgentScheduled({ is_scheduled: false })).toBe(false);
});
- it("returns true when both flags are set", () => {
- expect(
- isAgentScheduled({
- is_scheduled: true,
- recommended_schedule_cron: "0 9 * * *",
- }),
- ).toBe(true);
- });
-
- it("returns false when neither flag is set", () => {
- expect(
- isAgentScheduled({
- is_scheduled: false,
- recommended_schedule_cron: null,
- }),
- ).toBe(false);
- });
-
- it("returns false when both fields are undefined", () => {
+ it("returns false when is_scheduled is undefined", () => {
expect(isAgentScheduled({})).toBe(false);
});
- it("returns false when recommended_schedule_cron is an empty string", () => {
- expect(
- isAgentScheduled({
- is_scheduled: false,
- recommended_schedule_cron: "",
- }),
- ).toBe(false);
+ it("ignores recommended_schedule_cron (creator suggestion, not a user schedule)", () => {
+ const agentWithRecommendation = {
+ is_scheduled: false,
+ recommended_schedule_cron: "0 9 * * *",
+ };
+ expect(isAgentScheduled(agentWithRecommendation)).toBe(false);
});
});
diff --git a/autogpt_platform/frontend/src/app/(platform)/library/hooks/executionHelpers.ts b/autogpt_platform/frontend/src/app/(platform)/library/hooks/executionHelpers.ts
index 35940548b8..03805499fa 100644
--- a/autogpt_platform/frontend/src/app/(platform)/library/hooks/executionHelpers.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/library/hooks/executionHelpers.ts
@@ -4,12 +4,11 @@ import type { GraphExecutionMeta } from "@/app/api/__generated__/models/graphExe
export const SEVENTY_TWO_HOURS_MS = 72 * 60 * 60 * 1000;
// Shared scheduled-predicate used by fleet summary, sitrep, status-map, and the
-// list filter so the four call sites stay in lockstep.
-export function isAgentScheduled(agent: {
- is_scheduled?: boolean;
- recommended_schedule_cron?: string | null;
-}): boolean {
- return !!agent.is_scheduled || !!agent.recommended_schedule_cron;
+// list filter so the four call sites stay in lockstep. Only the current user's
+// actual schedule (`is_scheduled`) counts — `recommended_schedule_cron` is a
+// creator-defined suggestion shared by every user, not an active schedule.
+export function isAgentScheduled(agent: { is_scheduled?: boolean }): boolean {
+ return !!agent.is_scheduled;
}
export function isActive(status: string): boolean {