Skip to content

ci(bypass): add reusable bypass gates - #394

Merged
SigureMo merged 2 commits into
codex/ci-rerun-cancelfrom
codex/ci-bypass
Oct 1, 2026
Merged

SigureMo merged 2 commits into
codex/ci-rerun-cancelfrom
codex/ci-bypass

Conversation

@SigureMo

@SigureMo SigureMo commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

What

通过 ShigureLab/ci-bypass@v2 判断 CI team 的标签或评论豁免,并在 synchronize 时独立清理 bypass 标签。

Why

将豁免判断集中到可复用 workflow,由 ci-bypass 处理规则匹配与授权检查,CI workflow 根据结果决定是否运行测试。

How

  • 可复用 check-bypass.yml 在 ubuntu-slim 上运行,CPU、GPU unit 和 integration workflow 分别传入 target。
  • 从共享 JSON 读取三人 CI team,支持 workflow/all 标签和 /bypass 评论,理由可选。
  • 使用 ShigureLab/ci-bypass@v2,不锁定具体 commit。
  • 独立 synchronize workflow 分页获取并移除 ci-bypass: 标签。历史 bypass 评论仍遵循上游规则。
  • Gate 失败时运行原测试;只在 gate 成功且明确输出 can-skip=true 时跳过测试,workflow 取消后不继续启动测试。

原生 gh-stack 第 3/6 层,base 为 #393。豁免与维护操作记录在 #396 的 skill 参考页。

Testing

全量 pre-commit 和 actionlint 已通过。

未在本地运行 pytest tests/ 或 GPU/NPU 训练:本次涉及 CI 自动化与文档。欢迎/评论指令的真实 GitHub 交互需进入默认分支后验证。

  • pre-commit run --all-files passes
  • Tests pass (pytest tests/)
  • New tests added (if applicable)
  • Documentation updated (if applicable)

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • CI/CD or build changes

Screenshots / Logs

This PR is co-authored with @codex (gpt-6-astra, reasoning: xhigh).

@SigureMo
SigureMo added this pull request to stack #397 September 30, 2026 17:05
@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

  • The trigger contains no follow-up change request beyond the implementation already present in commit 0f0994d (ci(bypass): scope exemptions to the PR commit).
  • Confirmed that the branch already implements commit-scoped bypass authorization, including exact-SHA bot grants, bot-applied labels, optional reasons, stale-label cleanup, and workflow reruns. .github/ci/bypass.jsL4-L120
  • Confirmed that the composite bypass gate uses the pinned ShigureLab/ci-bypass commit. .github/actions/check-bypass/action.ymlL1-L36
  • Confirmed test coverage for reasonless requests, head changes, exact-SHA validation, spoofed authorization rejection, and stale-label handling. .github/ci/tests/bypass.test.jsL1-L144
  • The working tree remains clean. Because no additional changes were requested or necessary, I did not create another commit or a duplicate pull request.

