From 8b013c998f137fed6354e37e4c9c770237c88993 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:46:41 +0000 Subject: [PATCH] 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> --- .github/workflows/syslog-issue-pipeline.yml | 15 +++++++++++++-- scripts/intent-router.js | 2 +- scripts/pipeline-reporter.js | 2 +- scripts/zhuyuan-issue-reply.js | 17 +---------------- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/.github/workflows/syslog-issue-pipeline.yml b/.github/workflows/syslog-issue-pipeline.yml index 8c262df8..c7386478 100644 --- a/.github/workflows/syslog-issue-pipeline.yml +++ b/.github/workflows/syslog-issue-pipeline.yml @@ -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: diff --git a/scripts/intent-router.js b/scripts/intent-router.js index 2ab49946..d78c7fac 100644 --- a/scripts/intent-router.js +++ b/scripts/intent-router.js @@ -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)}`)); } diff --git a/scripts/pipeline-reporter.js b/scripts/pipeline-reporter.js index e11dabed..74fa4eb6 100644 --- a/scripts/pipeline-reporter.js +++ b/scripts/pipeline-reporter.js @@ -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)}`)); } diff --git a/scripts/zhuyuan-issue-reply.js b/scripts/zhuyuan-issue-reply.js index da558105..f14e9bc4 100644 --- a/scripts/zhuyuan-issue-reply.js +++ b/scripts/zhuyuan-issue-reply.js @@ -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) {