Repository navigation
fix(ci): allow command replies on pull requests - #401
Conversation
# 🐛 Bug Fix - Grant pull-requests write permission to the CI Commands workflow's built-in GITHUB_TOKEN for creating and updating PR command replies. - Preserve existing Actions, contents and issues permissions and trusted default-branch execution; no action logic or other workflow changes. - Address the initial reply 403 observed during Relax redai-studio#400 smoke tests.
|
Thanks for contributing to Relax, @ShigureNyako! 感谢你为 Relax 做出贡献! Contribution guide / 贡献指南Describe the problem, your changes, and how you validated them. Keep each PR focused and run 请说明问题、改动和验证方式,保持 PR 聚焦,并在提交前运行 CI commands / CI 指令
Put one command on the first line of a new PR comment. Rerun/cancel require PR authorship or repository write access. 在新 PR 评论的首行写一条指令。PR 作者或有仓库写权限的贡献者可以重跑、取消 CI。 |
Nyanpasu 审查看板审查状态: ✅ 已通过 审查版本: 19ca869 目标分支: main 评审完成:PR #401 将 `.github/workflows/ci-commands.yml` 的 `pull-requests` 权限由 `read` 提升为 `write`。已从 T02/T03 失败 run 的实际日志确认根因(`issues.createComment` 在 PR 会话上 403,当时 token 已有 `issues: write` 而 `pull-requests: read`),并以本仓库 `remove-ci-bypass-labels.yml`(仅 `pull-requests: write`)成功执行 issues API 写入为对照,证明该权限即 PR 会话写入的正确作用域且在本仓库可正常授予。变更最小、与维护者要求一致,无已确认缺陷,结论:通过。合入后仍需按作者计划在授权测试 PR 上复验 T02~T05。
没有未解决的审查问题。 提交范围 · 接收 1 · 建议移出 0 · 待确认 0接收 1 个文件 · 建议移出 0 个文件 · 待确认 0 个文件。移出与待确认部分暂停深审,不代表审查通过。
精简审查与验证依据
生产代码的必要性与替代方案
Powered by Nyanpasu with glm-5.3[1m] xhigh, please check the suggestions carefully.
|
rai-studio-bot
left a comment
There was a problem hiding this comment.
评审结论:通过(APPROVE)
PR #401 将 .github/workflows/ci-commands.yml 的 pull-requests 权限由 read 提升为 write,是修复 CI 指令在 PR 上回复 403 的正确且最小的变更。已核实根因:T02/T03 失败 run 的实际日志显示 token 持有 issues: write + pull-requests: read 时,issues.createComment(.github/actions/ci-commands/index.mjs:72)对 PR 会话写入仍返回 403,响应头 x-accepted-github-permissions: issues=write; pull_requests=write;同仓库 remove-ci-bypass-labels.yml 仅声明 pull-requests: write 即成功对同一 PR 会话执行 issues API 写入(run 36908195148),证明该权限在本仓库可正常授予且为 PR 会话写入的正确作用域。变更仅一行一文件,事件触发、默认分支 checkout、授权校验与去重逻辑均未改动;issues.updateComment 属同一权限族,同步被覆盖。无缺陷发现。合入后请按 PR 描述计划在授权测试 PR 上复验 T02~T05(issue_comment 结构上只运行默认分支 workflow 文件,合入前无法线上验证)。
完整评审看板:#401 (comment)
…er-profiler Brings in upstream/main 99a0b6a..653c43c (redai-studio#302, redai-studio#392-redai-studio#396, redai-studio#398, redai-studio#401, redai-studio#403, redai-studio#405). The only conflict is the guide sidebar in docs/.vitepress/config.mts: redai-studio#398 reformatted it with oxfmt (trailing commas, long entries split), and this branch adds the "Straggler Analysis" / "Straggler 分析" entries next to the same lines. Resolved by taking upstream's formatting and keeping the two straggler entries in their previous position.
What
仅修改
.github/workflows/ci-commands.yml的一行,将pull-requests: read改为pull-requests: write,使 CI 评论指令的内置GITHUB_TOKEN具备创建和更新 PR 回复所需的权限。Why
Relates to #400、#393。按 #400 中的维护者要求 单独提交修复,不修改测试 PR #400 或无关 PR #399。
#400 的 T02~T05 在发布初始回复时返回
403 Resource not accessible by integration,尚未进入 help、rerun 或 cancel 的主体逻辑。已读取 T02 失败 job 的实际日志:运行的是默认分支e36db4b44afe6ac94283b3bd0a66ddc64591f1fe,实际权限为Issues: write、PullRequests: read,失败位置为.github/actions/ci-commands/index.mjs:72,请求为POST /repos/redai-studio/Relax/issues/400/comments。T03 的 未知 target run 也有相同失败。创建前检查了现有开放 PR 与权限/CI 命令相关 PR,未发现等价修复。How
actions: write、contents: read、issues: write,仅提升 PR 权限,不使用write-all。CI Commands只有command一个 job,现有 workflow 级声明仅作用于该 job;无需引入覆盖其余权限的 job 级声明或修改其他 workflow。issue_comment.created、PR 条件、默认分支 checkout、persist-credentials: false、授权校验和去重逻辑不变,不执行 PR head 的代码。actions/github-script@v8默认的内置GITHUB_TOKEN,不是欢迎评论所用的WELCOME_BOT_TOKEN。不修改仓库/组织设置、secrets、token 配置或运行时代码。Testing
uv run --no-project --python 3.10 --with pre-commit pre-commit run --all-files --show-diff-on-failure:全部 hooks 通过,未跳过检查。系统 Python 3.14 首次运行因既有docformatter==1.3.1构建时访问Constant.s失败,改用仓库 CI 的 Python 3.10 后通过;未修改依赖或 hook 配置。actionlint1.7.12:默认分支原文件和修改后的.github/workflows/ci-commands.yml均通过。origin/main相比仅permissions.pull-requests从read变为write,其他权限、事件、唯一 job、默认分支 checkout 及内置 token 边界不变。git diff --check通过;diff 仅一个文件、一行替换。这只是权限声明与静态回归验证,尚未证明线上 PR 回复写入成功。
issue_comment使用默认分支 workflow,本 PR 的普通 CI 或本地检查不能验证合入后的实际 token 权限;仍需部署到默认分支后在获授权的测试 PR 上重新验证 T02~T05 及被阻塞的后续用例。本次未发布测试指令、重跑 CI 或修改 #400。未运行pytest tests/(无 Python/训练逻辑变更);GPU/NPU 集成测试需要专用多节点硬件,本地不具备,未执行。pre-commit run --all-filespassespytest tests/)新持久化测试及文档更新不适用于这一行声明修复;使用静态结构断言验证变更边界。
Type of Change
Screenshots / Logs
T02 测试记录 · 首轮测试汇总
失败 job 中的关键日志: