合并受阻
Hi @lizhe_li, welcome to submitting your first PR to cannbot-dsl!
PR Merge Steps
1. CLA Signing
If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.
2. CI Check
Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.
3. Code Review
After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 2 person(s) per module)
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/cannbot-dsl | ❌ 金炯 (1/2)(You can also ask: 陈振宇, 刘佳玮, liujun2025, yang-jiwei, 沈敏) | ✅ 金炯 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
lizhe_li, thanks for your pull request. All authors of the commits have signed the CLA. 👍


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


流水线分析报告 — cannbot-dsl run#409
流水线: https://gitcode.com/CANN/cannbot-dsl/actions/runs/2a1209180d2646a6bce83254d0ceae7b | PR#134 | 2026-10-08 23:27:05 ~ 2026-10-08 23:32:08 | 失败 Job 2 个
定界结论: 工程问题 / 依赖缺失环境配置 — runner 缺 conda 环境 'cannbot', 回退系统 Python 3.12 安装 wheel 被 PEP 668 拒绝
- 失败类型: 工程问题(runner 环境与 CI 脚本不配套, 非 PR 代码问题)
- 根因: 测试 Job 在
[1/3] env check阶段安装预置 wheel 时, runner 上 conda envcannbot不存在(脚本回退到系统 python3.12), 系统 Python 启用 PEP 668(externally-managed-environment)拒绝 pip 系统级安装 →failed to install cannbotdsl wheel→ exit 1。两个 Test Job 在不同 runner 上同因失败, 属系统性环境配置问题。 - 处置建议: 转 CI/环境维护者: ① 恢复 runner 镜像中预置的
cannbotconda 环境(或修正脚本的环境探测路径); ② 或调整scripts/ci/run_tests.sh回退安装路径(pip install --break-system-packages/ 改用 venv)。环境修复后重触发流水线验证。PR 提交者无需修改代码。 - 排除项:
- 非本 PR 代码问题: PR#134 唯一变更
scripts/ci/run_tests.sh第 181 行附近 rc==5(no tests collected)分支的判定逻辑, 失败发生在脚本前部 env check 段的 wheel 安装, 与变更内容无交集; 且同 run 全部代码检查 Job(Antipoison / CodeCheck / CodeCheck_style / CodeCheck_precommit / SCA)均通过。 - 非网络/下载问题: wheel 为 runner 本地预置产物(
/opt/cannbot-dsl/whl/20260817_141417/, 2026-08-17 构建, 非 PR 构建产物), 日志无任何下载动作, 文件路径正常。 - 非偶发故障: 两个 Test Job 在不同 runner 上输出逐行一致, 排除单机偶发; 重试大概率同样失败。
- 非本 PR 代码问题: PR#134 唯一变更
失败根因分析
根因 #1: 工程问题 / 依赖缺失环境配置 — cannbotdsl wheel 安装被 PEP 668 拒绝(externally-managed-environment)
- 判据: pip 安装 wheel 报
error: externally-managed-environment(PEP 668); 前置 WARN 显示 conda envcannbot缺失后回退系统 Python - 定位步骤: 失败 Job 日志
3_run_tests.log(两个 Job 内容完全一致), 从末尾::error::Process exited with code 1回溯至[ERROR] failed to install cannbotdsl wheel→ 其前真实错误为 pip 原生输出error: externally-managed-environment(非平台错误码) - 影响 Job: Test(6e79dca8…, 14s), Test(72006aad…, 13s) — 同因聚合
- 根因证据(日志原文):
[2026-10-08 23:30:42.310+08:00] [WARN] conda env 'cannbot' not found, using default python
[2026-10-08 23:30:42.311+08:00] === [1/3] env check ===
[2026-10-08 23:30:42.823+08:00] [INFO] installing local cannbotdsl wheel: /opt/cannbot-dsl/whl/20260817_141417/cannbotdsl-0.3.dev126+gfd7852302-cp312-cp312-linux_x86_64.whl
[2026-10-08 23:30:43.474+08:00] error: externally-managed-environment
[2026-10-08 23:30:43.474+08:00] × This environment is externally managed
[2026-10-08 23:30:43.474+08:00] ╰─> To install Python packages system-wide, try apt install
[2026-10-08 23:30:43.474+08:00] python3-xyz, where xyz is the package you are trying to
[2026-10-08 23:30:43.474+08:00] install.
[2026-10-08 23:30:43.475+08:00] note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
[2026-10-08 23:30:43.475+08:00] hint: See PEP 668 for the detailed specification.
[2026-10-08 23:30:43.542+08:00] [ERROR] failed to install cannbotdsl wheel: /opt/cannbot-dsl/whl/20260817_141417/cannbotdsl-0.3.dev126+gfd7852302-cp312-cp312-linux_x86_64.whl
[2026-10-08 23:30:43.543+08:00] ::error::Process exited with code 1
- 根因链: runner 缺 conda env
cannbot→ 脚本回退系统 python3.12(Ubuntu/Debian 新版默认启用 PEP 668)→ pip 拒绝系统级安装 → wheel 安装失败, 测试在 env check 阶段即中断, 未进入实际用例执行 - PR 关联性核查: PR#134 唯一变更文件
scripts/ci/run_tests.sh(+13/-2), patch 位于@@ -181,7 +181,18 @@(pytest rc==5 分支), 未触及 wheel 安装段; 失败与 PR 变更无因果关系
由门禁失败定界分析自动生成 | repo: cannbot-dsl | run: 2a1209180d2646a6bce83254d0ceae7b | PR#134


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


