🤯 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
🐛 fix(channel): explain share limits on the reply card (#23707)
YuTengjinga5e652d066a7
diff --git a/apps/server/src/services/channel/replyError/rules.test.ts b/apps/server/src/services/channel/replyError/rules.test.tsindex eda32b108f6..99f7adc1b16 100644--- a/apps/server/src/services/channel/replyError/rules.test.ts+++ b/apps/server/src/services/channel/replyError/rules.test.ts@@ -147,6 +147,45 @@ describe('rule-based reply error cards', () => {expect(card.actions).not.toContain('switch_device');});+ it("explains a shared Agent's monthly usage limit without offering a doomed retry", () => {+ const card = ruleBasedReplyError(+ facts(+ {+ error: {+ message: 'This shared Agent reached its monthly usage limit',+ type: 'ShareSpendLimitExceeded',+ },+ },+ { share: { showErrorDetails: false } },+ { acceptedAt: null },+ ),+ 'zh-CN',+ NOW,+ );+ expect(card.kind).toBe('share_spend_limit');+ expect(card.actions).toEqual([]);+ expect(card.summary).toBe(+ 'Coder 已用完这个分享的用量额度,这次没有回复。需要创建者提高额度才能继续。',+ );+ expect(card.errorType).toBe('ShareSpendLimitExceeded');+ });++ it("explains a shared Agent's message limit without offering a doomed resume", () => {+ const card = ruleBasedReplyError(+ facts(+ { error: { message: 'limit', type: 'ShareMessageLimitExceeded' } },+ { share: { showErrorDetails: false } },+ ),+ 'en-US',+ NOW,+ );+ expect(card.kind).toBe('share_message_limit');+ expect(card.actions).toEqual([]);+ expect(card.summary).toBe(+ 'Messages to Coder reached the limit its creator set, so it did not reply. Its creator needs to raise the limit.',+ );+ });+it("never persists a shared Agent's owner detail, even with the share's details enabled", () => {const card = ruleBasedReplyError(facts(diff --git a/apps/server/src/services/channel/replyError/rules.ts b/apps/server/src/services/channel/replyError/rules.tsindex 3229a949647..ffd96d5356f 100644--- a/apps/server/src/services/channel/replyError/rules.ts+++ b/apps/server/src/services/channel/replyError/rules.ts@@ -27,6 +27,13 @@ export type ChannelReplyFailureKind =| 'quota_credit'/** The CLI's plan window is spent; it reopens by itself. */| 'quota_usage'+ /** A shared Agent's visitor sent all the messages its creator allows. */+ | 'share_message_limit'+ /**+ * A shared Agent spent the usage its share allows. The copy promises no reset: a zero limit+ * stops visitor runs for good, and a cap set elsewhere raises the same error.+ */+ | 'share_spend_limit'/** The CLI on the device produced no output for too long and was stopped there. */| 'silence'/** The platform found the run without progress for too long and abandoned it. */@@ -41,6 +48,10 @@ const DEVICE_ERROR_TYPES = new Set<string>([export const classifyReplyFailure = (facts: ChannelReplyErrorFacts): ChannelReplyFailureKind => {const type = facts.operation?.error?.type;const message = facts.operation?.error?.message;+ // Checked before `dispatch`: a share limit refuses the run before it takes its input, and+ // "could not start" would hide that only the creator's limit can change the outcome.+ if (type === ChatErrorType.ShareSpendLimitExceeded) return 'share_spend_limit';+ if (type === ChatErrorType.ShareMessageLimitExceeded) return 'share_message_limit';if (type && DEVICE_ERROR_TYPES.has(type)) return 'device';if (type === HETERO_AGENT_SILENCE_TIMEOUT) return 'silence';const quota = classifyCliQuotaMessage(message);@@ -79,6 +90,11 @@ export const replyFailureActions = (case 'dispatch': {return ['retry'];}+ // Resuming or retrying runs into the same limit; only its creator can lift it.+ case 'share_message_limit':+ case 'share_spend_limit': {+ return [];+ }default: {return resume ? ['resume', 'retry'] : ['retry'];}@@ -100,6 +116,10 @@ const ZH: Copy = {no_reply: (name) => `${name} 运行结束了,但没有写出回复。`,quota_credit: (name) => `${name} 使用的账号额度已用完,需要充值或换一台设备。`,quota_usage: (name) => `${name} 使用的账号已达到用量上限,额度重置后可以继续。`,+ share_message_limit: (name) =>+ `发给 ${name} 的消息已达到创建者设置的上限,这次没有回复。需要创建者提高上限才能继续。`,+ share_spend_limit: (name) =>+ `${name} 已用完这个分享的用量额度,这次没有回复。需要创建者提高额度才能继续。`,silence: (name) => `${name} 在设备上长时间没有任何输出,这次回复被中止了。`,watchdog: (name) => `${name} 长时间没有进展,这次回复被系统中止了。`,};@@ -114,6 +134,10 @@ const EN: Copy = {no_reply: (name) => `${name} finished running without writing a reply.`,quota_credit: (name) => `${name}'s account is out of credits; top it up or use another device.`,quota_usage: (name) => `${name}'s account hit its usage limit; you can continue once it resets.`,+ share_message_limit: (name) =>+ `Messages to ${name} reached the limit its creator set, so it did not reply. Its creator needs to raise the limit.`,+ share_spend_limit: (name) =>+ `${name} used up the usage this share allows, so it did not reply. Its creator needs to raise the limit.`,silence: (name) => `${name} went silent on its device for too long, so this reply was stopped.`,watchdog: (name) => `${name} stopped making progress, so the system ended this reply.`,};