飞书桥接 + AWS Bedrock Provider:Claude 模型被误报为协议不匹配 #5
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
| name: Issue intake — 新 issue 自动分流 | |
| # Phase 7B (v0.56.x-stability-trust):分流新建/编辑的 issue,并在作者补充后摘 needs-repro + stale。 | |
| # - 功能模板(enhancement) → v0.57+ parking-lot(feature_request.yml 已自带,此处冗余兜底) | |
| # - 影响面勾选"数据丢失"/"崩溃中断" → 对应 P0 label | |
| # - bug 缺复现(version/os/provider/steps 占位 或 无 form 结构) → needs-repro + 一次性评论 | |
| # - 作者**编辑正文**或**评论**补充后 → 摘 needs-repro **和 stale**(兑现"补全自动取消"承诺) | |
| # 绝不自动关闭任何 issue(关闭交给 stale 流程)。 | |
| on: | |
| issues: | |
| types: [opened, edited] | |
| issue_comment: | |
| types: [created] | |
| permissions: | |
| issues: write | |
| jobs: | |
| triage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const issue = context.payload.issue; | |
| const labels = issue.labels.map((l) => l.name); | |
| const repo = { owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number }; | |
| // 作者补充后解除"待补信息"状态:摘 needs-repro **和 stale**。 | |
| // 必须连 stale 一起摘——一旦 needs-repro 没了,issue 不再匹配 stale 机器人的 | |
| // any-of-labels,stale 机器人不会再碰它(remove-stale-when-updated 也不触发), | |
| // 残留的 stale 标签会一直挂着误导。 | |
| const clearResolved = async () => { | |
| for (const name of ['needs-repro', 'stale']) { | |
| if (labels.includes(name)) { | |
| await github.rest.issues.removeLabel({ ...repo, name }).catch(() => {}); | |
| } | |
| } | |
| }; | |
| // ── 事件 A:作者评论 → 视为已回应/补充(P2 修复,用户最常见的补充方式)── | |
| if (context.eventName === 'issue_comment') { | |
| const c = context.payload.comment; | |
| if (c.user.type !== 'Bot' && c.user.login === issue.user.login) { | |
| await clearResolved(); | |
| } | |
| return; | |
| } | |
| // ── 事件 B:issues.opened / edited ── | |
| const body = issue.body || ''; | |
| const isFeature = labels.includes('enhancement'); | |
| const add = new Set(); | |
| if (isFeature) add.add('v0.57+ parking-lot'); | |
| if (/- \[[xX]\][^\n]*(数据|data loss|文件写入|file write|丢失)/.test(body)) add.add('P0-data-loss-risk'); | |
| if (/- \[[xX]\][^\n]*(崩溃|闪退|中断|crash|quit|interrupt)/.test(body)) add.add('P0-crash-or-interrupt'); | |
| // 缺复现判定:检查 form 关键 input/textarea 字段 | |
| // (runtime / reproducible 是 dropdown、必选总有值,不参与占位判断,避免 "unsure" 误判) | |
| const section = (re) => { const m = body.match(re); return m ? m[1].trim() : ''; }; | |
| const placeholder = (v) => !v || v === '_No response_' || v.length < 3 || /^(无|没有|不知道|暂无|n\/?a|-+|\.+)$/i.test(v); | |
| const hasForm = /###\s*(CodePilot 版本|Version)/i.test(body); | |
| const fields = { | |
| version: section(/###\s*CodePilot 版本[^\n]*\n+([\s\S]*?)(?=\n###|$)/), | |
| os: section(/###\s*操作系统[^\n]*\n+([\s\S]*?)(?=\n###|$)/), | |
| provider: section(/###\s*Provider[^\n]*\n+([\s\S]*?)(?=\n###|$)/), | |
| steps: section(/###\s*复现步骤[^\n]*\n+([\s\S]*?)(?=\n###|$)/), | |
| }; | |
| const missing = !isFeature && (!hasForm || Object.values(fields).some(placeholder)); | |
| if (missing) add.add('needs-repro'); | |
| if (add.size) await github.rest.issues.addLabels({ ...repo, labels: [...add] }); | |
| // 编辑正文后信息补全 → 摘 needs-repro + stale | |
| if (context.payload.action === 'edited' && !isFeature && !missing && (labels.includes('needs-repro') || labels.includes('stale'))) { | |
| await clearResolved(); | |
| } | |
| // 首次打 needs-repro 时评论一次(明确"直接回复即可",与 P2 评论路径一致) | |
| if (missing && !labels.includes('needs-repro')) { | |
| await github.rest.issues.createComment({ | |
| ...repo, | |
| body: [ | |
| '感谢反馈!这个 issue 似乎缺少必要的复现信息,已标记 `needs-repro`。', | |
| '', | |
| '请用 **issue 模板**、在最新版 **v0.56.2+** 上补齐:**版本号、操作系统、Runtime、Provider / 模型、复现步骤、日志 / session id**(请脱敏,不要包含 API key)。', | |
| '', | |
| '**直接在本 issue 下回复补充即可** —— 补全后会自动取消 `needs-repro` 标记、进入正常排队;长期无回应会按 stale 流程提醒、最终关闭(关闭后随时可重新打开)。', | |
| ].join('\n'), | |
| }); | |
| } |