🤯 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(cli): propagate memory list query failures (#19844)
AmAzing-cf5c09fb8f30
diff --git a/apps/cli/src/commands/memory.test.ts b/apps/cli/src/commands/memory.test.tsindex b4af0fe1860..3b2f518e627 100644--- a/apps/cli/src/commands/memory.test.ts+++ b/apps/cli/src/commands/memory.test.ts@@ -91,6 +91,61 @@ describe('memory command', () => {expect(consoleSpy).toHaveBeenCalledWith(JSON.stringify(items, null, 2));});+ it.each([false, true])('preserves a successful empty list (json=%s)', async (json) => {+ mockTrpcClient.userMemory.getIdentities.query.mockResolvedValue([]);+ await createProgram().parseAsync([+ 'node',+ 'test',+ 'memory',+ 'list',+ 'identity',+ ...(json ? ['--json'] : []),+ ]);+ expect(consoleSpy).toHaveBeenCalledExactlyOnceWith(+ json ? '[]' : 'No identity memories found.',+ );+ });++ it.each([false, true])('propagates a single-category failure (json=%s)', async (json) => {+ const error = new Error('Identity request failed');+ mockTrpcClient.userMemory.getIdentities.query.mockRejectedValue(error);+ await expect(+ createProgram().parseAsync([+ 'node',+ 'test',+ 'memory',+ 'list',+ 'identity',+ ...(json ? ['--json'] : []),+ ]),+ ).rejects.toBe(error);+ expect(consoleSpy).not.toHaveBeenCalled();+ });++ it.each([false, true])(+ 'does not present partial categories as complete (json=%s)',+ async (json) => {+ const error = new Error('Activity request failed');+ mockTrpcClient.userMemory.getIdentities.query.mockResolvedValue([+ { description: 'Still present', id: 'existing-memory', type: 'personal' },+ ]);+ mockTrpcClient.userMemory.getActivities.query.mockRejectedValue(error);+ mockTrpcClient.userMemory.getContexts.query.mockResolvedValue([]);+ mockTrpcClient.userMemory.getExperiences.query.mockResolvedValue([]);+ mockTrpcClient.userMemory.getPreferences.query.mockResolvedValue([]);+ await expect(+ createProgram().parseAsync([+ 'node',+ 'test',+ 'memory',+ 'list',+ ...(json ? ['--json'] : []),+ ]),+ ).rejects.toBe(error);+ expect(consoleSpy).not.toHaveBeenCalled();+ },+ );+it('should reject invalid category', async () => {const program = createProgram();await program.parseAsync(['node', 'test', 'memory', 'list', 'invalid']);diff --git a/apps/cli/src/commands/memory.ts b/apps/cli/src/commands/memory.tsindex 0e199243ff7..cb19533751c 100644--- a/apps/cli/src/commands/memory.ts+++ b/apps/cli/src/commands/memory.ts@@ -35,11 +35,7 @@ export function registerMemoryCommand(program: Command) {const allResults: Record<string, any[]> = {};for (const cat of categoriesToFetch) {- try {- allResults[cat] = await fetchCategory(client, cat);- } catch {- allResults[cat] = [];- }+ allResults[cat] = await fetchCategory(client, cat);}if (options.json !== undefined) {