🤯 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
⚡️ perf(goal): give a Goal's main Agent 50 turns by default instead of 12 (#20178)
Arvin Xuf979c5129a11
diff --git a/apps/server/src/services/goal/manager.README.md b/apps/server/src/services/goal/manager.README.mdindex ac0c2f93283..c88b700964c 100644--- a/apps/server/src/services/goal/manager.README.md+++ b/apps/server/src/services/goal/manager.README.md@@ -124,7 +124,7 @@ no concurrent resume or new claim occurred before removing the Goal. This is notpersistent device process journal. A committed plan survives an errored ending,but coordinator dispatch still waits for that terminal operation.-Manager turns are capped separately (default 12, maximum 100); recorded manager+Manager turns are capped separately (default 50, maximum 100); recorded managercost/tokens are included in detailed Goal spend. External subscription executioncan be unmetered, so a zero recorded cost is not proof of zero spend. The CLI sends operation-token plan submissions to a dedicated ingestion endpoint,which checks the live operation principal and then the Goal turn binding. Normaldiff --git a/apps/server/src/services/goal/recoveryPolicy.test.ts b/apps/server/src/services/goal/recoveryPolicy.test.tsindex 559be6c5f85..993c3457775 100644--- a/apps/server/src/services/goal/recoveryPolicy.test.ts+++ b/apps/server/src/services/goal/recoveryPolicy.test.ts@@ -1,7 +1,12 @@import type { GoalItem } from '@lobechat/types';import { describe, expect, it } from 'vitest';-import { MIN_OPERATION_LEASE_TIMEOUT_MS, resolveOperationLeaseTimeout } from './recoveryPolicy';+import {+ DEFAULT_MANAGER_MAX_TURNS,+ managerTurnsSpent,+ MIN_OPERATION_LEASE_TIMEOUT_MS,+ resolveOperationLeaseTimeout,+} from './recoveryPolicy';describe('resolveOperationLeaseTimeout', () => {it('does not allow a lease shorter than two durable heartbeat intervals', () => {@@ -12,3 +17,22 @@ describe('resolveOperationLeaseTimeout', () => {expect(resolveOperationLeaseTimeout(goal)).toBe(MIN_OPERATION_LEASE_TIMEOUT_MS);});});++describe('managerTurnsSpent', () => {+ const config = (turns: number, maxTurns?: number) =>+ ({+ manager: maxTurns === undefined ? {} : { maxTurns },+ managerState: { turns },+ }) as GoalItem['config'];++ it('gives a main Agent without its own cap 50 turns', () => {+ expect(DEFAULT_MANAGER_MAX_TURNS).toBe(50);+ expect(managerTurnsSpent(config(49))).toBe(false);+ expect(managerTurnsSpent(config(50))).toBe(true);+ });++ it('keeps a per-goal cap', () => {+ expect(managerTurnsSpent(config(12, 12))).toBe(true);+ expect(managerTurnsSpent(config(12, 20))).toBe(false);+ });+});diff --git a/apps/server/src/services/goal/recoveryPolicy.ts b/apps/server/src/services/goal/recoveryPolicy.tsindex ff36dfe359d..b10fef47fab 100644--- a/apps/server/src/services/goal/recoveryPolicy.ts+++ b/apps/server/src/services/goal/recoveryPolicy.ts@@ -20,8 +20,13 @@ const DEFAULT_MAX_ATTEMPTS_PER_TASK = 8;* anyone sees a result.*/const DEFAULT_MAX_CONCURRENT_TASKS = 3;-/** Turns a goal's main Agent gets when its manager policy does not set its own. */-export const DEFAULT_MANAGER_MAX_TURNS = 12;+/**+ * Turns a goal's main Agent gets when its manager policy does not set its own.+ * A long-horizon goal re-plans after every round of tasks and every recovery,+ * so a low cap paused goals mid-delivery with work still queued; the owner can+ * still set a tighter cap per goal.+ */+export const DEFAULT_MANAGER_MAX_TURNS = 50;const MAX_CONCURRENT_TASKS_CEILING = 10;const DEFAULT_OPERATION_LEASE_TIMEOUT_MS = 5 * 60 * 1000;// Agent runtime refreshes the durable operation lease every third 30-second