Skip to content

docs(skills): add development review checks - #323

Merged
SigureMo merged 10 commits into
redai-studio:mainfrom
cattidea:codex/review-agent-principles
Oct 6, 2026
Merged

SigureMo merged 10 commits into
redai-studio:mainfrom
cattidea:codex/review-agent-principles

Conversation

@SigureMo

@SigureMo SigureMo commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

What

完善 Relax 的代码审查技能,让审查同时回答三个问题:改动是否必要、用户得到什么、测试究竟证明了什么。在现有 SOLID 审查之外,增加独立的开发原则与测试质量检查,并加强机器学习语义和验证证据的审查。

  • 仅修改 skills/code-review/ 下的七个 Markdown 文件。
  • references/solid-checklist.md 保持原文逐字节不变;新增检查独立维护。

Why

结构和语法检查容易漏掉不必要的产品限制、含义不清的 CLI、不一致的训练语义,以及由 mock 替代被测能力的测试。本 PR 将 #257、#258 中的审查经验整理为有适用边界的检查提示和示例,贡献者分析与验证要求遵循 #321。

How

  1. 新增需求必要性与用户契约审查

    新增 references/development-checklist.md,在 SOLID 检查之前确认需求来源、可观察行为、现有能力复用和维护成本。调用方和测试本身不能证明新行为有必要;判断过度设计时,需要说明必要行为、额外维护负担,以及能保留必要行为的更小方案。

    区分框架支持的正常行为与一次验收实验的要求,避免把固定数据规模、预定批次或精确重放等实验条件变成正常训练的限制。检查 CLI 的概念、单位、默认值和交互关系,以及数据处理策略、中英文用户指南和 PR 描述是否与实现一致;保留真实输入校验、pair 完整性、DP 分区正确性,以及初始化和恢复时的参考模型身份检查。

  2. 新增测试质量审查

    新增 references/test-quality-checklist.md,检查预期结果是否来自独立依据、测试执行了哪些生产路径、mock 替换了什么,以及回归测试能否让原始错误版本因目标问题而失败。

    例如,假 loader 自己恢复模型、优化器、调度器和 RNG 后再比较 loss,无法证明生产 save/load 路径的恢复正确性。合并或删除测试时,需要明确保留了哪些更强的覆盖,以及它们能检测的独立失败模式。

  3. 强化机器学习语义检查

    扩展 references/python-ml-checklist.md,覆盖监督 token 范围、输入位置与 next-token 目标的坐标偏移、pair/branch/sample/token 计数、全局分母与后端梯度缩放、梯度路径、指标定义、尾批次和重复采样。用独立的小规模数值案例确认算法语义,避免把“运行成功”当作计算正确的证据。

    同时明确 .detach() 与 CPU 标量读取解决的问题不同,避免为移除计算图而在训练热路径引入 .item() 等同步操作。分布式检查关注所选进程组的共同参与和兼容调用,空分母的处理由实际契约决定。

  4. 校准既有检查,减少机械误报和无依据的修改建议

    调整 Python、性能、安全和删除计划的检查提示。函数长度、重复次数、hash、mock 和覆盖率只能作为调查线索;报告问题需要可触发的失败或具体维护负担,不能仅为满足 checklist 而要求拆函数、加缓存、加锁、补 fallback 或添加 epsilon。

    评估扫描、hash、数据复制和额外 forward 的实际规模、执行频率及其保证,检查上层是否已经负责校验、重试或清理。严重程度按实际影响判断,文档错误也可能导致启动失败、训练错误或不安全的恢复。

  5. 精简审查入口,完善证据与复审规则

    主 SKILL.md 从 125 行缩减为 83 行,作为共享入口按改动范围加载七份参考文档。审查 agent 自主理解代码并选择调查方式,skill 提供判断依据,通用调度和发布流程由调用方负责。

    审查意见需包含位置、相关需求或契约、触发条件或具体影响,以及最小下一步。区分作者报告的结果与审查者独立验证的结果,并记录验证版本和限制。复审核对修复与原问题的对应关系,复用已有讨论线程,避免重复报告未变化的问题或不断追加无关的可选润色;已有授权时继续处理,不强制追加修复确认流程。

Validation

