Skip to content

Backport bot guaranteed to fail on first run: GITHUB_TOKEN lacks read/write access to actions variables; BACKPORT_TRAIN | backport 机器人首跑必死:GITHUB_TOKEN 无权读写 actions 变量,BACKPORT_TRAIN 指针方案 403 #4471

Closed

Description

@ranxianglei

(ai: zai/glm-5.3)

现象:合并带 backport 标签的 PR(#4465)后,Backport 工作流 run 40053876329 在 "Resolve the train" 步骤红死,火车没切、cherry-pick 没跑。

根因:gh api repos/…/actions/variables/BACKPORT_TRAIN 返回 403 Resource not accessible by integration。workflow 的 permissions: 块没有任何类别能授予 actions-variables API(那是 fine-grained PAT 的独立 "Variables" 权限)——GITHUB_TOKEN 天生摸不到它。也就是说 #4468 引入的变量指针方案在 GITHUB_TOKEN 下结构性不可能工作,首跑暴露。

守卫把这个 403 JSON 当成车名,报 BACKPORT_TRAIN='{"message":…}' does not start with bugfix-release/。

修复方向:扔掉存储态,改可推导态——开着的火车 = bugfix-release/* 里 BASE 版本(剥后缀)严格新于最新 v* tag 的最新分支。切车=推这样一条分支;发车=tag 追上(自动闭合)。只需 git refs,零 API 权限、零 stale 态。注意必须剥后缀比基版本:字符串排序会把 v0.1.206-train 排在 tag v0.1.206 之上,把已发车的火车误判为还开着。

PR 跟进中(同时保留 c5df0eb 的 pick 加固、恢复 owner 会话里明确要的全自动切车、加 workflow_dispatch pr=<n> 修复通道重跑 #4465 的 backport)。

Activity

  1. changed the title [-]backport 机器人首跑必死:GITHUB_TOKEN 无权读写 actions 变量,BACKPORT_TRAIN 指针方案 403[/-] [+]Backport bot guaranteed to fail on first run: GITHUB_TOKEN lacks read/write access to actions variables; BACKPORT_TRAIN | backport 机器人首跑必死:GITHUB_TOKEN 无权读写 actions 变量,BACKPORT_TRAIN 指针方案 403[/+] on Oct 24, 2026
  2. ranxianglei commented on Oct 24, 2026

    @ranxianglei
    OwnerAuthor

    🤖 Powered by ework · qwen3.8-27b

    (ai: vllm-qwen/qwen3.8-27b)

    查重: 不重复——按 backport / train / 403 / 变量指针多组关键词检索了 open+closed issue,这个首跑失败只有本条记录;PR #4472 就是它的实现 PR。

    标签: bug + scope/ci + p2(CI 发版管道缺陷;只影响刚上线的补丁火车车道,master 正常发版与单修 carve-out 不受影响,可手工 cherry-pick 绕行 → 非 p1)。

    八问

    1. 是什么问题:合并带 backport 标签的 PR 后,Backport 工作流首跑红死——读不到「当前哪条火车开着」的指针,没切车、没 cherry-pick,整条补丁火车车道停摆。
    2. 什么原因导致的:[PR] feat(ci): patch-train backport bot — backport label routes merged fixes onto the tag-based bugfix-release train (#4467) #4468 把火车指针存进 GitHub Actions 变量,用 gh api …/actions/variables/… 读写。这个 API 在 GITHUB_TOKEN 的权限模型之外(permissions: 块没有任何类别能覆盖它,Variables 是 fine-grained PAT 的独立权限)→ 结构性必 403,不是配置失误。次生缺陷:守卫把 403 返回的 JSON 当车名做校验,报出误导性的 does not start with bugfix-release/。
    3. 影响范围与严重程度:仅影响新补丁火车车道([PR] feat(ci): patch-train backport bot — backport label routes merged fixes onto the tag-based bugfix-release train (#4467) #4468 刚引入,首跑暴露);master 正常发版、单修 carve-out 不受影响;修复都在 master 上,无丢失。一个功能不可用但有绕行 → p2。
    4. 怎么修复的(PR [PR] fix(ci): derive the open patch train from refs — the variables-API pointer structurally 403s under GITHUB_TOKEN (#4471) #4472,已提交待合):扔存储态改可推导态——开着的火车从 git refs 推导:bugfix-release/* 里基版本(剥后缀)严格新于最新 v* tag 的最新分支;切车=推这样一条分支,发车=tag 追上即自动闭合。零 API 权限、零 stale 态。同时保留 c5df0eb 的 pick 加固、恢复全自动切车、加 workflow_dispatch pr=<n> 修复通道重跑 [PR] Fix: control-plane system messages collapsed as regular messages + position validity fallback (#4457, #4292 family root | 修复:控制面 system 消息按普通消息折叠 + 位置合法性兜底(#4457,#4292 家族根修) #4465。
    5. 回归风险:逐项审过既有行为——pick 机制(合并提交形状校验、identity-before-pick、rev-list 区间)自 c5df0eb 原样保留未动;release-bugfix 尾部步骤由「清变量」改为提示输出(变量已不存在,纯跟随改动);release-manual 火车模式解析同样切到 refs 推导,dispatch 表单不变;ci.yml 触发过滤不变。无语义漂移、无 fail-fast 变吞错。
    6. 缓存影响:不涉及(纯 CI 工作流变更)。
    7. 设计方向变化:有,且正是本 issue 指定的方向——状态模型从「存储指针」改为「refs 推导」。边界:开/关判定读的是分支名里的基版本,已写进 reference/release.md。
    8. 新配置引入:无;反而移除了对 Actions 变量的依赖。

    验证证据(不止读 diff)

    顺带修的三个小问题(独立标注,已在 PR 分支/元数据上)

    1. release-manual 的 dispatch 表单提示文案还写着已删除的 BACKPORT_TRAIN 变量(用户可见 UI 串)→ 改为「derived from refs」;
    2. reference/release.md 「feature release 超车开着火车」的恢复建议原为「rebase 到新 tag」——推导模型下这不会重开火车(判定读分支名,rebase 改不了名字)→ 改为「删掉被超车的分支,下一个带标签合并自动切新车」;
    3. PR 标题/正文的关闭引用写成了 Fixes #issue # 4471(无效语法,合并后 GitHub 不会自动关本 issue)→ 已修正为 Fixes #4471,标题同步为 (#4471)。

    下一步(owner 动作)

    1. 合并 PR [PR] fix(ci): derive the open patch train from refs — the variables-API pointer structurally 403s under GITHUB_TOKEN (#4471) #4472(不碰版本号、不触发任何发版流,纯工作流文件更新);
    2. 到 Actions 运行 Backport,手动 dispatch 填 pr=4465 → 首次 backport 走通:自动从 v0.1.205 切 v0.1.206-train,cherry-pick [PR] Fix: control-plane system messages collapsed as regular messages + position validity fallback (#4457, #4292 family root | 修复:控制面 system 消息按普通消息折叠 + 位置合法性兜底(#4457,#4292 家族根修) #4465 的修复并推分支、留评论。

    结论:根因确认为结构性(GITHUB_TOKEN 天生摸不到 variables API),修法与 issue 指定方向一致且经场景表测验证,PR 可合,等你合并后一键重跑即可验收。

  3. added a commit that references this issue on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions