fix(skill): 修复 IMAP/SMTP 连接失败时错误信息显示为 } 的问题#1161
Closed
swuzjb wants to merge 1 commit into
Closed
Conversation
When building the error message for a failed IMAP/SMTP connectivity check, the previous code fell back to the last line of stdout. Since the script outputs pretty-printed JSON on success (JSON.stringify with indent=2), the last stdout line is always '}', which was shown to users as the error message. Remove the stdout fallback so the message chain is: timedOut > result.error > last stderr line > generic label message
Collaborator
|
感谢提交!该问题已在当前 release 分支中修复(getLastOutputLine(result.stdout) 兜底逻辑已移除),因此关闭此 PR。 |
This was referenced May 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题描述
当邮箱(IMAP 或 SMTP)连接失败时,用户在设置界面看到的错误信息只有一个
},而不是实际的错误原因。关闭 #1152
根本原因
src/main/skillManager.ts中的buildEmailConnectivityCheck()方法在构建错误信息时,使用了如下优先级链:imap.js/smtp.js脚本在执行成功时,会通过stdout输出格式化 JSON:当脚本以非零 exit code 退出(连接失败),但
stdout中已有部分输出(例如连接建立后才失败),result.success为false,代码会走到getLastOutputLine(result.stdout)这个兜底分支。由于格式化 JSON 的最后一行固定是
},最终用户看到的错误信息就是}。修复方案
移除
|| this.getLastOutputLine(result.stdout)这一行。stdout是脚本的正常输出通道,不应作为错误信息来源;错误信息应来自stderr。修复后的优先级链:
变更内容
src/main/skillManager.ts:删除buildEmailConnectivityCheck()中的stdout兜底逻辑(1 行删除)影响范围
仅影响邮箱技能连接测试的错误信息展示逻辑,不影响连接成功路径及其他功能。