内容验证版本:6b596da。以下沿用本 PR 已记录的验证结果:

  • Skill 元数据检查:skill-creator/scripts/quick_validate.py 通过。
  • uvx --python 3.12 pre-commit run --all-files --show-diff-on-failure 通过。
  • git diff --cached --check 和 git diff --check 通过。
  • 检查了七个参考文档链接、目录锚点、代码围栏和改动范围,并确认 SOLID 文件与基线逐字节一致。
  • 人工核对了验收实验与产品契约、派生状态与必要偏移、隐式截断与显式策略、mock 实现与协议验证等示例的适用边界。
  • 未进行真实审查 agent 回放或模型效果评估;上述检查仅验证文档内容与格式。
  • 未运行运行时、重型依赖和多节点 GPU 训练测试,因为本 PR 仅涉及审查技能的 Markdown 文档。

Type of Change

  • Documentation update
This PR is co-authored with @codex (gpt-6.1 sol xhigh)

# 📝 Documentation

- Apply development principles through concrete evidence and explicit boundaries.
- Add contributor verification and follow-up review guidance from issue redai-studio#321.
- Calibrate severity and remove mechanical refactoring, fallback, and ML checklist advice.
- Preserve the existing code-review skill as the shared review entrypoint.

Co-authored-by: Codex <[email protected]>
@rai-studio-bot

rai-studio-bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Nyanpasu 审查看板

审查状态: ✅ 已通过

审查版本: 6b596da

目标分支: main

新 head 6b596da 在合并 main(5b3d4b37,未触及 skills/)之后新增内容提交「docs(skills): ground review in user contracts」:SKILL.md 重构为 83 行共享入口并以 Review Lenses 表加载全部 7 个 references(新增 test-quality-checklist.md);development-checklist 增加产品/验收边界与 CLI 契约检查;python-ml-checklist 增加 Learning Semantics 章节。已复核新增内容相对已通过版本 ceef39b 的完整 diff、全部引用与锚点、跨文件口径一致性、PR 描述与实际内容的逐条对应性;未发现需要修改的问题。CI 必需检查仍在运行(无失败),文档变更无需训练/GPU 测试。

审查阶段进度范围与结果
常规审查 ✅ 已完成 已核对新 head 6b596da 相对已通过版本 ceef39b 的全部新增内容(SKILL.md 重构、development/test-quality/python-ml/code-quality/removal-plan 的新增与校准)、Review Lenses 7 个引用的接线与全部 Contents 锚点、removal-plan 引用的 Severity Levels 保留、solid-checklist.md 与 main 逐字节一致(sha256)、merge commit 未触及 skills/、PR 描述 How 各要点与实际内容对应、行尾/结尾换行等 pre-commit 相关项,以及 CI 状态(无失败);未发现需要修改的问题。
深度审查 ✅ 已完成 纯文档变更规模小且内聚,由父任务直接完成必要性审计与比较(SKILL.md 重构、新增 test-quality-checklist 与 development-checklist 扩展、四个既有 checklist 校准的保留决策及证据见简化审计);未派发独立设计或测试子任务——无运行时代码、无新抽象、diff 无测试文件(决策记录见 review-plan)。

没有未解决的审查问题。

提交范围 · 接收 7 · 建议移出 0 · 待确认 0

接收 7 个文件 · 建议移出 0 个文件 · 待确认 0 个文件。移出与待确认部分暂停深审,不代表审查通过。

文件结论仓库维护必要性依据替代去向或方案
skills/code-review/SKILL.md
skills/code-review/references/development-checklist.md
skills/code-review/references/test-quality-checklist.md
接收 skills/code-review 是仓库维护的 code-review 技能(AGENTS.md 技能表登记为 git 变更审查入口)。SKILL.md 是技能入口,在 Review Lenses 中加载 development-checklist.md(SKILL.md:49)与新增的 test-quality-checklist.md(SKILL.md:55);两者是本 PR 的核心交付:必要性与用户契约检查、测试质量与验证证据指引。 PR #323 描述(What/How:新增 development 与 test-quality 检查、SKILL.md 缩减为共享入口);调用方 skills/code-review/SKILL.md:49,55;AGENTS.md 技能表 code-review 条目 将检查保留在仓库外(PR 证据或外部文档)无法随仓库交付审查工作流;并入 solid-checklist.md 会违反 PR 明确要求该文件与 main 逐字节一致(不在本次变更清单中)。
skills/code-review/references/code-quality-checklist.md
skills/code-review/references/python-ml-checklist.md
skills/code-review/references/removal-plan.md
skills/code-review/references/security-checklist.md
接收 四个既有 checklist 均由 SKILL.md 按变更类型加载(SKILL.md:56-59),本 PR 对它们的修改(测试证据口径、发现需有依据、按可达故障与既有契约校准指导)需与重构后的 SKILL.md 保持一致,属同一职责的必要更新。 PR #323 描述(How:保留并校准既有 Python/安全/移除指导,发现需有可达故障或具体维护负担);调用方 skills/code-review/SKILL.md:56,57,58,59 不更新既有 checklist 会使各领域提示词与新的 SKILL.md 证据要求相互矛盾;拆分为独立 PR 会在同一审查流程中造成前后不一致。
精简审查与验证依据
审查范围进度结论
生产代码 ✅ 已完成 对 7 个 Markdown 文件逐一检查了可删除、合并或替换的内容:SKILL.md 本轮即在做精简(删除编号工作流、固定输出模板与 Resources 表),新增检查与既有校准均有明确需求来源和调用方(Review Lenses 分范围加载),保留全部内容;未发现可简化项。
测试 ➖ 无需执行 本 PR 仅修改 skills/code-review/ 下的 Markdown 审查指引,diff 中无测试文件,测试必要性审计无适用范围。作者以 skill-creator quick_validate.py 与 pre-commit 验证;本地已复核文件结尾换行与行尾空白等适用钩子。

