π€― 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π¨ chore(onboarding): restrict to 2 task per provider (#18031)
Neko417cc9b2a1e5
diff --git a/apps/server/src/services/taskRecommendation/config.test.ts b/apps/server/src/services/taskRecommendation/config.test.tsindex 78277133b8d..488cfb43902 100644--- a/apps/server/src/services/taskRecommendation/config.test.ts+++ b/apps/server/src/services/taskRecommendation/config.test.ts@@ -2,13 +2,13 @@ import { describe, expect, it } from 'vitest';import { TaskRecommendationConfigurator } from './config';-/** @example The default target distributes recommendations without a provider-count table. */+/** @example The default allocation keeps every provider to two high-value task slots. */describe('TaskRecommendationConfigurator', () => {- /** @example 1β6, 2β5, 3β3, and 4β2 recommendations per provider. */- it('clamps a rounded fair share to configured bounds', () => {+ /** @example Every non-empty provider set receives exactly two recommendation slots. */+ it('caps every provider at the fixed two-task budget', () => {const configurator = new TaskRecommendationConfigurator();expect([1, 2, 3, 4, 8].map((count) => configurator.recommendationsPerProvider(count))).toEqual([- 6, 5, 3, 2, 2,+ 2, 2, 2, 2, 2,]);});diff --git a/apps/server/src/services/taskRecommendation/config.ts b/apps/server/src/services/taskRecommendation/config.tsindex e71da6c50f9..fe91b3c431b 100644--- a/apps/server/src/services/taskRecommendation/config.ts+++ b/apps/server/src/services/taskRecommendation/config.ts@@ -62,9 +62,9 @@ export interface TaskRecommendationConfig {/** Default recommendation policy kept in one injectable configuration object. */export const defaultTaskRecommendationConfig: TaskRecommendationConfig = {allocation: {- maxPerProvider: 6,+ maxPerProvider: 2,minPerProvider: 2,- targetTotal: 9,+ targetTotal: 4,},providers: {github: {diff --git a/apps/server/src/services/taskRecommendation/service.test.ts b/apps/server/src/services/taskRecommendation/service.test.tsindex 072fd55f85c..336625cb781 100644--- a/apps/server/src/services/taskRecommendation/service.test.ts+++ b/apps/server/src/services/taskRecommendation/service.test.ts@@ -183,6 +183,54 @@ describe('TaskRecommendationService', () => {});});+ /** @example A provider response with three grounded drafts exposes only its first two slots. */+ it('hard-caps one provider result at two recommendations', async () => {+ const sources = [+ { type: 'github' as const, url: 'https://github.com/lobehub/lobe-chat/pull/1' },+ { type: 'github' as const, url: 'https://github.com/lobehub/lobe-chat/issues/2' },+ { type: 'github' as const, url: 'https://github.com/lobehub/lobe-chat/issues/3' },+ ];+ const service = new TaskRecommendationService({+ configurator: new TaskRecommendationConfigurator(),+ connectorData: {},+ onboarding: {},+ providers: new Map([+ [+ 'github',+ {+ collect: vi.fn(async () => ({+ context: JSON.stringify({ sources }),+ diagnostics: { errors: [], evidenceCount: 3, failedCount: 0, succeededCount: 3 },+ signalCount: 3,+ sources,+ })),+ id: 'github',+ },+ ],+ ]),+ task: {},+ topic: {},+ userId: 'user-1',+ writer: {+ generate: vi.fn(async () =>+ sources.map(({ url }, index) => ({+ instruction: `Inspect recommendation ${index + 1}.`,+ reason: `It has evidence ${index + 1}.`,+ sourceUrls: [url],+ title: `Recommendation ${index + 1}`,+ })),+ ),+ },+ } as never);++ const result = await service.generateProvider('github', 2, 'en-US');++ expect(result.recommendations.map(({ title }) => title)).toEqual([+ 'Recommendation 1',+ 'Recommendation 2',+ ]);+ });+/** @example Repeating the same create request reuses the persisted task mapping. */it('does not create duplicate tasks when materialization is retried', async () => {let persisted = structuredClone(session);diff --git a/packages/prompts/src/chains/onboardingTaskRecommendation.test.ts b/packages/prompts/src/chains/onboardingTaskRecommendation.test.tsindex 57bda883525..5be6f66a9bc 100644--- a/packages/prompts/src/chains/onboardingTaskRecommendation.test.ts+++ b/packages/prompts/src/chains/onboardingTaskRecommendation.test.ts@@ -25,6 +25,8 @@ describe('chainOnboardingTaskRecommendation', () => {);expect(messages[0].content).toContain('Preserve repository names, product names');expect(messages[0].content).toContain('Never comment, submit a review, approve');+ expect(messages[0].content).toContain('Select only the highest-value recommendations');+ expect(messages[0].content).toContain('urgency, recurrence, user impact, and leverage');expect(messages[0].content).toContain('Title: Analyze mobile lifecycle risk');expect(messages[1].content).toContain('<connector-evidence provider="github">');expect(messages[1].content).toContain('{"pullRequest":1}');diff --git a/packages/prompts/src/chains/onboardingTaskRecommendation.ts b/packages/prompts/src/chains/onboardingTaskRecommendation.tsindex de7ddd253f1..89c632ebd76 100644--- a/packages/prompts/src/chains/onboardingTaskRecommendation.ts+++ b/packages/prompts/src/chains/onboardingTaskRecommendation.ts@@ -98,6 +98,7 @@ export const DEFAULT_ONBOARDING_TASK_RECOMMENDATION_PROMPT_CONFIG = {writing: {instructionPrinciples: ['Write two to four sentences addressed directly to an autonomous agent. State the background work it can perform, the concrete private deliverable it must return, and the completion criteria.',+ 'Select only the highest-value recommendations for this provider. Rank evidence by urgency, recurrence, user impact, and leverage; when the limit is two, return the two strongest distinct candidates in that order. Skip low-signal, generic, duplicated, or merely convenient work.','Include enough project, person, or subject context for the Inbox agent to execute the task without guessing which similarly named work item is intended.','Preserve uncertainty from the evidence and state any user approval boundary explicitly.','Prefer tasks that can finish asynchronously without interrupting the user: gather evidence, analyze activity, summarize, compare, prioritize, or prepare a draft, checklist, report, or patch plan.',