Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(maker-shared): don't flag empty errors arrays as tool failures
Zhao Dengfengc221469abd91
diff --git a/packages/maker-shared/src/__tests__/messagePresentation.test.ts b/packages/maker-shared/src/__tests__/messagePresentation.test.tsindex 4caa6fac0f..f5e5da1570 100644--- a/packages/maker-shared/src/__tests__/messagePresentation.test.ts+++ b/packages/maker-shared/src/__tests__/messagePresentation.test.ts@@ -451,6 +451,9 @@ describe('messagePresentation', () => {expect(isToolErrorLike(message('json', { secondaryBody: '{"status":"failed"}' }))).toBe(true);expect(isToolErrorLike(message('text', { secondaryBody: 'process exited with exit code 2' }))).toBe(true);expect(isToolErrorLike(message('ok', { secondaryBody: '{"ok":true}' }))).toBe(false);+ // 成功结果里的空 errors 数组不是失败;非空数组仍是。+ expect(isToolErrorLike(message('empty-errors', { secondaryBody: '{"ok":true,"errors":[]}' }), false)).toBe(false);+ expect(isToolErrorLike(message('errors', { secondaryBody: '{"errors":["boom"]}' }), false)).toBe(true);// 关闭关键词启发式后只信结构化错误记录。expect(isToolErrorLike(message('kw-off', { secondaryBody: 'build failed with error' }), false)).toBe(false);expect(isToolErrorLike(message('rec-on', { secondaryBody: '{"status":"failed"}' }), false)).toBe(true);diff --git a/packages/maker-shared/src/messagePresentation.ts b/packages/maker-shared/src/messagePresentation.tsindex ce7fa302ad..968e29fdd4 100644--- a/packages/maker-shared/src/messagePresentation.ts+++ b/packages/maker-shared/src/messagePresentation.ts@@ -848,7 +848,9 @@ function isErrorRecord(value: string): boolean {if (status === 'error' || status === 'failed' || status === 'failure') return true;return ['error', 'errors', 'exception', 'stderr'].some((key) => {const raw = record[key];- return typeof raw === 'string' ? raw.trim().length > 0 : raw !== undefined && raw !== null;+ if (typeof raw === 'string') return raw.trim().length > 0;+ if (Array.isArray(raw)) return raw.length > 0;+ return raw !== undefined && raw !== null;});} catch {return false;