生产代码的必要性与替代方案

范围必须保留的契约更简单的方案结论依据与限制
skills/code-review/SKILL.md 的结构性重构(编号工作流 1-10 改为 Establish Context / Review Lenses / Contributor Evidence / Follow-up Reviews / Output,缩减至 83 行,删除固定输出模板、edge cases 与 Resources 表) SKILL.md 是技能入口(frontmatter 由技能系统加载),Review Lenses 表按范围加载全部 7 个 references;removal-plan.md:6 引用其 Severity Levels 定义(已确认保留);AGENTS.md 技能表登记。 保留编号工作流、edge cases 与固定输出模板,或将通用编排内容并入各 checklist。 保留 删除固定模板与通用编排(大 diff 分批、输出格式)是 PR 描述声明的交付方式(调用 harness 拥有通用调度);83 行与 PR 声明一致(已核对);Review Lenses 的 7 个引用全部存在且锚点解析正确(脚本核对);removal-plan 引用的严重度表保留。局限:skill 的实际模型回放效果未验证(作者亦如此声明)。
skills/code-review/references/development-checklist.md 的新增章节(Product and Acceptance Boundaries、CLI and User Documentation)与 3 个新校准示例 SKILL.md:49 首先加载该文件以建立必要性与用户契约;内容对应 #257/#258 审查教训。 并入 SKILL.md 或 solid-checklist.md。 保留 PR Why/How 明确以 #257、#258 教训表达为条件式指导;每个 How 要点与实际内容一一对应(已逐条核对);并入 SKILL.md 违反其缩减为入口的设计,并入 solid-checklist.md 违反逐字节一致约束(sha256 已核对与 main 一致)。
skills/code-review/references/test-quality-checklist.md(新增 37 行:风险/预言机/执行、边界选择表、mock 与实现断言、保留/合并/删除、4 个校准示例) SKILL.md:55 Review Lenses 表按「Tests and verification claims」范围加载;SKILL.md:67 的 Contributor Evidence 引用 test-quality reference。 并入 development-checklist.md 或不新增该文件。 保留 PR How 明确要求新增该文件并描述其全部小节;与 SKILL.md 的 Contributor Evidence 章节及 removal-plan.md:8 的口径一致;与 development-checklist 职责不同(测试证据 vs 开发必要性),分文件支持按范围加载。
python-ml-checklist 新增 Learning Semantics 章节、code-quality 成本核算条目、removal-plan 测试保留条目等既有 checklist 校准 均由 SKILL.md Review Lenses 按范围加载(:55-59),提供各领域具体检查提示词。 不更新既有 checklist,仅交付新文件与 SKILL.md 重构。 保留 旧措辞(Loss 必须机械乘 num_microbatches/global_batch_size/DP 等因素、除零一律拒绝、.detach() 与 CPU 标量读取不区分)与新的契约导向口径矛盾;新口径跨文件一致(code-quality:92 与 python-ml:100 同为「按契约选择」;removal-plan:8 与 test-quality 的保留更强覆盖口径一致)。已检查 removal-plan:8 与 test-quality:29 的近似重复:分别服务于移除与测试两种加载语境,属有意的交叉强化,保留。
Powered by Nyanpasu with glm-5.3[1m] xhigh, please check the suggestions carefully.

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查结论:APPROVE

本 PR 为纯文档变更,仅更新 skills/code-review/ 下的 6 个 Markdown 文件,重构代码审查技能的开发原则、证据与判断标准,方向与 #321 一致。

