fix: address code review feedback - fix empty catch blocks, remove redundant fallback, fix email step status

- Add error logging to catch blocks in intent-router.js and pipeline-reporter.js
- Remove redundant devId+devInfo fallback in handleBingshuoComment (now handled by parseIntent)
- Fix email step progress reporting to use steps.email.outcome instead of steps.persona.outcome
- Standardize last_synced field access

Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-13 15:46:41 +00:00
parent 2bd9a84abb
commit 8b013c998f
4 changed files with 16 additions and 20 deletions

View File

@ -377,8 +377,8 @@ jobs:
});
"
- name: 📋 步骤 7/8 · 邮件通知
if: always() && steps.persona.outcome == 'success'
- name: 📋 步骤 7/8 · 邮件通知(成功)
if: always() && steps.email.outcome == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
@ -388,6 +388,17 @@ jobs:
STEP_DETAIL: '邮件通知步骤已执行'
run: node scripts/pipeline-reporter.js
- name: 📋 步骤 7/8 · 邮件通知(失败)
if: always() && steps.email.outcome == 'failure'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
STEP_NUM: '7'
STEP_NAME: '邮件通知'
STEP_STATUS: 'error'
STEP_DETAIL: '邮件发送失败,请检查 Secrets: SMTP_USER / SMTP_PASS'
run: node scripts/pipeline-reporter.js
- name: 💬 Reply to Issue
uses: actions/github-script@v7
with:

View File

@ -216,7 +216,7 @@ function githubAPI(method, path, data) {
res.on('end', () => {
if (res.statusCode >= 200 && res.statusCode < 300) {
try { resolve(JSON.parse(responseBody)); }
catch { resolve(responseBody); }
catch (e) { console.error('⚠️ JSON parse error:', e.message); resolve(responseBody); }
} else {
reject(new Error(`GitHub API ${res.statusCode}: ${responseBody.slice(0, 200)}`));
}

View File

@ -45,7 +45,7 @@ function githubAPI(method, path, data) {
res.on('end', () => {
if (res.statusCode >= 200 && res.statusCode < 300) {
try { resolve(JSON.parse(responseBody)); }
catch { resolve(responseBody); }
catch (e) { console.error('⚠️ JSON parse error:', e.message); resolve(responseBody); }
} else {
reject(new Error(`GitHub API ${res.statusCode}: ${responseBody.slice(0, 200)}`));
}

View File

@ -189,7 +189,7 @@ async function handleBingshuoComment() {
// 查询某个开发者的状态
const devReply = checkDevStatus(intent.devId, devStatus);
const reply = `## ⚒️ 铸渊回复 · 冰朔查询\n\n${devReply}\n\n`
+ `---\n*数据来源Notion主控台 · 最后同步 ${devStatus.last_synced || devStatus.last_sync}*\n`
+ `---\n*数据来源Notion主控台 · 最后同步 ${devStatus.last_synced}*\n`
+ `*—— 铸渊ICE-GL-ZY001*`;
await postComment(reply);
return;
@ -204,21 +204,6 @@ async function handleBingshuoComment() {
}
default: {
// 未识别的意图:尝试 AI 回答,或返回帮助提示
// 冰朔可以查询任何人的状态(兼容旧逻辑)
if ((commentBody.includes('进度') || commentBody.includes('状态')) && devId && devInfo) {
const reply = `## ⚒️ 铸渊回复 · 冰朔查询\n\n`
+ `**${devInfo.name}${devInfo.dev_id})当前状态:**\n`
+ `- 📌 模块:${devInfo.modules.join('、')}\n`
+ `- 📊 状态:${devInfo.status}\n`
+ `- ⏳ 等待中:${devInfo.waiting_for}\n`
+ `- 👉 下一步:${devInfo.next_step}\n\n`
+ `---\n*数据来源Notion主控台 · 最后同步 ${devStatus.last_synced}*\n`
+ `*—— 铸渊ICE-GL-ZY001*`;
await postComment(reply);
return;
}
// 冰朔的一般指令 → 用 AI 处理
const aiReply = await callYunwuAPI('冰朔指令', commentBody, null);
if (aiReply) {