Testing

  • ✅ node --test .github/ci/tests/*.test.js — all 20 tests passed.
  • ✅ git diff --check 879ff737e48189f7f61658959e48cc972340d963..HEAD
  • ✅ git status --short --branch — clean working tree on work.
  • ⚠️ pre-commit run --all-files --show-diff-on-failure — could not run because pre-commit is not installed in the environment.
  • ⚠️ Hardware-backed online gate and GPU/NPU execution were not run because no configured test PR or hardware environment was provided.

View task →

Comment thread .github/ci/tests/bypass.test.js Resolved
Comment thread .github/ci/bypass.js Resolved
Comment thread .github/ci/config.json Resolved
Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/actions/check-bypass/action.yml Resolved
Comment thread .github/actions/check-bypass/action.yml Resolved
@SigureMo SigureMo changed the title ci(bypass): scope exemptions to the PR commit ci(bypass): reuse Paddle workflow structure Sep 30, 2026
Comment thread .github/workflows/check-bypass.yml Resolved
Comment thread .github/workflows/check-bypass.yml Resolved
Comment thread .github/workflows/ci.yml Resolved
@SigureMo SigureMo changed the title ci(bypass): reuse Paddle workflow structure ci(bypass): add reusable bypass gates Sep 30, 2026
@SigureMo
SigureMo marked this pull request as ready for review September 30, 2026 20:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T09:12:53.615588Z 65458f8 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1434fdd8d4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +4 to +5
pull_request_target:
types: [synchronize]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Clear bypass labels before evaluating the new head

On a synchronize event, this cleanup workflow and the ci.yml, unittest.yml, and integration-test.yml workflows are scheduled independently, so nothing guarantees that label removal finishes before their new bypass jobs inspect the PR. If the previous head had an authorized ci-bypass: label, a gate can observe that stale label and skip checks for the newly pushed commit, defeating the intended invalidation. Perform the cleanup in an ordered prerequisite of each gate, or make the gate reject label exemptions that predate the current head.

AGENTS.md reference: AGENTS.md:L73-L80

Useful? React with 👍 / 👎.

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.

High severity P1 · 在 gate 内做时效判定,消除清理竞态

独立复核确认此问题成立(当前 head dfbaa2a 上代码未变),补充时序观测与修复方向:

  • 上游 ci-bypass@v2 的 labeled 规则匹配的是"当前标签列表" + 最近一次 labeled 事件的 actor(src/rules/label.ts),删除标签是本设计唯一的失效手段;而同一 synchronize 事件会独立触发本 workflow 与三个 CI workflow,GitHub 不保证跨 workflow 顺序。
  • 时序实测(本 PR head 9aa4ec8 的真实运行):gate job 全程 12 秒(runner 启动 + checkout + config + action),与本清理 workflow(无 checkout、两个分页 API 步骤)时长相当——谁先完成取决于调度,是掷硬币而非保证。另注意 pull_request_target workflow 仅在默认分支版本上生效:合入 main 前本 workflow 实际从未运行(仓库中零次运行记录),引导期内标签根本不会被清理。

修复方向——把时效判定放进 gate(确定性、与清理时序无关):

  • 在 config 步骤读取 PR timeline,取最后一次 push(head_ref_synchronize / head_ref_force_pushed 事件时间)作为 anchor;仅接受晚于 anchor 的 labeled / /bypass 评论信号,更早的信号视为未授权(fail-closed → 测试照常运行,并提示重新授权)。注意不要用 commit 日期作 anchor——它可被伪造回填。
  • 该规则同时统一了评论路径的失效语义(当前评论豁免永久有效、只能靠删评论撤销;若这正是预期行为可仅对标签生效)。
  • 有了 gate 内时效判定后,本清理 workflow 可降级为纯 UI 卫生(或删除),失效正确性不再依赖两个 workflow 竞速。

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@rai-studio-bot 这样有一个问题,虽然状态维护都放在了 ci-bypass 里,但是其对于失效效果并没有明显的标注

比如 comment,如何让别人知道一个 comment 已经失效了?必须翻日志

比如 label,如何让别人知道一个 label 已经失效了?也必须翻日志

对此有什么想法吗?

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.

好问题——判定权威放 gate 后,失效确实成了"看不见的判定"。可以把可见性拆成显示层解决,gate 仍保持只读、无状态:

1. Label 的失效标记:本 PR 的清理 workflow 本身就是答案。
remove-ci-bypass-labels.yml 在 synchronize 时把 ci-bypass:* 标签从 PR 页移除——"标签消失 = 已失效"就是原位可见信号,不需要翻日志。所以我不建议删除它,而是降级定位:gate 内 anchor 负责判定正确性(竞态免疫),清理 workflow 负责可见性,两者互补。

2. Comment 的失效标记:不能删别人评论,但可以轻量原位标记。

  • 轻量做法(推荐):清理 workflow 检测到 /bypass 评论早于 anchor 时,给该评论加一个固定反应(如 👎),语义写入 docs(skills): guide CI operations through APIs #396 的维护文档("👎 = 已因新提交失效")。issues: write 即可调反应 API,非破坏性、原位可见。
  • 显眼做法:在过期评论下回一条 bot 短评("此 /bypass 已因新提交 <sha> 失效,如需豁免请重新评论"),只在 gate 实际因它拒绝跳过时回一条以免刷屏。
  • 更进一步:授权时就把范围写在明面上——若 /bypass 也走 ci-commands 的可信 dispatcher(issue_comment + 默认分支检出),校验通过后由 bot 回评"已授权,生效于 head <sha>"并打标签;之后任何人对比 bot 回评里的 sha 与 PR 当前 head 就能一眼判断是否失效。注意这只是显示层收敛:判定仍需 gate 内 anchor(dispatcher 打标签的方案无法自行失效,竞态问题依旧)。

3. 通用审计记录:gate 的 job summary。
无论上面做不做,都建议在判定脚本里写 $GITHUB_STEP_SUMMARY:anchor(最近一次 push 的时间与 sha)、每个信号的有效/失效及原因、最终 can-skip。PR checks 页点开 "Check CI bypass" 即见结论与依据,比翻原始日志轻得多。

边界提醒:打标记(删标签/加反应/回评)的写操作都放在 pull_request_target 清理 workflow(已有 issues: write,合入默认分支后生效);gate 保持只读,这样 fork PR 的只读 token 下 gate 也能正常跑,写操作失败也不影响判定正确性。

@SigureMo

Copy link
Copy Markdown
Member Author

已核对取消原因:concurrency group 为 gpu-integration-refs/pull/394/merge,已按 workflow 和 PR 隔离。同一 head 1434fdd 在同一秒产生两轮 Integration Tests;较大编号的 #258 在开始步骤前被取消,继续执行的 #256 已成功。该旧 head 的 8 项 required checks 也全部通过,因此保留现有 concurrency key。

修复了这次场景暴露的指令选取问题,见 #393 的 2ff596e:同一 PR/head/workflow 下,优先选择活跃 run,其次选择未取消的 run,各组按 run number 取最新值;仅剩取消的 run 时仍允许显式重跑。这样 /cancel 和 /rerun 不会被高编号、已取消的重复 run 遮住实际运行。#396 的 skill 说明已同步。

以本次真实运行数据构造的 6 个针对性场景、原有 Node 冒烟检查和全量 pre-commit 均通过。修复已随 stack 推送;新 head 的 CI 将单独验证。

This reply was automatically generated by @codex.

@chatgpt-codex-connector

Copy link
Copy Markdown

处理结果

  • 触发内容是对既有修复和真实 CI 运行结果的总结,没有提出新的修改请求。
  • 当前分支已保留按 workflow/PR 隔离的 concurrency key,并继续使用 fail-safe bypass 条件:只有 gate 成功且明确返回 can-skip=true 时才跳过测试。 .github/workflows/ci.ymlL10-L12 .github/workflows/ci.ymlL25-L30
  • Bypass gate 仍使用 ShigureLab/ci-bypass@v2,并支持当前 target 或 all 的标签与评论规则。 .github/workflows/check-bypass.ymlL42-L60
  • 工作区保持干净,没有需要提交的新变更。依照要求,未创建空提交,也未调用 make_pr 创建重复 PR。

Testing

  • ✅ git diff --check 2ff596e..HEAD
  • ✅ git status --short --branch
  • ⚠️ pre-commit run --all-files --show-diff-on-failure(当前环境未安装 pre-commit,命令返回 pre-commit: command not found)
  • ⚠️ pytest tests/(未运行;本次没有代码变更,且相关 integration 测试需要多节点 GPU 硬件)

View task →

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9aa4ec8cfb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +36 to +37
const { default: config } = await import(
`${process.env.GITHUB_WORKSPACE}/.github/ci/config.json`, { with: { type: 'json' } });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Read the authorization list from a trusted revision

On pull_request runs, actions/checkout checks out the PR merge ref, so this import trusts .github/ci/config.json from the proposed change. A PR author can add their own login to ciTeam, post /bypass all, and make the gate return can-skip=true, skipping the pre-commit, CPU, GPU, and integration jobs without belonging to the authorized team. Load the allowlist from the default branch or another immutable trusted source before passing it to the action.

AGENTS.md reference: AGENTS.md:L74-L74

Useful? React with 👍 / 👎.

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.

High severity P1 · 从可信 revision 读取授权名单

独立复核确认此问题成立(当前 head dfbaa2a 上代码未变),补充验证证据与修复建议:

  • 本 PR 实际运行的元数据显示,该 reusable workflow 经调用方 uses: ./.github/workflows/check-bypass.yml 解析到 refs/pull/394/merge(run 36772774073 的 referenced_workflows),actions/checkout 默认检出的也是 merge ref。因此 ciTeam 与判定逻辑都来自 PR 自身内容。
  • 攻击链完整:PR 把自己的登录名加入 .github/ci/config.json 的 ciTeam(校验步骤只要求非空,不会拦),再评论 /bypass all——上游 ci-bypass@v2 的 CommentRule 直接将评论者与 username 列表比对,即可得到 can-skip=true,pre-commit / CPU / GPU unit / integration 全部跳过(被跳过的 job 对必需检查呈中性,PR 可在零测试信号下进入可合并状态)。

修复建议(两层,最小改动优先):

  1. 数据可信:config 步骤改用 contents API 从基线 revision 读取(github.event 会随 workflow_call 传入),并顺带删掉 checkout——gate 只需要这一个 JSON:
const ref = context.payload.pull_request?.base.sha ?? context.sha;
const { data: file } = await github.rest.repos.getContent({
  ...context.repo, path: '.github/ci/config.json', ref,
});
const config = JSON.parse(Buffer.from(file.content, 'base64').toString());
  1. 代码可信(可选加固):本 workflow 文件本身也来自 merge ref(PR 可直接改写判定规则)。若要让"跳过"信号完全可信,调用方可改用带 ref 的远程引用(如 uses: redai-studio/Relax/.github/workflows/check-bypass.yml@<trusted-ref>)从基线/默认分支解析 gate;需注意 stack 引导期 gate 尚未进入 main 的取舍,以及 uses ref 是否支持表达式需按文档确认。

基线中的 ci-commands.yml(#393)已采用 ref: ${{ github.event.repository.default_branch }} 并注明 "Comment events execute only trusted default-branch code",建议保持同一模式。

@SigureMo SigureMo Oct 1, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

已知问题,Paddle 已经使用很久,这里无需处理,否则后续维护困难

@rai-studio-bot

rai-studio-bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Nyanpasu 审查看板

审查状态: 🚧 需要修改

审查版本: 16c1b29

目标分支: codex/ci-rerun-cancel

审查结论维持 REQUEST_CHANGES。本轮 synchronize 仍为 stack 重定基(整条 stack 重建,main 上合入的 contributing 文档更新等进入下层):本 PR 的 5 个文件与已发布审查的 head 逐字节一致(blob SHA 复核),两个 P1(授权名单可被 PR 自身改写;标签失效清理与 gate 竞态)与一条 P3(并发 removeLabel 404)均未解决、内容不变,既有讨论串为规范讨论处。原始 review 见 [pullrequestreview-5372436994](https://github.com//pull/394#pullrequestreview-5372436994)。

审查阶段进度范围与结果
常规审查 ✅ 已完成 已复核 16c1b29 相对 bb59f3e 的 diff:5 个文件与已审 head 236b3c5/dfbaa2ae 逐字节一致(+152 行不变),既有的全量审查证据经核对仍然适用;本轮无新增代码内容需要深审。
深度审查 ✅ 已完成 独立设计比对与生产/测试必要性审计沿用已验证结论(文件逐字节一致,责任与需求未变);本轮无触发修订的事项。

审查发现

待处理
编号 严重性 问题状态规则来源
F1 High severity 授权名单可被 PR 自身改写:ciTeam 需从可信 revision 读取 🚧 未解决 —
F2 High severity 标签失效清理与 bypass gate 竞态:应在 gate 内做时效判定 🚧 未解决 —
已解决或已取代
编号 严重性 问题状态规则来源
暂无已解决或已取代的记录。
提交范围 · 接收 5 · 建议移出 0 · 待确认 0

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

文件结论仓库维护必要性依据替代去向或方案
.github/workflows/check-bypass.yml
接收 可复用 bypass gate 是本 PR 的核心需求:三个生产 CI workflow 通过 workflow_call 调用它判定豁免。与已审轮次(head 9aa4ec8 至 236b3c5)职责与需求完全一致,本轮 5 个文件逐字节相同,仅为整条 stack 重建式重定基(含 main 上合入的 contributing 文档更新进入下层)。 PR #394 描述(可复用 check-bypass.yml,CPU/GPU unit/integration 分别传入 target);调用方 ci.yml/unittest.yml/integration-test.yml 的 bypass job。 仅作为外部 action 或 PR 附件无法接入仓库内三个 CI workflow 的 job 级 gating。
.github/workflows/ci.yml
.github/workflows/unittest.yml
.github/workflows/integration-test.yml
接收 将 gate 接入仓库 CI 的最小改动(新增 bypass job 与 fail-closed 条件),测试 job 本身未改。职责与需求与已审轮次一致。 PR #394 描述(Gate 失败时运行原测试;仅 can-skip=true 时跳过);基线中三个 workflow 的既有 job 结构。 不改这三个文件则 gate 无法生效;无其他仓库内机制可复用。
.github/workflows/remove-ci-bypass-labels.yml
接收 实现需求中 synchronize 时清除 bypass 标签的失效机制;pull_request_target workflow 需进入默认分支才能运行。职责与需求与已审轮次一致。 PR #394 描述(独立 synchronize workflow 分页获取并移除 ci-bypass: 标签)。 不设清理 workflow 则标签豁免在新提交上永不失效;上游 action 的 labeled 规则只读当前标签,无法自行失效。
精简审查与验证依据
审查范围进度结论
生产代码 ✅ 已完成 对全部 5 个接收文件完成必要性比对(作者实现 vs 独立参考设计;两处修复建议与 P1 发现对应)。两处应替换、核心结构保留。
测试 ✅ 已完成 本 PR 无新增或修改测试文件(旧设计的 .github/ci/tests/bypass.test.js 已随重构移除,作者评审轮确认);验证面为 workflow 结构与真实运行。

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

范围必须保留的契约更简单的方案结论依据与限制
.github/workflows/check-bypass.yml 的配置读取路径(checkout merge ref 后 import .github/ci/config.json) 授权名单必须来自可信 revision:仅三人 CI team 可豁免(PR #394 描述);调用方为 ci.yml/unittest.yml/integration-test.yml 的 bypass job。 从可信 revision 读取 config:contents API 以 context.payload.pull_request.base.sha 为 ref,或在 gate 内 sparse checkout 默认分支(参考设计做法,与基线 ci-commands.yml 的可信检出模式一致);前者可同时省去 checkout 步骤。 替换 运行时证据:run 36772774073 的 referenced_workflows 显示 check-bypass.yml@refs/pull/394/merge,checkout 检出 merge ref,PR 可改写 ciTeam 自授权。独立设计(隔离输入)同样从默认分支读取并在 E1/E2 中验证(RISK-03)。限制:API 方案的 fork-PR 读权限未在线上验证(该风险失效方向为 fail-closed)。
.github/workflows/remove-ci-bypass-labels.yml 独立清理 workflow(45 行,synchronize 时移除 ci-bypass: 标签) 标签豁免须在新提交后失效(PR #394 描述);上游 labeled 规则只读当前标签,删除标签是现设计唯一的失效手段。 在 gate 内做时效判定(anchor:信号晚于最后一次 GitHub timeline push 事件才有效;或在现有 config 步骤检测早于 push 的标签并 fail-closed),清理 workflow 降级为纯 UI 卫生或删除——失效正确性不再依赖两个独立触发 workflow 的调度顺序。 替换 两个 workflow 由同一 synchronize 事件独立触发、无顺序保证;实测 gate job 全程 12 秒、清理 job 时长相当,胜负取决于调度。独立设计明确拒绝该竞态方案并以 gate-local anchor 通过 E2 的 5 个过期用例(含 force-push、重加标签)。限制:保留外部 action 且不改其规则时,可在 config 步骤以约 15 行实现同等时效检测。
三个 caller 的 needs/if fail-closed 条件与 ShigureLab/ci-bypass@v2 外部 action 的选型 fail-closed(gate 失败/取消/非 PR 事件均运行测试)与单一可复用 gate(三个 workflow 传入 target)。 自研 composite action 承载全部判定逻辑(独立参考设计的做法,约 440 行补丁)。 保留 外部 action 是作者明确的选型(评审轮确认改用 @v2 tag);现有双层 fail-closed 条件语义已验证(作者评审线程与 E1 断言一致)。补上可信配置读取与 gate 内时效判定后,现有结构即可满足全部需求,整体替换为参考实现收益不足;参考设计本身也确认 caller 侧 PR 可控是既有仓库姿态,无需新增 pinning 机制。

测试的必要性与替代方案

范围必须保留的契约更简单的方案结论依据与限制
本 PR diff 中不存在测试文件;gate 判定逻辑位于上游 ShigureLab/ci-bypass@v2。 CI 配置变更的回归验证:YAML/结构正确性与 gate 在真实事件上的行为。 为 gate 决策逻辑引入本地测试(如独立设计的 26 例决策 harness),或恢复 node --test 测试文件。 保留 判定逻辑在上游 action 内,仓库侧无法对其断言;接线正确性已由真实运行验证(head dfbaa2a 上 CI/Integration/GPU Unit 三个 workflow 全绿,gate job 成功)。actionlint 不在 pre-commit/Makefile 中(作者声明本地手动运行);缺口:结构断言未入仓库(独立设计 E1 可作后续参考),真实豁免路径(标签/评论/清理)仍需合入默认分支后在线上验证——PR 描述已如实声明该限制。
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.

Review 结论:Request changes

本 PR 全部 5 个文件的常规审查与深度必要性审计已完成(独立设计比对已整合)。当前存在两个未解决的 P1:bypass 授权名单可被 PR 自身改写(check-bypass.yml 从 merge ref 读取 ciTeam),以及标签失效清理与 gate 之间无顺序保证的竞态(含 pull_request_target 合入默认分支前不生效的问题)——两者均已在对应讨论串中独立复核并补充证据与修复方向,需在合并前解决。另有一条 P3 行级建议(并发 removeLabel 的 404 容错)。

详情见审查看板(含范围计划与必要性审计):#394 (comment)

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

Comment on lines +39 to +45
for (const name of JSON.parse(process.env.CI_BYPASS_LABELS)) {
await github.rest.issues.removeLabel({
...context.repo,
issue_number: context.issue.number,
name,
});
}

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.

Low severity P3 · 容忍并发 removeLabel 的 404

连续两次 synchronize(本 PR 在 2026-09-30T20:27:38Z 实际出现过同一事件的重复触发)会让两个清理实例都读到同一批标签,后执行删除的一方 removeLabel 返回 404,未捕获的异常会使 job 失败。功能上无碍(标签终会被移除),但会在 PR 时间线上留下持续可见的红色运行。本 workflow 无 concurrency 组,重复实例是真实场景。

Suggested change
for (const name of JSON.parse(process.env.CI_BYPASS_LABELS)) {
await github.rest.issues.removeLabel({
...context.repo,
issue_number: context.issue.number,
name,
});
}
for (const name of JSON.parse(process.env.CI_BYPASS_LABELS)) {
try {
await github.rest.issues.removeLabel({
...context.repo,
issue_number: context.issue.number,
name,
});
} catch (error) {
// 404 = 标签已被并发实例移除;其余错误照常抛出。
if (error?.status !== 404) throw error;
core.info(`Label "${name}" was already removed.`);
}
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

暂不考虑增加太多复杂性

@SigureMo
SigureMo force-pushed the codex/ci-bypass branch 2 times, most recently from 24912f5 to 65458f8 Compare October 1, 2026 09:04
@chatgpt-codex-connector

This comment was marked as spam.

1 similar comment
@chatgpt-codex-connector

This comment was marked as spam.

@chatgpt-codex-connector

This comment was marked as spam.

1 similar comment
@chatgpt-codex-connector

This comment was marked as spam.

SigureMo and others added 2 commits October 1, 2026 21:25
# 🔧 CI/CD

- Evaluate CI team labels and comments directly with ShigureLab/ci-bypass.
- Load workflow targets and the explicit three-person CI team from shared JSON.
- Reuse one lightweight bypass workflow across CPU, GPU and integration CI.
- Remove bypass labels through an independent synchronize workflow based on Paddle.
- Keep rerun and cancel commands independent from bypass evaluation.

Co-authored-by: Codex <[email protected]>
# 🔧 CI/CD

- Reference ShigureLab/ci-bypass by its v2 tag as requested in review.
- Keep label cleanup and gate failure semantics unchanged.

Co-authored-by: Codex <[email protected]>
@chatgpt-codex-connector

This comment was marked as spam.

1 similar comment
@chatgpt-codex-connector

This comment was marked as spam.

@DrRyanHuang DrRyanHuang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTMeow 🐾

@SigureMo
SigureMo merged commit 5cad36b into main Oct 1, 2026
11 of 19 checks passed
@SigureMo
SigureMo deleted the codex/ci-bypass branch October 1, 2026 17:57
SigureMo added a commit that referenced this pull request Oct 1, 2026
## What

<!-- What changes does this PR introduce? -->

集中维护 CI team 与 target 映射,并接入 oxfmt mirror 和共享格式化配置。在 `.github/` 的
CODEOWNERS 中追加 `@SigureMo`,保留原有负责人。

## Why

<!-- Why are these changes needed? Link related issues with "Fixes #123"
or "Relates to #456". -->

后续各功能有独立入口,仅共享必要的数据配置,使维护者能直接看懂配置和各层职责。

## How

<!-- How do the changes work? Describe the technical approach. -->

- `.github/ci/config.json` 仅包含 `ciTeam` 和 workflow/job target
映射,JavaScript 原生读取 JSON。workflow 使用 `ci`、`gpu-unit`、`integration`;job 使用
`ci/pre-commit`、`ci/cpu-310` 等 `workflow/job` 名称,不保留旧短名称别名。
- CI team 为 `SigureMo`、`NINGBENZHE`、`Yangruipis`,使用实际 GitHub login 大小写。
- 保留 `ShigureLab/[email protected]` 和 JavaScript/JSON
类型选择;clang-format 通过 `exclude_types: [javascript, json]` 排除这两类文件。
- oxfmt 配置移到根目录 `.oxfmtrc.json`,参考 [yutto
的格式化选项](https://github.com/yutto-dev/yutto/blob/main/docs/vite.config.ts):100
列、两空格缩进、单引号、ES5 尾逗号、无分号、箭头参数始终加括号,并关闭 package.json 排序。
- 暂时排除既有 `acquire-devices` action 与 `docs/` 的 oxfmt 格式化;这 9 个既有文件的风格
diff 已移到栈顶专门的格式化层 #398,由该层移除临时路径排除,统一格式化 JS/TS、JSON、样式表和 GraphQL,暂不处理
YAML/TOML。
- 本层只包含共享配置、格式化工具配置和 CODEOWNERS,共 4 个文件;指令入口在 #393,bypass 在 #394,欢迎与指南在
#395,skill 在 #396,全仓格式化在 #398。

原生 gh-stack 第 1/6 层,base 为 `main`。

## Testing

<!-- How were the changes tested? Include commands, test results, or
screenshots. -->

本层通过全量 `pre-commit run --all-files`;既有 action 和 docs 文件与 `main` 保持一致,格式化
diff 单独位于栈顶。未新增测试文件。

未在本地运行 `pytest tests/`:本次涉及 CI 自动化及文档,未改动训练代码。

- [x] `pre-commit run --all-files` passes
- [ ] Tests pass (`pytest tests/`)
- [ ] New tests added (if applicable)
- [ ] Documentation updated (if applicable)

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [ ] Refactoring (no functional changes)
- [ ] Performance improvement
- [x] CI/CD or build changes

## Screenshots / Logs

<!-- If applicable, add screenshots or log output to help explain the
changes. -->

<div align="right">
<sup>This PR is co-authored with @codex (gpt-6-astra, reasoning:
xhigh).</sup>
</div>

---------

Co-authored-by: Codex <[email protected]>
Co-authored-by: RAI Studio Bot <[email protected]>
SigureMo added a commit that referenced this pull request Oct 1, 2026
## What

<!-- What changes does this PR introduce? -->

通过独立欢迎 action 提供可展开的贡献入口和日常 CI 指令,并在中英文贡献指南中补充指令表与 target 表。

## Why

<!-- Why are these changes needed? Link related issues with "Fixes #123"
or "Relates to #456". -->

让贡献者直接找到需要的操作说明,维护配置和豁免细节由 agent skill 承载。

## How

<!-- How do the changes work? Describe the technical approach. -->

- 双语欢迎模板保留贡献、CI 两个可展开区域,链接到贡献指南的 CI 章节。
- `WELCOME_BOT_TOKEN` 仅用于欢迎发布;`WELCOME_BOT_LOGIN` 必须显式配置,workflow 与
action 均无账号默认值。发布前校验配置与 token 所属账号,分页去重,在默认分支加载发布代码。
- 在 #302 整理后的中英文贡献指南中新增 CI 章节,放在完整的 PR 描述示例之后、交流与反馈之前,并从创建 PR 步骤链接到 CI
章节。先解释 target 命名,再列出 target 表;表中统一使用 `workflow` / `workflow/job` 命名,补充
`/rerun ci`、`/rerun ci/pre-commit` 与 `all` 的范围示例,并明确取消只接受 workflow。
- 移除独立 CI 页面及侧栏入口;公开欢迎、帮助和贡献指南不展示 bypass 或维护配置。
- 给 agent 的 skill 入口由下一层 #396 放在模板的 HTML 注释中。

原生 gh-stack 第 4/6 层,base 为 #394。

## Testing

<!-- How were the changes tested? Include commands, test results, or
screenshots. -->

全量 pre-commit 和 actionlint 已通过。VitePress 构建、欢迎模板内容检查及 skill
参考链接检查通过;构建仅有既有旧文档链接警告。欢迎 action 冒烟检查覆盖缺失账号、账号不匹配、显式配置账号及重复评论去重。中英文
target 表已逐项核对共享配置,新命名后的 VitePress 构建通过。

未在本地运行 `pytest tests/` 或 GPU/NPU 训练:本次涉及 CI 自动化与文档。欢迎/评论指令的真实 GitHub
交互需进入默认分支后验证。

- [x] `pre-commit run --all-files` passes
- [ ] Tests pass (`pytest tests/`)
- [ ] New tests added (if applicable)
- [x] Documentation updated (if applicable)

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [x] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update
- [ ] Refactoring (no functional changes)
- [ ] Performance improvement
- [x] CI/CD or build changes

## Screenshots / Logs

<!-- If applicable, add screenshots or log output to help explain the
changes. -->

<div align="right">
<sup>This PR is co-authored with @codex (gpt-6-astra, reasoning:
xhigh).</sup>
</div>

---------

Co-authored-by: Codex <[email protected]>
Co-authored-by: Ryan <[email protected]>
SigureMo added a commit that referenced this pull request Oct 1, 2026
## What

<!-- What changes does this PR introduce? -->

新增专门的格式化层,把既有文件的风格调整从 #392 移到栈顶,并使用无 Node 运行时的 oxfmt mirror 统一格式化
JS/TS、JSON 和样式表,暂不处理 YAML/TOML。

## Why

<!-- Why are these changes needed? Link related issues with "Fixes #123"
or "Relates to #456". -->

CI 基础设施改动与全仓风格调整分开审查;同时补齐 TypeScript、样式表和 JSON 配置的格式化覆盖。

## How

<!-- How do the changes work? Describe the technical approach. -->

- 保留 `ShigureLab/[email protected]` 和根目录 `.oxfmtrc.json`
的现有风格。
- 使用 `types_or: [text]` 把格式识别交给 standalone oxfmt,避免 pre-commit 类型识别漏掉
`.mts`、`.jsonc`、`.gql` 及特殊配置文件名。`--no-error-on-unmatched-pattern`
允许仅包含不支持格式的批次,受支持文件的语法错误仍然会失败。
- 移除 #392 的临时路径排除,覆盖
JS/JSX、TS/TSX、JSON/JSONC/JSON5、CSS/SCSS/Less、GraphQL;现有
`transfer_queue/` 全局排除继续生效。
- 使用 `exclude_types: [yaml, toml]` 暂时排除
YAML/TOML;这些文件的风格调整均已撤回,`.pre-commit-config.yaml` 只保留必要的 hook 配置修改。
- HTML、Vue、Markdown 不在当前 standalone 版本的支持范围内;Markdown 沿用现有 mdformat。
- clang-format 继续按语言排除 JavaScript/JSON,避免重复格式化。
- 本层共修改 14 个文件;完整栈中 oxfmt 实际匹配 22 个文件。

原生 gh-stack 第 6/6 层,base 为 #396;前五层仍为 #392 → #393 → #394 → #395 → #396。

## Testing

<!-- How were the changes tested? Include commands, test results, or
screenshots. -->

- 全量 `pre-commit run --all-files --show-diff-on-failure` 通过,重复运行后无新增
diff。
- 在不含 Node 的 PATH 下实测 16 种启用的扩展名;HTML/Vue/Markdown 确认为不支持。
- 实际 pre-commit 文件选择覆盖 `.mts`、`.jsonc`、`.gql`;oxfmt 全仓 `--check`
通过,且忽略不匹配文件的选项不会掩盖 TypeScript 语法错误。
- 验证全部已跟踪 YAML/TOML 均被 hook 排除,内容与父层一致(必要的 hook 配置修改除外);5 个 JSON
文件解析值一致,7 个 JS/TS 文件经 esbuild 规范化后的输出一致。
- `vitepress build docs` 与 `node docs/fix-chunk-names.js` 通过。

未运行训练单测及多节点 GPU/NPU 集成测试:本层仅调整格式化配置和代码风格,本地也不具备相应集成测试硬件;未新增测试文件。

- [x] `pre-commit run --all-files` passes
- [ ] Tests pass (`pytest tests/`)
- [ ] New tests added (if applicable)
- [ ] Documentation updated (if applicable)

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [x] Refactoring (no functional changes)
- [ ] Performance improvement
- [x] CI/CD or build changes

## Screenshots / Logs

<!-- If applicable, add screenshots or log output to help explain the
changes. -->

<div align="right">
<sup>This PR is co-authored with @codex (gpt-6-astra, reasoning:
xhigh).</sup>
</div>

---------

Co-authored-by: Codex <[email protected]>
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