Merged
fix(ops-perf-optimize): 兼容已实测终选记录的 decision 字段 #428
fix(ops-perf-optimize): 兼容已实测终选记录的 decision 字段 #428
Merged
wychenAdd on 7 days ago
wychen
wychen
7 days ago

描述

【ops-perf-optimize】已实测轮次的终选记录可能用 decision: retain_candidate/retain_baseline 表达采用结果。经验工具只读取 candidate_accepted 时,会在算子验证已经完成后以 selection lacks candidate_accepted 阻塞后处理。

本次仅在 selection_outcome() 增加只读兼容:仅当布尔字段缺失且 search.outcome == measured 时,识别上述两个明确决策。已有布尔字段优先,未知决策、非法字段类型和失败候选误标采用继续拒绝。其余证据身份、轮次覆盖、性能数据和独立评审规则保持原样,不回写冻结记录,不改控制壳。

测试新增真实 render CLI 回放,验证 accepted/rejected 两种旧记录均可生成正文,且 selection、manifest、state 和 bundle 的字节保持不变;同时覆盖拒绝路径及原有布尔字段行为。保留 pytest 导入 fixture,避免 lint 自动删除后丢失源码/打包安装测试。

关联的Issue

Closes #229

https://gitcode.com/cann/cannbot/issues/229

测试

  • 修复前:新增的两条旧格式 CLI 用例均以退出码 2 失败,报 selection lacks candidate_accepted;相同错误已在实际任务中发生。
  • 修复后:python3 -B -m pytest -q -p no:cacheprovider plugins-official/ops-perf-optimize/tests/test_experience_reflux.py plugins-official/ops-perf-optimize/tests/test_experience_portability.py,87 passed,包含源码/打包安装路径。
  • 用修复版 render 只读回放实际 apply_rotary_pos_emb 的冻结 manifest/bundle,退出码 0,成功输出正文到独立验证目录;未改原任务状态,也未宣称后续独立评审已通过。
  • git diff --check 通过;pre-commit 的 Ruff lint、空白、文件末尾、冲突标记、私钥及 OAT 检查通过。
  • 两个上游原文件本身均不能通过全文件 ruff-format --check。为保持此次最小差异,没有纳入会改写约 900 行的存量格式整理;提交时仅跳过该格式化钩子,未将格式检查报告为通过。
  • 本次为离线记录兼容修复,无需 NPU 重新测评。

文档更新

新增 docs/changelog.d/428.fixed.md;changelog.py validate --repo . 通过,不修改 CHANGELOG.md。

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for wychen's contribution.)
wychenwychen
7 days ago Created pull request, commit 1f2cb0c7
wychenwychen
7 days ago Associated issue: [Bug-Report|缺陷反馈]: 已实测终选记录缺少 candidate_accepted 导致经验回流阻塞
CANN-robot
CANN-robotCollaborators
7 days ago Comments:

Hi @wychencc_, welcome to submitting your first PR to CANN!

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.
%!(EXTRA string=https://atomgit.com/cann/community/blob/master/en/sig-infrastructure/command.md)

likedislike
CANN-robotCANN-robotCollaborators
7 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
7 days ago Comments:

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

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/cannbot ✅ hanrui22, qq_37913898 (2/2) ✅ hanrui22 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

wychencc_, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robotCollaborators
7 days ago Set qq_37913898,w00934874,dengguojie,jon_jin,rxtfeng,songkai111,xutianze,pingchuantang,hanrui22,wangzheng97,hedi0515,benwallace52,linghuis,OpSphere,zihengwang2 as approver
8 event messages are collapsed here。 See more
wychenwychen
7 days ago Modify description of pull request
wychen
wychen
7 days ago Comments:

/compile

likedislike
wychenwychen
7 days ago Pre merge succeeded (commit_id: 40feef1d7b6068903f568e9a226691d9393aed09)
CANN-robot
CANN-robotCollaborators
7 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
7 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
7 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
7 days ago Added label: ci-pipeline-failed
CANN-robot
CANN-robotCollaborators
7 days ago Comments:

流水线分析报告 — CANN/cannbot run#1221

流水线: https://gitcode.com/CANN/cannbot/actions/runs/4e0ea3cf57b143c98cd1ec231b076def | PR#428 | 2026-11-23 15:59:32 ~ 16:02:09 | 失败 Job 1 个

定界结论: 代码问题 — openlibing CodeCheck 检查未通过
  • 失败类型: 代码问题 / 代码检查错误
  • 根因: CodeCheck 任务调用 openlibing 静态检查服务,结果为 no pass(第 3 步 codecheck 返回 state=no pass,进程退出码 255)
  • 影响面: 仅 CodeCheck 1 个 Job 失败,其余步骤(初始化 / Checkout ×2 / 后处理)均成功,无其他独立失败
  • 处置建议: 由 PR 提交者 @wychencc_ 按 openlibing 看板给出的违规项修复后重新触发流水线
  • 排除项: Checkout 正常、无平台错误码、无网络/镜像/依赖异常,非环境问题

失败根因分析

根因 #1: 代码问题 / 代码检查错误 — openlibing CodeCheck 结果 no pass
  • 判据: codecheck result: no pass / Process exited with code 255
  • 定位步骤: 3_codecheck.log
  • 影响 Job: CodeCheck
  • 根因证据(日志原文):
[2026-11-23 16:01:46.118] 响应: {"code":"200","msg":"success","data":"https://www.openlibing.com/...","state":"no pass","failData":null,...}
[2026-11-23 16:01:46.119] {"result": "no pass", "url": "https://www.openlibing.com/apps/entryCheckDashCode/MR_c9ebb13c643843f6a51001d4ac98329a/9f2578ac795c6ed66eaafa7d0dc89973?projectId=300033&codeHostingPlatformFlag=gitcode"}
[2026-11-23 16:01:46.120] codecheck result: no pass.
[2026-11-23 16:01:46.139] ::error::Process exited with code 255
  • 检查范围: PR#428 本次变更文件(codecheck 对这些文件做增量静态检查)
文件 变更
docs/changelog.d/428.fixed.md +1
plugins-official/ops-perf-optimize/skills/ops-perf-optimize-workflow/scripts/experience_reflux.py +10 / -2
plugins-official/ops-perf-optimize/tests/test_experience_reflux.py +61 / -3
结构化定界摘要
[{"repo": "cannbot", "run_number": 1221, "Failed_Type": "代码问题", "Failed_Sub_Type": "代码检查错误", "Failed_Reason": "openlibing CodeCheck 返回 no pass: PR#428 变更文件(experience_reflux.py 及其测试/changelog)未通过静态代码检查", "evidence": "codecheck result: no pass. ::error::Process exited with code 255", "suggestion": "按 openlibing 看板逐条违规项修复后重新触发流水线", "jobs": "CodeCheck"}]

由门禁失败定界分析自动生成 | repo: cannbot | run: 4e0ea3cf57b143c98cd1ec231b076def | PR#428

likedislike
wychenwychen
7 days ago Pre merge succeeded (commit_id: e3fbef08f17a8e282eb60725d6060b452494fbf8)
wychenwychen
7 days ago Pushed 1 commits:0ddc0d31-test(ops-perf-optimize): avoid shadowing the installed fixture
wychenwychen
7 days ago Pre merge succeeded (commit_id: 553d88d2d20598de14ce07ec502585b006b8c9c0)
CANN-robotCANN-robotCollaborators
7 days ago Removed label: cann-cla/yes
CANN-robotCANN-robotCollaborators
7 days ago Added label: cann-cla/yes
wychen
wychen
7 days ago Comments:

/compile

likedislike
wychenwychen
7 days ago Pre merge succeeded (commit_id: 278a0950fdb5dbe36c4444e2564da14308ac39e2)
CANN-robot
CANN-robotCollaborators
7 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
7 days ago Removed label: ci-pipeline-failed
CANN-robotCANN-robotCollaborators
7 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
7 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
7 days ago Added label: ci-pipeline-passed
chendunyang
chendunyangCollaborators
7 days ago Comments:

/lgtm

likedislike
hanrui22
hanrui22Collaborators
7 days ago Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
7 days ago Added label: lgtmapproved
CANN-robotCANN-robotCollaborators
7 days ago Closed associated issue
CANN-robotCANN-robotCollaborators
7 days ago Merged pull request