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.
feat(platform): experts first, one-line runs, and run triggers on Home's Recent work (#14403)
Ubbe8490e1c217b0
diff --git a/autogpt_platform/backend/backend/api/features/home/briefing.py b/autogpt_platform/backend/backend/api/features/home/briefing.pyindex 666b982384..d7f74fbf29 100644--- a/autogpt_platform/backend/backend/api/features/home/briefing.py+++ b/autogpt_platform/backend/backend/api/features/home/briefing.py@@ -212,9 +212,18 @@ def to_outcome(duration_seconds=item.duration_seconds,cost_cents=item.cost_cents,link=item.link,+ trigger=_trigger(item),)+def _trigger(item: BriefingRunItem) -> Literal["schedule", "webhook", "manual"]:+ if item.schedule_id:+ return "schedule"+ if item.webhook_id:+ return "webhook"+ return "manual"++def _expert(item: BriefingRunItem, expert_by_id: dict[str, Expert]) -> HomeExpert | None:diff --git a/autogpt_platform/backend/backend/api/features/home/models.py b/autogpt_platform/backend/backend/api/features/home/models.pyindex e89f92b50d..2286c5b239 100644--- a/autogpt_platform/backend/backend/api/features/home/models.py+++ b/autogpt_platform/backend/backend/api/features/home/models.py@@ -45,6 +45,9 @@ class HomeBriefingOutcome(BaseModel):duration_seconds: float = 0cost_cents: int = 0link: str | None = None+ # How the run started: a scheduler job fired it, a webhook fired it, or+ # someone started it by hand (library, chat, API).+ trigger: Literal["schedule", "webhook", "manual"] = "manual"class HomeBriefing(BaseModel):diff --git a/autogpt_platform/backend/backend/api/features/home/recent_work_test.py b/autogpt_platform/backend/backend/api/features/home/recent_work_test.pyindex 4149136dea..0a03cacb6d 100644--- a/autogpt_platform/backend/backend/api/features/home/recent_work_test.py+++ b/autogpt_platform/backend/backend/api/features/home/recent_work_test.py@@ -42,6 +42,8 @@ def _execution(status: ExecutionStatus = ExecutionStatus.COMPLETED,minutes_ago: int = 0,expert_id: str | None = None,+ schedule_id: str | None = None,+ webhook_id: str | None = None,activity_status: str | None = "I generated release notes.",) -> GraphExecutionMeta:ended_at = NOW - timedelta(minutes=minutes_ago)@@ -58,6 +60,8 @@ def _execution(started_at=ended_at - timedelta(minutes=1),ended_at=ended_at,expert_id=expert_id,+ schedule_id=schedule_id,+ webhook_id=webhook_id,stats=GraphExecutionMeta.Stats(activity_status=activity_status, error=None, duration=60.0, cost=7),@@ -271,6 +275,22 @@ def test_counts_the_weeks_runs_and_orders_groups_by_latest_activity() -> None:assert [run.id for run in work.groups[1].runs] == ["failed", "done"]+def test_a_run_says_what_started_it() -> None:+ executions = [+ _execution(exec_id="cron", schedule_id="sched-1", minutes_ago=5),+ _execution(exec_id="hook", webhook_id="hook-1", minutes_ago=8),+ _execution(exec_id="hand", minutes_ago=10),+ ]++ work = _compose(executions)++ assert {run.id: run.trigger for run in work.groups[0].runs} == {+ "cron": "schedule",+ "hook": "webhook",+ "hand": "manual",+ }++def test_deliverables_older_than_the_window_are_left_out() -> None:events = [_event(event_id="fresh", session_id="s1", minutes_ago=60),diff --git a/autogpt_platform/backend/backend/api/features/integrations/router.py b/autogpt_platform/backend/backend/api/features/integrations/router.pyindex 9316538b0b..c8435420f7 100644--- a/autogpt_platform/backend/backend/api/features/integrations/router.py+++ b/autogpt_platform/backend/backend/api/features/integrations/router.py@@ -1218,6 +1218,7 @@ async def _execute_webhook_node_trigger(nodes_input_masks={node.id: {"payload": payload}},organization_id=org_id,team_id=ws_id,+ webhook_id=webhook_id,)except GraphNotInLibraryError as e:logger.warning(@@ -1326,6 +1327,7 @@ async def _execute_webhook_preset_trigger(organization_id=org_id,team_id=ws_id,expert_id=preset.expert_id,+ webhook_id=webhook.id,)except ExpertRunPausedError as e:# Expected steady-state while the expert is paused/over budget —diff --git a/autogpt_platform/backend/backend/api/features/orgs/regression_test.py b/autogpt_platform/backend/backend/api/features/orgs/regression_test.pyindex 81d64a5161..0f7add7e5b 100644--- a/autogpt_platform/backend/backend/api/features/orgs/regression_test.py+++ b/autogpt_platform/backend/backend/api/features/orgs/regression_test.py@@ -92,6 +92,8 @@ def _make_execution_row(m.organizationId = Nonem.teamId = Nonem.expertId = None+ m.scheduleId = None+ m.webhookId = Nonereturn m@@ -153,6 +155,8 @@ def _make_chat_session_row(m.organizationId = Nonem.teamId = Nonem.expertId = None+ m.scheduleId = None+ m.webhookId = Nonereturn mdiff --git a/autogpt_platform/backend/backend/copilot/briefing/models.py b/autogpt_platform/backend/backend/copilot/briefing/models.pyindex 48e1a3ce53..a79c9cab32 100644--- a/autogpt_platform/backend/backend/copilot/briefing/models.py+++ b/autogpt_platform/backend/backend/copilot/briefing/models.py@@ -24,6 +24,11 @@ class BriefingRunItem(BaseModel):occurred_at: datetime | None = Noneduration_seconds: float = 0cost_cents: int = 0+ # What started the run when it was not a person: the scheduler job or+ # the webhook. Both None for a run started by hand and for rows stored+ # before the fields existed.+ schedule_id: str | None = None+ webhook_id: str | None = Noneclass BriefingDecisionItem(BaseModel):diff --git a/autogpt_platform/backend/backend/copilot/briefing/outcome.py b/autogpt_platform/backend/backend/copilot/briefing/outcome.pyindex 02674284dd..c663d49dda 100644--- a/autogpt_platform/backend/backend/copilot/briefing/outcome.py+++ b/autogpt_platform/backend/backend/copilot/briefing/outcome.py@@ -63,6 +63,8 @@ def compose_run_outcome(duration_seconds=stats.duration if stats else 0,cost_cents=stats.cost if stats else 0,link=run_link(library_agent_id, execution.id),+ schedule_id=execution.schedule_id,+ webhook_id=execution.webhook_id,)diff --git a/autogpt_platform/backend/backend/copilot/briefing/outcome_test.py b/autogpt_platform/backend/backend/copilot/briefing/outcome_test.pyindex 92b0c3aabc..e353332d36 100644--- a/autogpt_platform/backend/backend/copilot/briefing/outcome_test.py+++ b/autogpt_platform/backend/backend/copilot/briefing/outcome_test.py@@ -13,6 +13,8 @@ def _execution(status: ExecutionStatus = ExecutionStatus.COMPLETED,activity_status: str | None = None,error: str | None = None,+ schedule_id: str | None = None,+ webhook_id: str | None = None,) -> GraphExecutionMeta:return GraphExecutionMeta(id="run-1",@@ -27,6 +29,8 @@ def _execution(started_at=NOW - timedelta(minutes=5),ended_at=NOW,expert_id="expert-1",+ schedule_id=schedule_id,+ webhook_id=webhook_id,stats=GraphExecutionMeta.Stats(activity_status=activity_status, error=error, duration=30.0, cost=9),@@ -73,6 +77,21 @@ def test_outcome_splits_the_summary_and_carries_stats() -> None:assert (item.expert_name, item.expert_role) == ("Ana", "Researcher")+def test_outcome_carries_what_fired_the_run() -> None:+ def compose(execution: GraphExecutionMeta):+ return compose_run_outcome(+ execution, agent_name="Inbox triage", library_agent_id=None, expert=None+ )++ scheduled = compose(_execution(schedule_id="sched-1"))+ triggered = compose(_execution(webhook_id="hook-1"))+ by_hand = compose(_execution())++ assert (scheduled.schedule_id, scheduled.webhook_id) == ("sched-1", None)+ assert (triggered.schedule_id, triggered.webhook_id) == (None, "hook-1")+ assert (by_hand.schedule_id, by_hand.webhook_id) == (None, None)++def test_a_raw_error_stays_out_of_the_headline() -> None:item = compose_run_outcome(_execution(status=ExecutionStatus.FAILED, error="KeyError: 'recipient'"),diff --git a/autogpt_platform/backend/backend/data/execution.py b/autogpt_platform/backend/backend/data/execution.pyindex 946084ab0a..57ed323b8b 100644--- a/autogpt_platform/backend/backend/data/execution.py+++ b/autogpt_platform/backend/backend/data/execution.py@@ -215,6 +215,11 @@ class GraphExecutionMeta(BaseDbModel):# resume/requeue recovery reason as org/team above.expert_id: Optional[str] = None+ # What started this run, when it was not a person: the scheduler job or+ # the webhook that fired. Soft references; either may be gone by now.+ schedule_id: Optional[str] = None+ webhook_id: Optional[str] = None+class Stats(BaseModel):model_config = ConfigDict(extra="allow",@@ -366,6 +371,8 @@ class GraphExecutionMeta(BaseDbModel):organization_id=_graph_exec.organizationId,team_id=_graph_exec.teamId,expert_id=_graph_exec.expertId,+ schedule_id=_graph_exec.scheduleId,+ webhook_id=_graph_exec.webhookId,)@@ -919,6 +926,8 @@ async def create_graph_execution(organization_id: Optional[str] = None,team_id: Optional[str] = None,expert_id: Optional[str] = None,+ schedule_id: Optional[str] = None,+ webhook_id: Optional[str] = None,) -> GraphExecutionWithNodes:"""Create a new AgentGraphExecution record.@@ -973,6 +982,8 @@ async def create_graph_execution("agentPresetId": preset_id,"parentGraphExecutionId": parent_graph_exec_id,**({"expertId": expert_id} if expert_id else {}),+ **({"scheduleId": schedule_id} if schedule_id else {}),+ **({"webhookId": webhook_id} if webhook_id else {}),**({"stats": Json({"is_dry_run": True})} if is_dry_run else {}),# Tenancy dual-write fields**({"organizationId": organization_id} if organization_id else {}),diff --git a/autogpt_platform/backend/backend/data/execution_stats_test.py b/autogpt_platform/backend/backend/data/execution_stats_test.pyindex 5c8666f247..59a6a39c06 100644--- a/autogpt_platform/backend/backend/data/execution_stats_test.py+++ b/autogpt_platform/backend/backend/data/execution_stats_test.py@@ -25,6 +25,8 @@ def _db_execution(*, status: ExecutionStatus, stats: dict):organizationId=None,teamId=None,expertId=None,+ scheduleId=None,+ webhookId=None,)diff --git a/autogpt_platform/backend/backend/executor/scheduler.py b/autogpt_platform/backend/backend/executor/scheduler.pyindex a3a160ff7b..d071b64475 100644--- a/autogpt_platform/backend/backend/executor/scheduler.py+++ b/autogpt_platform/backend/backend/executor/scheduler.py@@ -213,6 +213,7 @@ async def _execute_graph(**kwargs):organization_id=args.organization_id,team_id=args.team_id,expert_id=args.expert_id,+ schedule_id=args.schedule_id,)await db.increment_onboarding_runs(args.user_id)elapsed = asyncio.get_event_loop().time() - start_timediff --git a/autogpt_platform/backend/backend/executor/scheduler_unit_test.py b/autogpt_platform/backend/backend/executor/scheduler_unit_test.pyindex 6563fab4a7..afaa0d5c7b 100644--- a/autogpt_platform/backend/backend/executor/scheduler_unit_test.py+++ b/autogpt_platform/backend/backend/executor/scheduler_unit_test.py@@ -1061,9 +1061,10 @@ def test_graph_args_expert_id_defaults_to_none():@pytest.mark.asyncio-async def test_execute_graph_forwards_expert_id():- """An expert-attributed schedule must stamp its expert_id onto the- execution it creates, so any surface can answer "who ran this"."""+async def test_execute_graph_forwards_expert_id_and_schedule_id():+ """An expert-attributed schedule must stamp its expert_id and its own id+ onto the execution it creates, so any surface can answer "who ran this"+ and "did it run on schedule"."""args = GraphExecutionJobArgs(schedule_id="sched-1",user_id="user-1",@@ -1088,6 +1089,7 @@ async def test_execute_graph_forwards_expert_id():await _execute_graph(**args.model_dump(mode="json"))assert mock_add.call_args.kwargs["expert_id"] == "expert-1"+ assert mock_add.call_args.kwargs["schedule_id"] == "sched-1"@pytest.mark.asynciodiff --git a/autogpt_platform/backend/backend/executor/utils.py b/autogpt_platform/backend/backend/executor/utils.pyindex b3b29f0478..c84267287c 100644--- a/autogpt_platform/backend/backend/executor/utils.py+++ b/autogpt_platform/backend/backend/executor/utils.py@@ -1245,6 +1245,8 @@ async def add_graph_execution(team_id: Optional[str] = None,*,expert_id: Optional[str] = None,+ schedule_id: Optional[str] = None,+ webhook_id: Optional[str] = None,bypass_paywall: bool = False,) -> GraphExecutionWithNodes:"""Add a graph execution to the queue, recording the outcome.@@ -1269,6 +1271,8 @@ async def add_graph_execution(organization_id=organization_id,team_id=team_id,expert_id=expert_id,+ schedule_id=schedule_id,+ webhook_id=webhook_id,bypass_paywall=bypass_paywall,)except GraphValidationError:@@ -1300,6 +1304,8 @@ async def _add_graph_execution(team_id: Optional[str] = None,*,expert_id: Optional[str] = None,+ schedule_id: Optional[str] = None,+ webhook_id: Optional[str] = None,bypass_paywall: bool = False,) -> GraphExecutionWithNodes:"""@@ -1346,6 +1352,12 @@ async def _add_graph_execution(framework — failing now is preferable to silently giving apaywalled user a free run during an outage."""+ if schedule_id and webhook_id:+ raise ValueError(+ "A run is started by a schedule or a webhook, not both: "+ f"schedule #{schedule_id}, webhook #{webhook_id}"+ )+if not bypass_paywall and await is_user_paywalled(user_id):raise UserPaywalledError("A subscription is required to run agents.")@@ -1500,6 +1512,8 @@ async def _add_graph_execution(organization_id=organization_id,team_id=team_id,expert_id=expert_id,+ schedule_id=schedule_id,+ webhook_id=webhook_id,)logger.info(diff --git a/autogpt_platform/backend/backend/executor/utils_test.py b/autogpt_platform/backend/backend/executor/utils_test.pyindex 4fd3eee14c..9472014ba9 100644--- a/autogpt_platform/backend/backend/executor/utils_test.py+++ b/autogpt_platform/backend/backend/executor/utils_test.py@@ -443,6 +443,8 @@ async def test_add_graph_execution_is_repeatable(mocker: MockerFixture):organization_id=None,team_id=None,expert_id=None,+ schedule_id=None,+ webhook_id=None,)# Set up the graph execution mock to have properties we can extract@@ -1914,6 +1916,19 @@ def test_make_node_credentials_input_map_excludes_auto_creds(# ============================================================================+async def test_add_graph_execution_rejects_a_run_with_two_triggers():+ """A run is started by a schedule or a webhook, never both; recording+ both would let the home card report the schedule and hide the webhook."""+ with pytest.raises(ValueError, match="schedule or a webhook"):+ await add_graph_execution(+ graph_id="graph-1",+ user_id="user-1",+ schedule_id="sched-1",+ webhook_id="hook-1",+ )++# Admin-bypass paywall: requeue stuck executions for users on NO_TIER must# not be blocked by the paywall gate (Sentry bug prediction: admin recovery# would otherwise raise UserPaywalledError on the original user's behalf).diff --git a/autogpt_platform/backend/migrations/20260906120000_add_execution_trigger_refs/migration.sql b/autogpt_platform/backend/migrations/20260906120000_add_execution_trigger_refs/migration.sqlnew file mode 100644index 0000000000..d6cbbcc098--- /dev/null+++ b/autogpt_platform/backend/migrations/20260906120000_add_execution_trigger_refs/migration.sql@@ -0,0 +1,8 @@+-- AlterTable+-- Nullable columns with no default are catalog-only changes, so the+-- ACCESS EXCLUSIVE lock window on AgentGraphExecution is brief. IF NOT+-- EXISTS keeps a rerun from failing the deploy. No foreign keys: scheduler+-- jobs live in APScheduler's own store and webhooks are cleaned up+-- independently, so both are soft references like ActivityEvent.scheduleId.+ALTER TABLE "AgentGraphExecution" ADD COLUMN IF NOT EXISTS "scheduleId" TEXT;+ALTER TABLE "AgentGraphExecution" ADD COLUMN IF NOT EXISTS "webhookId" TEXT;diff --git a/autogpt_platform/backend/schema.prisma b/autogpt_platform/backend/schema.prismaindex ae19b03a1b..f7cf84e5ef 100644--- a/autogpt_platform/backend/schema.prisma+++ b/autogpt_platform/backend/schema.prisma@@ -1261,6 +1261,12 @@ model AgentGraphExecution {expertId String?Expert Expert? @relation(fields: [expertId], references: [id], onDelete: SetNull)+ // What started this run, when it was not a person: the scheduler job or+ // the webhook that fired. Soft references, since jobs live in+ // APScheduler's own store and webhooks are cleaned up independently.+ scheduleId String?+ webhookId String?+inputs Json?credentialInputs Json?nodesInputMasks Json?diff --git a/autogpt_platform/frontend/src/app/(platform)/home/__tests__/recent-work.test.tsx b/autogpt_platform/frontend/src/app/(platform)/home/__tests__/recent-work.test.tsxindex 2e5b21a04a..c625661dd9 100644--- a/autogpt_platform/frontend/src/app/(platform)/home/__tests__/recent-work.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/home/__tests__/recent-work.test.tsx@@ -71,6 +71,7 @@ const recentWork: HomeRecentWork = {duration_seconds: 812,cost_cents: 42,link: "/library/agents/lib-2?activeTab=runs&activeItem=run-1",+ trigger: "schedule",},{id: "run-3",@@ -127,6 +128,7 @@ const recentWork: HomeRecentWork = {duration_seconds: 44,cost_cents: 3,link: "/library/agents/lib-1?activeTab=runs&activeItem=run-2",+ trigger: "webhook",},],items: [@@ -224,13 +226,17 @@ test("groups the week's runs and deliverables by who did them", async () => {expect(within(mariaGroup).getByText("3 runs · 2 files · 1 schedule"),).toBeDefined();- // Only the first run tells its story; later completed runs are one line.+ // Every run is one line: the AI summary stays out of the card, and the+ // row says whether a schedule or a person started it.expect(within(mariaGroup).getByText("Newsletter draft is ready"),).toBeDefined();+ expect(within(mariaGroup).queryByText(/Compared 18 cameras/)).toBeNull();expect(within(mariaGroup).queryByText(/Drafted the September newsletter/),).toBeNull();+ expect(within(mariaGroup).getByText("Scheduled run")).toBeDefined();+ expect(within(mariaGroup).getByText("Manual run")).toBeDefined();const workflowGroup = screen.getByRole("article", {name: "Release Note Generator",@@ -241,6 +247,8 @@ test("groups the week's runs and deliverables by who did them", async () => {expect(within(workflowGroup).getByText("Release notes could not be generated"),).toBeDefined();+ expect(within(workflowGroup).getByText("Triggered run")).toBeDefined();+ expect(within(workflowGroup).queryByText(/GitHub returned 401/)).toBeNull();expect(within(workflowGroup).getByText("Send Email")).toBeDefined();expect(within(workflowGroup).getByText(/google/)).toBeDefined();@@ -250,6 +258,37 @@ test("groups the week's runs and deliverables by who did them", async () => {).toBeDefined();});+test("puts the team first and workflows in their own section below", async () => {+ mockDashboard(dashboard);++ render(<HomePage />);++ const heading = await screen.findByRole("heading", { name: "Recent work" });+ const tile = heading.closest("section");+ if (!tile) throw new Error("Recent work tile not found");+ expect(+ within(tile)+ .getAllByRole("article")+ .map((article) => article.getAttribute("aria-label")),+ ).toEqual(["Maria", "Autopilot", "Release Note Generator"]);++ const label = within(tile).getByText("Workflows");+ const autopilotGroup = within(tile).getByRole("article", {+ name: "Autopilot",+ });+ const workflowGroup = within(tile).getByRole("article", {+ name: "Release Note Generator",+ });+ expect(+ autopilotGroup.compareDocumentPosition(label) &+ Node.DOCUMENT_POSITION_FOLLOWING,+ ).toBeTruthy();+ expect(+ label.compareDocumentPosition(workflowGroup) &+ Node.DOCUMENT_POSITION_FOLLOWING,+ ).toBeTruthy();+});+test("links each actor to its home and thread work to its session", async () => {mockDashboard(dashboard);diff --git a/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/RecentWork.tsx b/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/RecentWork.tsxindex ee43fc05ca..a7b1f67657 100644--- a/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/RecentWork.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/RecentWork.tsx@@ -2,22 +2,26 @@import { WorkHistoryIcon } from "@hugeicons/core-free-icons";import type { HomeDashboardResponse } from "@/app/api/__generated__/models/homeDashboardResponse";+import type { HomeRecentWorkGroup } from "@/app/api/__generated__/models/homeRecentWorkGroup";import { Text } from "@/components/atoms/Text/Text";+import { HomeSectionLabel } from "../HomeSectionLabel/HomeSectionLabel";import { HomeTile } from "../HomeTile/HomeTile";import { HomeTileEmpty } from "../HomeTileEmpty/HomeTileEmpty";import { WorkGroup } from "./components/WorkGroup";+import { splitGroupsBySection } from "./helpers";interface Props {dashboard: HomeDashboardResponse;className?: string;}-/** One card for what the agents did this week, grouped by who did it: each- * expert, workflow, or Autopilot with the runs it finished and the files,- * integration actions and schedules it produced. */+/** One card for what the agents did this week: the team (each expert and+ * Autopilot) first, then the workflows that ran on their own in a section+ * of their own below. */export function RecentWork({ dashboard, className }: Props) {const { briefing } = dashboard;const groups = dashboard.recent_work?.groups ?? [];+ const { team, workflows } = splitGroupsBySection(groups);const completed = dashboard.recent_work?.completed_count ?? 0;const failed = dashboard.recent_work?.failed_count ?? 0;const isEmpty = groups.length === 0 && !briefing.narrative;@@ -71,17 +75,33 @@ export function RecentWork({ dashboard, className }: Props) {{briefing.narrative}</Text>) : null}- {groups.map((group) => (+ {team.map((group) => (<WorkGroup- key={- group.runs?.[0]?.id ?? group.items?.[0]?.id ?? group.actor.name- }+ key={groupKey(group)}group={group}timezone={dashboard.timezone}/>))}+ {workflows.length > 0 ? (+ <div className="pt-2">+ <HomeSectionLabel>Workflows</HomeSectionLabel>+ <div className="divide-y divide-zinc-200 border-t border-zinc-200">+ {workflows.map((group) => (+ <WorkGroup+ key={groupKey(group)}+ group={group}+ timezone={dashboard.timezone}+ />+ ))}+ </div>+ </div>+ ) : null}</div>)}</HomeTile>);}++function groupKey(group: HomeRecentWorkGroup) {+ return group.runs?.[0]?.id ?? group.items?.[0]?.id ?? group.actor.name;+}diff --git a/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/components/OutcomeRow.tsx b/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/components/OutcomeRow.tsxindex 2d1af039c3..673f4b14c2 100644--- a/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/components/OutcomeRow.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/components/OutcomeRow.tsx@@ -4,8 +4,7 @@ import type { HomeBriefingOutcome } from "@/app/api/__generated__/models/homeBriimport { Icon } from "@/components/atoms/Icon/Icon";import { Text } from "@/components/atoms/Text/Text";import { cn } from "@/lib/utils";-import { formatCurrency, formatDuration } from "../../../helpers";-import { formatWorkTime } from "../helpers";+import { formatWorkTime, getRunTriggerLabel } from "../helpers";interface Props {outcome: HomeBriefingOutcome;@@ -13,39 +12,30 @@ interface Props {/** An expert runs workflows, so the run names which one; a workflow* group already carries the name in its header. */showAgentName: boolean;- /** Title and time only: for the runs after the first in a group. */- compact?: boolean;}-const ROW_CLASS = "flex gap-2 py-2";+const ROW_CLASS = "flex items-center gap-2 py-2";const LINK_CLASS ="-mx-1 rounded px-1 outline-none transition-colors hover:bg-zinc-50 focus-visible:bg-zinc-50";-export function OutcomeRow({- outcome,- timezone,- showAgentName,- compact = false,-}: Props) {+/** One line per run: what it did, then how and when it ran. The AI summary+ * only shows on hover; the row itself opens the run. */+export function OutcomeRow({ outcome, timezone, showAgentName }: Props) {const failed = outcome.status === "failed";- const mark = (- <span- className={cn(- "mt-0.5 flex size-[18px] shrink-0 items-center justify-center rounded-md",- failed ? "bg-rose-50 text-rose-600" : "bg-zinc-100 text-zinc-500",- )}- >- <Icon- icon={failed ? AlertDiamondIcon : CheckListIcon}- size={11}- aria-hidden="true"- />- </span>- );-- const content = compact ? (+ const content = (<>- {mark}+ <span+ className={cn(+ "flex size-[18px] shrink-0 items-center justify-center rounded-md",+ failed ? "bg-rose-50 text-rose-600" : "bg-zinc-100 text-zinc-500",+ )}+ >+ <Icon+ icon={failed ? AlertDiamondIcon : CheckListIcon}+ size={11}+ aria-hidden="true"+ />+ </span><Textvariant="body"tone="secondary"@@ -53,91 +43,58 @@ export function OutcomeRow({>{outcome.title}</Text>- <Text- variant="small"- as="span"- tone="muted"- className="shrink-0 tabular-nums"- >- {formatWorkTime(outcome.occurred_at, timezone)}- </Text>- </>- ) : (- <>- {mark}- <div className="min-w-0 flex-1">- <Text- variant="body-medium"- tone="primary"- className="text-pretty leading-5"- >- {outcome.title}- </Text>- <Text- variant="body"- tone="muted"- className="mt-0.5 line-clamp-2 text-pretty leading-5"- >- {outcome.summary}- </Text>- <RunMeta- outcome={outcome}- timezone={timezone}- showAgentName={showAgentName}- />- </div>+ <RunMeta+ outcome={outcome}+ timezone={timezone}+ showAgentName={showAgentName}+ /></>);if (!outcome.link) {return (- <div className={cn(ROW_CLASS, compact && "items-center")}>{content}</div>+ <div className={ROW_CLASS} title={outcome.summary}>+ {content}+ </div>);}return (<Linkhref={outcome.link}- className={cn(ROW_CLASS, LINK_CLASS, compact && "items-center")}+ title={outcome.summary}+ className={cn(ROW_CLASS, LINK_CLASS)}>{content}</Link>);}-function RunMeta({ outcome, timezone, showAgentName }: Omit<Props, "compact">) {- const failed = outcome.status === "failed";+function RunMeta({ outcome, timezone, showAgentName }: Props) {const parts = [- failed ? (+ outcome.status === "failed" ? (<span key="status" className="font-medium text-rose-600">Failed</span>) : null,showAgentName ? (- <span key="agent" className="font-medium text-zinc-500">+ <span key="agent" className="max-w-40 truncate font-medium text-zinc-500">{outcome.agent_name}</span>) : null,+ <span key="trigger">{getRunTriggerLabel(outcome.trigger)}</span>,<span key="time" className="tabular-nums">{formatWorkTime(outcome.occurred_at, timezone)}</span>,- outcome.duration_seconds ? (- <span key="duration" className="tabular-nums">- {formatDuration(outcome.duration_seconds)}- </span>- ) : null,- outcome.cost_cents ? (- <span key="cost" className="tabular-nums">- {formatCurrency(outcome.cost_cents)}- </span>- ) : null,].filter(Boolean);+ // The meta keeps its width so the title, not the trigger and time, is what+ // truncates on a narrow card; the agent name is the one unbounded part.return (<Textvariant="small"- as="div"+ as="span"tone="muted"- className="mt-1 flex flex-wrap items-center gap-x-1.5 gap-y-1"+ className="flex shrink-0 items-center gap-x-1.5">{parts.map((part, index) => (<span key={index} className="flex items-center gap-x-1.5">diff --git a/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/components/WorkGroup.tsx b/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/components/WorkGroup.tsxindex 7f5c0318c2..c480a5808d 100644--- a/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/components/WorkGroup.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/components/WorkGroup.tsx@@ -66,15 +66,12 @@ export function WorkGroup({ group, timezone }: Props) {</div>{runs.length > 0 ? (<div className="divide-y divide-zinc-100 px-4">- {/* One run tells the story; the rest are a line each, unless they- failed and need a look. */}- {runs.map((run, index) => (+ {runs.map((run) => (<OutcomeRowkey={run.id}outcome={run}timezone={timezone}showAgentName={actor.kind === "expert"}- compact={index > 0 && run.status !== "failed"}/>))}</div>diff --git a/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/helpers.tsindex d8f678522a..a64a7b105f 100644--- a/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/helpers.ts+++ b/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/helpers.ts@@ -7,6 +7,7 @@ import {SparklesIcon,} from "@hugeicons/core-free-icons";import type { IconSvgElement } from "@hugeicons/react";+import type { HomeBriefingOutcome } from "@/app/api/__generated__/models/homeBriefingOutcome";import type { HomeRecentWorkGroup } from "@/app/api/__generated__/models/homeRecentWorkGroup";import type { HomeRecentWorkItemCategory } from "@/app/api/__generated__/models/homeRecentWorkItemCategory";import type { HomeWorkActorKind } from "@/app/api/__generated__/models/homeWorkActorKind";@@ -25,6 +26,22 @@ export function getActorIcon(kind: HomeWorkActorKind): IconSvgElement {return Robot01Icon;}+// The team did the work on someone's behalf; a workflow ran on its own.+export function splitGroupsBySection(groups: HomeRecentWorkGroup[]) {+ return {+ team: groups.filter((group) => group.actor.kind !== "workflow"),+ workflows: groups.filter((group) => group.actor.kind === "workflow"),+ };+}++export function getRunTriggerLabel(+ trigger: HomeBriefingOutcome["trigger"],+): string {+ if (trigger === "schedule") return "Scheduled run";+ if (trigger === "webhook") return "Triggered run";+ return "Manual run";+}+export function getActorKindLabel(kind: HomeWorkActorKind): string {if (kind === "workflow") return "Workflow";if (kind === "autopilot") return "Autopilot";diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.jsonindex 2cea971589..570a6b6bd7 100644--- a/autogpt_platform/frontend/src/app/api/openapi.json+++ b/autogpt_platform/frontend/src/app/api/openapi.json@@ -17258,6 +17258,14 @@"type": "integer","title": "Cost Cents","default": 0+ },+ "schedule_id": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Schedule Id"+ },+ "webhook_id": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Webhook Id"}},"type": "object",@@ -20577,6 +20585,14 @@"anyOf": [{ "type": "string" }, { "type": "null" }],"title": "Expert Id"},+ "schedule_id": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Schedule Id"+ },+ "webhook_id": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Webhook Id"+ },"stats": {"anyOf": [{ "$ref": "#/components/schemas/Stats" },@@ -20758,6 +20774,14 @@"anyOf": [{ "type": "string" }, { "type": "null" }],"title": "Expert Id"},+ "schedule_id": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Schedule Id"+ },+ "webhook_id": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Webhook Id"+ },"stats": {"anyOf": [{ "$ref": "#/components/schemas/Stats" },@@ -20863,6 +20887,14 @@"anyOf": [{ "type": "string" }, { "type": "null" }],"title": "Expert Id"},+ "schedule_id": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Schedule Id"+ },+ "webhook_id": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Webhook Id"+ },"stats": {"anyOf": [{ "$ref": "#/components/schemas/Stats" },@@ -21526,6 +21558,12 @@"link": {"anyOf": [{ "type": "string" }, { "type": "null" }],"title": "Link"+ },+ "trigger": {+ "type": "string",+ "enum": ["schedule", "webhook", "manual"],+ "title": "Trigger",+ "default": "manual"}},"type": "object",