审查要点:

  • 内容内部一致:SKILL.md 底部引用表与新章节(新增「Evidence and Judgment」「Contributor Evidence」「Follow-up Reviews」)对应;各 checklist 新增的 Contents: 锚点均能正确解析到实际标题。
  • 严重度分级、REQUEST_CHANGES/COMMENT/APPROVE 建议与 GitHub 事件解耦的表述清晰、无矛盾。
  • 无正确性、兼容性、安全或分布式相关风险;不涉及运行时代码,无需训练/GPU 测试。

CI 单元测试仍在进行中,但与本文档变更无关。无可执行的审查发现。

Powered by Nyanpasu with claude-opus-5-google[1m] medium, please check the suggestions carefully.

# 📝 Documentation

- Remove the external project attribution from development principles.

Co-authored-by: Codex <[email protected]>

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查结论:APPROVE

已在新 head(1b5d3aa6)完成复审。本次 synchronize 新增的提交仅从 solid-checklist.md 的「Development Principles」章节删除一行外部项目署名,为纯文档修改。

  • 原则表格独立成立,删除后无残留失效引用或断链;
  • 此前审查的其余 5 个文件内容未变,结论继续有效;
  • 不涉及运行时代码,无正确性/兼容性/安全/分布式风险,无需训练或 GPU 测试。

无可执行的审查发现。

Powered by Nyanpasu with claude-opus-5-google[1m] medium, please check the suggestions carefully.

# 📝 Documentation

- Trace requirements to official tasks and confirmed decisions before adopting contributor or bot expansions.
- Review the necessity of new behavior through input contracts, real use cases, and removal consequences.
- Separate impact severity from acceptance blockers and require evidence for blocking P2 findings.
- Add calibration examples and ask contributors to investigate recurring causes across their changes.

Co-authored-by: Codex <[email protected]>

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已完成对 0ddf986a 的复审,未发现需要修改的问题。新增指导明确区分需求依据、行为必要性与问题严重度,三个校准示例与正文一致,并保留既有契约和外部输入校验的适用边界。

本地增量 git diff --check 与当前提交的 Pre-commit CI 均通过;其余 CI 仍在运行。本次仅修改 Markdown,未运行训练或多节点 GPU 测试,也未验证实际 bot 回放效果。

Powered by Nyanpasu with gpt-6-astra medium, please check the suggestions carefully.

# 📝 Documentation

- Merge overlapping design, SOLID, smell, and refactoring guidance into one principles table.
- Retain caller-contract, interface, ownership, and dependency checks with three short calibration examples.
- Remove task-specific examples and repeated workflow guidance; keep necessity and provenance checks in the main skill.
- Explicitly check existing project capabilities before accepting new behavior.

Co-authored-by: Codex <[email protected]>

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复审 2faaa675,未发现需要修改的问题。合并后的原则表保留了调用契约、接口职责、状态归属与依赖检查;正文仍要求核实需求来源、反证和验证依据,未发现被删除章节的残留引用。

本地增量 git diff --check 和当前提交的 Pre-commit CI 通过,其余 CI 尚在运行。本次仅改 Markdown,未运行训练或多节点 GPU 测试;实际 bot 回放效果未验证。

Powered by Nyanpasu with gpt-6-astra medium, please check the suggestions carefully.

SigureMo and others added 2 commits September 20, 2026 01:21
# 📝 Documentation

- Restore the explicit preference for pure functions and immutable data while keeping the boundary for justified tensor mutation.
- Retain composition and delegation over inheritance, including the repository's depth limit, in the consolidated principles table.

Co-authored-by: Codex <[email protected]>
# 📝 Documentation

- Restore the original SOLID checklist byte for byte, including its code smells and refactoring heuristics.
- Add a separate development checklist for necessity, input contracts, existing capabilities, and development principles.
- Load development and SOLID checks as separate workflow steps and update resource references.

Co-authored-by: Codex <[email protected]>
@SigureMo SigureMo changed the title docs(skills): refine code review principles docs(skills): add development review checks Sep 19, 2026

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复审 9c94939d,未发现需要修改的问题。独立的 development checklist 已接入流程;SOLID 文件与 PR 前版本逐字节一致,正文仍要求以具体证据判断问题,避免仅凭设计偏好提出修改。

已本地核对全部 6 个 checklist 引用、流程编号及增量 git diff --check;当前提交的 Pre-commit CI 通过,其余 CI 尚在运行。纯 Markdown 变更未运行训练或多节点 GPU 测试,实际 bot 回放效果未验证。

Powered by Nyanpasu with gpt-6-astra medium, please check the suggestions carefully.

# 📝 Documentation

- Check adherence to existing project patterns, user-facing configuration costs, and the effort needed to understand an operation.
- Extend existing failure and abstraction guidance to unnecessary compatibility promises and speculative extension points.
- Require overdesign findings to identify added maintenance obligations and a smaller alternative meeting the same acceptance criteria.
- Keep the original SOLID checklist unchanged.

