Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

πŸ› fix(home): route scheduled reports to daily brief (#17235)

Arvin Xue9df3c5ebf47
diff --git a/src/features/HomeInbox/NewsList.tsx b/src/features/HomeInbox/NewsList.tsx
index ffa56f43e8c..101d8fed5cb 100644
--- a/src/features/HomeInbox/NewsList.tsx
+++ b/src/features/HomeInbox/NewsList.tsx
@@ -47,9 +47,9 @@ interface NewsItemProps {
}
/**
- * One `insight` brief, collapsed to a single line. The agent that surfaced it
- * leads the row; opening it reads it (there is nothing to decide, so a glance
- * *is* the resolution) and drops the finding's detail inline.
+ * One non-actionable brief, collapsed to a single line. The agent that surfaced
+ * it leads the row; opening it reads it (there is nothing to decide) and drops
+ * the finding's detail inline.
*/
const NewsItem = memo<NewsItemProps>(({ brief }) => {
const markBriefRead = useBriefStore((s) => s.markBriefRead);
@@ -122,9 +122,9 @@ interface NewsListProps {
}
/**
- * `insight` briefs: the agent found something worth knowing, but there is
- * nothing to decide. One line each β€” the detail lives behind the click, so a
- * week of findings still fits on screen.
+ * Non-actionable briefs: the agent found something worth knowing or completed a
+ * recurring run, but there is nothing to decide. One line each β€” the detail
+ * lives behind the click, so a week of findings still fits on screen.
*/
const NewsList = memo<NewsListProps>(({ news }) => {
if (news.length === 0) return null;
diff --git a/src/features/HomeInbox/splitBriefs.test.ts b/src/features/HomeInbox/splitBriefs.test.ts
index d450df7b376..f056b46e417 100644
--- a/src/features/HomeInbox/splitBriefs.test.ts
+++ b/src/features/HomeInbox/splitBriefs.test.ts
@@ -7,6 +7,9 @@ import { splitBriefs } from './splitBriefs';
const brief = (id: string, type: BriefItem['type']): BriefItem =>
({ id, summary: '', title: id, type }) as BriefItem;
+const scheduledResult = (id: string): BriefItem =>
+ ({ ...brief(id, 'result'), taskStatus: 'scheduled' }) as BriefItem;
+
describe('splitBriefs', () => {
it('routes insight briefs to news and everything else to needsYou', () => {
const { needsYou, news } = splitBriefs([
@@ -20,6 +23,16 @@ describe('splitBriefs', () => {
expect(news.map((b) => b.id)).toEqual(['b']);
});
+ it('routes scheduled task results to news instead of needsYou', () => {
+ const recurringReport = scheduledResult('run-now-scheduled-task-report');
+ const oneOffDelivery = brief('one-off-delivery', 'result');
+
+ const { needsYou, news } = splitBriefs([recurringReport, oneOffDelivery]);
+
+ expect(needsYou.map((item) => item.id)).toEqual(['one-off-delivery']);
+ expect(news.map((item) => item.id)).toEqual(['run-now-scheduled-task-report']);
+ });
+
it('sinks errors to the bottom of needsYou', () => {
const { needsYou } = splitBriefs([
brief('err', 'error'),
diff --git a/src/features/HomeInbox/splitBriefs.ts b/src/features/HomeInbox/splitBriefs.ts
index 6e6bdd6991a..f9196c45bc3 100644
--- a/src/features/HomeInbox/splitBriefs.ts
+++ b/src/features/HomeInbox/splitBriefs.ts
@@ -17,17 +17,26 @@ export interface SplitBriefs {
news: BriefItem[];
}
+/**
+ * Results belonging to scheduled tasks are recurring reports, including an
+ * ad-hoc "Run now" invocation. They remain `result` briefs, but reading the
+ * report is enough β€” they do not require explicit acceptance.
+ */
+const isNewsBrief = (brief: BriefItem): boolean =>
+ brief.type === 'insight' || (brief.type === 'result' && brief.taskStatus === 'scheduled');
+
/**
* Splits the unresolved brief feed by whether the user has to *do* something.
- * `decision` / `result` / `error` block an agent until answered; `insight` is
- * pure knowledge and belongs in a scannable list, not in a to-do pile.
+ * `decision` / one-off `result` / `error` block an agent until answered;
+ * `insight` and recurring-run results are pure knowledge and belong in a
+ * scannable list, not in a to-do pile.
*
* The server already sorts by priority then recency, so we only re-order within
* "Needs you" β€” a stable sort keeps that ordering inside each rank.
*/
export const splitBriefs = (briefs: BriefItem[]): SplitBriefs => ({
needsYou: briefs
- .filter((brief) => brief.type !== 'insight')
+ .filter((brief) => !isNewsBrief(brief))
.sort((a, b) => (NEEDS_YOU_ORDER[a.type] ?? 5) - (NEEDS_YOU_ORDER[b.type] ?? 5)),
- news: briefs.filter((brief) => brief.type === 'insight'),
+ news: briefs.filter(isNewsBrief),
});