@jon_jin 抱歉之前只触发了流水线没有回报结论。已排查完毕:
这个 PR 改的是 scripts/ci/run_tests.sh 里 rc==5(未收集到用例)的分支判定。平台 gate-analysis 报告给出的定界是 runner 环境问题——runner 上缺 cannbot conda 环境,脚本回退到系统 Python 3.12 安装预置 wheel 时被 PEP 668 拒绝,失败发生在 env check 段,与本 PR 的改动无交集(同 run 的 Antipoison / CodeCheck / SCA 均通过)。
最近一次重跑(10-27 00:32)已转为 ci-pipeline-passed,当前无代码侧待办。
如仍需我配合调整,请直接指出;若可安排评审,随时听从安排。谢谢!


@jon_jin 这条 MR 目前 CI 门禁是 ci-pipeline-passed、mergeable=True、CLA 已签,代码侧没有待办了,想请安排一位评审看一下:
- 改动范围:
scripts/ci/run_tests.sh里 rc==5(未收集到用例)的分支判定,把「没收集到用例」和「用例全通过」区分开,避免测试实际没跑却被记为通过; - 之前那次失败已定界为 runner 环境问题(缺
cannbotconda 环境 + PEP 668 拒绝安装),与本改动无交集。
如果评审认为这个判定口径不合适,或者更希望换个写法,请直接说,我改。谢谢!


问题
scripts/ci/run_tests.sh:183-186在 pytest 返回码 5(未收集到任何用例)时无条件exit 0。--ops写错、marker 表达式写错、测试路径失效等配置类错误都会被吞成「通过」,CI 假绿(issue #24)。改动
rc=5 时先用去掉 marker 过滤的
pytest --collect-only -q复核目标下是否真的存在用例:--ops、marker 表达式、测试路径)。只改这一个分支(
scripts/ci/run_tests.sh,+13/-2),未改build.sh——issue #22 涉及的build.sh同区域已有 !59 在改,避免两处冲突。验证(本机可复现)
环境:Windows + git-bash,pytest 9.1.1。同一份脚本(before = 当前 master
e5f6641,after = 本 MR),只把仓库骨架换成最小沙箱(本机无 torch / torch_npu / CANN,跑不了仓内真实用例),pytest 与脚本均未改动逻辑。[ERROR] pytest collected no tests from [test/empty_op][INFO] 1 test(s) exist in [...] but all are filtered out by marker [-m not npu]--ops写错(pytest 用法错误 rc=4)--mode=all+ 零用例目标复现命令(沙箱内,PYTHON 指向带 pytest 的解释器):
bash scripts/ci/run_tests.sh --ops=empty_op --mode=cpu # 修复前 exit 0,修复后 exit 5 bash scripts/ci/run_tests.sh --ops=npu_only_op --mode=cpu # 两种版本都 exit 0,修复后多一条 INFO未测什么:本机没有 torch / torch_npu / CANN,未在真实 cpu/npu 模式下跑仓内用例。在真实克隆里对本补丁脚本做过一次冒烟(
--ops=rms_norm --mode=cpu),如预期停在用例收集阶段(缺 torch →1 error during collection)并以 rc=1 退出,未被掩盖。bash -n通过;本机未安装 shellcheck,未跑pre-commit。Fixes #24