Co-authored-by: Codex <[email protected]>

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复审 e5d7e3b5,未发现需要修改的问题。新增复杂度检查要求比较实际收益与维护成本,并提出保留验收标准的更小方案;必要配置、既有兼容性和真实故障处理的边界仍明确,与正文的证据要求一致。

本地增量 git diff --check 和当前提交的 Pre-commit CI 通过,其余 CI 尚在运行。纯文档变更未运行训练或多节点 GPU 测试,实际 bot 回放效果未验证。

Powered by Nyanpasu with gpt-6-astra medium, please check the suggestions carefully.

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查结论:APPROVE

已在新 head ceef39b1(合并 main 的 merge commit)完成复审。PR 相对 main 的 diff 与上一轮已通过的 e5d7e3b5 逐字节一致,main 侧新提交未涉及 skills/;已复核 SKILL.md 步骤接线与引用表、四个 checklist 的 Contents 锚点、removal-plan.md 引用的严重度定义,solid-checklist.md 保持与 main 一致。当前 head 的 Pre-commit 与 Python 单测 CI 通过,两个 GPU 集成测试仍在运行(仅覆盖 main 侧代码,与本次 Markdown 变更无关)。未发现需要修改的问题。

审查看板:#323 (comment)

Powered by Nyanpasu with glm-5.3[1m] xhigh, please check the suggestions carefully.

SigureMo and others added 2 commits October 4, 2026 17:53
# 🔩 Chore

- Merge main at 823941b into the existing PR323 history without conflicts.
- Preserve the PR's development checks and original SOLID checklist.
- Validate the merged tree with all pre-commit hooks.

Co-authored-by: Codex <[email protected]>
# 📝 Documentation

- Keep the review agent responsible for understanding and investigation,
  and replace procedural repetition with focused review references.
- Expand necessity checks for product versus acceptance boundaries, CLI
  contracts, user documentation, and smaller behavior-preserving alternatives.
- Add test-quality guidance for independent expectations, production execution,
  mock boundaries, regression evidence, and retained stronger coverage.
- Check learning semantics, global denominators, metric definitions, and
  running costs without prescribing defensive gates or mechanical fixes.
- Preserve the original SOLID checklist byte for byte.

Co-authored-by: Codex <[email protected]>

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查结论:APPROVE

已在新 head 6b596daa 完成复审。本次 synchronize 在合并 main(5b3d4b37,未触及 skills/)之后新增内容提交「docs(skills): ground review in user contracts」,其相对已通过版本 ceef39b1 的变更已全部复核:SKILL.md 重构为 83 行共享入口并以 Review Lenses 表加载全部 7 个 references(含新增 test-quality-checklist.md,引用与锚点均可解析);development-checklist.md 新增产品/验收边界与 CLI 契约检查;python-ml-checklist.md 新增 Learning Semantics 章节;既有 checklist 的校准与新的证据要求口径一致(removal-plan.md 引用的 Severity Levels 保留);solid-checklist.md 与 main 逐字节一致(sha256 核对),PR 描述各 How 要点与实际内容逐条对应。未发现需要修改的问题。当前 head 的必需 CI 仍在运行且无失败;纯文档变更无需训练/GPU 测试。

审查看板:#323 (comment)

Powered by Nyanpasu with glm-5.3[1m] xhigh, please check the suggestions carefully.

@SigureMo
SigureMo requested a review from DrRyanHuang October 6, 2026 10:20
@SigureMo
SigureMo merged commit 9194f45 into redai-studio:main Oct 6, 2026
12 checks passed
@SigureMo
SigureMo deleted the codex/review-agent-principles branch October 6, 2026 10:28
Mukayi added a commit to Mukayi/Relax that referenced this pull request Oct 12, 2026
…er-profiler

Brings in upstream/main 653c43c..dce533b (redai-studio#257, redai-studio#258, redai-studio#285, redai-studio#323, redai-studio#330,
redai-studio#335, redai-studio#408, redai-studio#409, redai-studio#412, redai-studio#414, redai-studio#416, redai-studio#417, redai-studio#419-redai-studio#421, redai-studio#424, redai-studio#426, redai-studio#427,
redai-studio#430, and 42 commits synced on 10-12 without PR numbers).

The only conflict is relax/utils/env.py: cc4b052 adds the DeepSeek-V4
MXFP4 QAT variables at the same spot where this branch adds the straggler
profiler variables. Resolved by keeping both blocks, straggler first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants