fix(ci): ensure qwen CLI before triage action to avoid redundant install - #8337
Conversation
Add a pre-step that checks if qwen is already in PATH (pre-installed by the fleet updater on self-hosted runners) and skips the install. This prevents the action's internal `npm install --global` from hitting EACCES on runners where the non-root user lacks write permission to the global npm prefix. Matches the if-missing pattern already used in qwen-code-pr-review.yml.
|
✅ Qwen Triage finished — CI landed green on ✅ Qwen Triage 已完成 —— |
|
Thanks for the PR! Template looks good ✓ Problem: observed bug with solid evidence — triage jobs failing fleet-wide with exit code 243, linked to a specific failed run. Root cause is well-identified: the action's internal Direction: aligned. This is a CI infrastructure fix for the triage pipeline itself — clearly within scope. The if-missing pattern already exists in Size: not applicable — no core paths touched. Single CI workflow file, +11 lines. Approach: the scope feels right. This is the minimal change — an additive pre-step that makes the action's internal install a no-op. The companion PR (QwenLM/qwen-code-action#14) addresses the root cause inside the action itself; this PR is the pragmatic workaround until that lands. No unrelated changes, no scope creep. Risk: no elevated risk signals. Moving on to code review. 🔍 中文说明感谢贡献! 模板完整 ✓ 问题:已观测到的 bug,有充分证据——triage job 在全 fleet 以 exit code 243 失败,关联了具体的失败运行记录。根因明确:action 内部的 方向:对齐。这是 triage 流水线本身的 CI 基础设施修复,完全在范围内。if-missing 模式在 规模:不适用——未触及核心路径。单个 CI 工作流文件,+11 行。 方案:范围合理。这是最小改动——一个附加的前置步骤,使 action 内部的 install 变为空操作。配套 PR(QwenLM/qwen-code-action#14)解决 action 内部的根因;本 PR 是在其合并前的务实变通。无无关改动,无范围蔓延。 风险:无升级风险信号。 进入代码审查 🔍 — Qwen Code · qwen3.8-max-preview Reviewed at |
Code ReviewClean, minimal change. The script does exactly what it says: check if One minor observation: the existing pattern in No correctness issues, no security concerns, no convention violations. TestingThis is a CI workflow change — there is no user-visible product behavior to test in tmux. N/A for real-scenario testing. CI evidence for the reviewed commit: Final CI results for
One row per check name (latest run); skipped checks omitted; failures sort first. / 每个检查名一行(取最新一次运行),省略 skipped,失败项排在最前。 The ubuntu test suite is still running. macOS/Windows/Integration are skipped (expected for a CI-only change that the classifier routes to the minimal lane). No failures so far. The real verification for this PR is the next triage run on a self-hosted runner — the pre-step should print "qwen already installed:" and the action's install should become a no-op. 中文说明代码审查干净、最小的改动。脚本逻辑清晰:检查 一个小观察: 无正确性问题,无安全隐患,无规范违反。 测试这是 CI 工作流变更——没有用户可见的产品行为需要在 tmux 中测试。真实场景测试不适用。 ubuntu 测试套件仍在运行。macOS/Windows/Integration 已跳过(CI-only 变更的预期行为)。目前无失败。本 PR 的真正验证是自托管 runner 上的下一次 triage 运行。 — Qwen Code · qwen3.8-max-preview Reviewed at |
|
Confidence: 5/5 — clean, minimal, well-evidenced CI fix that follows an established pattern. This is exactly the kind of PR that should be easy to review and merge. The problem is real (exit code 243 failures across the fleet, with a linked failed run as evidence), the root cause is correctly identified (permission mismatch on the global npm prefix), and the fix is the smallest thing that works: an if-missing guard that turns the action's blind The companion PR (QwenLM/qwen-code-action#14) fixes the root cause inside the action; this PR is the bridge until that lands. Both together are the right approach. Approval deferred until CI lands green on 中文说明置信度:5/5 — 干净、最小、有充分证据的 CI 修复,遵循既有模式。 问题真实存在(全 fleet exit code 243 失败,有关联的失败运行记录为证),根因正确识别(全局 npm 前缀的权限不匹配),修复是最小可行方案:一个 if-missing 守卫,将 action 内部盲目的 配套 PR(QwenLM/qwen-code-action#14)修复 action 内部的根因;本 PR 是其合并前的桥梁。两者结合是正确的方案。 审批延迟至 CI 在 — Qwen Code · qwen3.8-max-preview Reviewed at |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
Reviewed. Suggestions are inline. Not linted (tool limitation, not a blocker): the executable-script lint — .github/workflows/qwen-triage.yml: actionlint embedded-shell source mapping is not yet supported — not linted.
中文说明
已审查。 建议见行内评论。 未检查(工具限制,非阻断):the executable-script lint — .github/workflows/qwen-triage.yml: actionlint embedded-shell source mapping is not yet supported — not linted。
— qwen3.8-max-preview via Qwen Code /review (v0.21.3)
| - name: 'Ensure qwen CLI' | ||
| run: |- | ||
| set -euo pipefail |
There was a problem hiding this comment.
[Suggestion] The new "Ensure qwen CLI" step — the core fix of this PR — has no test in the workflow suite (scripts/tests/qwen-triage-workflow.test.js), which already asserts step content AND ordering for the analogous "Install tmux runner tools" step. — Concrete cost: a future edit could remove or rename this step, drop --loglevel=error (re-exposing the exit-code-243 noise this PR fixes), change the package specifier, or reorder it after "Run Qwen Triage" (making the pre-install a no-op for the action that needs it), and nothing in the suite would catch it.
Suggested test (follows the existing tmux-step pattern):
it('ensures qwen CLI is installed before the triage action', () => {
const ensureStep = stepIn('triage', 'Ensure qwen CLI');
expect(ensureStep).toContain('command -v qwen');
expect(ensureStep).toContain('npm install -g');
expect(ensureStep).toContain('@qwen-code/qwen-code@latest');
// Must precede the action that depends on it.
const triageJob = job('triage');
expect(
triageJob.indexOf("- name: 'Ensure qwen CLI'"),
).toBeLessThan(triageJob.indexOf("- name: 'Run Qwen Triage'"));
});中文说明
新增的 "Ensure qwen CLI" 步骤是本 PR 的核心修复,但工作流测试套件(scripts/tests/qwen-triage-workflow.test.js)中没有对应测试,而该套件已对类似的 "Install tmux runner tools" 步骤断言了步骤内容与顺序。具体代价:未来的修改可能删除或重命名该步骤、去掉 --loglevel=error(重新暴露本 PR 修复的 exit-code-243 噪声)、更改包名,或将其排到 "Run Qwen Triage" 之后(使预装对依赖它的 action 失效),而套件中没有任何测试能发现。
— qwen3.8-max-preview via Qwen Code /review
| - name: 'Ensure qwen CLI' | ||
| run: |- | ||
| set -euo pipefail |
There was a problem hiding this comment.
[Suggestion] This load-bearing step has no inline comment explaining why it exists, while every other non-trivial step in this job ("Restore workspace ownership", "Clean stale agent state", "Inject model name", and the qwen-code-action settings block) carries one. — Concrete cost: a future maintainer seeing "Ensure qwen CLI" immediately before "Run Qwen Triage" (an action known to install qwen internally) may conclude the step is redundant and delete it; on non-root runners whose npm global prefix is not writable, the action's internal npm install --silent --global then fails with exit code 243 again, re-breaking fleet-wide triage.
Suggested comment above the step:
# Pre-install the qwen CLI so qwen-code-action's internal
# `npm install --silent --global` finds it on PATH and becomes a
# no-op. Without this, that install fails with exit code 243 on
# non-root runners whose npm global prefix is not writable.
- name: 'Ensure qwen CLI'中文说明
这个关键步骤没有内联注释说明其存在原因,而本 job 中其他所有非平凡步骤("Restore workspace ownership"、"Clean stale agent state"、"Inject model name" 以及 qwen-code-action 配置块)都有注释。具体代价:未来维护者看到 "Ensure qwen CLI" 紧挨着 "Run Qwen Triage"(一个已知会内部安装 qwen 的 action),可能认为该步骤冗余而删除;在 npm 全局目录不可写的非 root runner 上,action 内部的 npm install --silent --global 会再次以 exit code 243 失败,使全 fleet 的 triage 重新中断。
— qwen3.8-max-preview via Qwen Code /review
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship — CI landed green after the review. ✅
|
Released in v0.21.4. |
What this PR does
Adds an
Ensure qwen CLIpre-step before theqwen-code-actioninvocation in the triage job. Ifqwenis already in PATH (pre-installed by the fleet updater on self-hosted runners), the step prints the version and exits. Otherwise it installs from npm with--loglevel=errorfor diagnosability.Why it's needed
The triage job has been failing fleet-wide (both 64c and sg ECS runners, plus occasional GitHub-hosted) with exit code 243. Root cause: the action's internal
npm install --silent --globalruns as the non-rootgithub-runneruser which lacks write permission to the global npm prefix. The--silentflag suppresses all error output, making diagnosis impossible. By ensuring qwen is already installed before the action runs, the action's install becomes a no-op (package already at latest, no disk write needed). This matches the if-missing pattern already used inqwen-code-pr-review.yml(L478).Reviewer Test Plan
How to verify
Trigger a triage run (open an issue or re-run a failed triage job). On self-hosted runners with qwen pre-installed, the log should show "qwen already installed:" followed by the version, and the action's install step should complete instantly without downloading anything. On GitHub-hosted runners (fresh VM), the pre-step installs qwen, then the action's install finds it already at latest.
Evidence (Before & After)
Before:
##[error]Process completed with exit code 243.in the "Install Qwen Code" step (~350ms, no output due to --silent). Example: https://github.com/QwenLM/qwen-code/actions/runs/30708831376/job/91392543453After: pre-step prints version, action install exits 0 as no-op.
Tested on
su - github-runner -c "npm install --global @qwen-code/qwen-code@latest"succeeds after chown on ecs-qwen-runner-64c-8)Environment (optional)
Self-hosted ECS runners (64c fleet + sg fleet) and GitHub-hosted runners.
Risk & Scope
Linked Issues
Companion PR: QwenLM/qwen-code-action#14 (adds if-missing guard +
--loglevel=errorinside the action itself).中文说明
这个 PR 做了什么
在 triage job 的
qwen-code-action调用前增加一个Ensure qwen CLI前置步骤。如果qwen已在 PATH 中(由 fleet updater 预装在自托管 runner 上),打印版本后直接跳过;否则从 npm 安装(使用--loglevel=error以便失败时可诊断)。为什么需要
Triage job 在全 fleet(64c 和 sg ECS runner,偶尔包括 GitHub-hosted)间歇性以 exit code 243 失败。根因:action 内部的
npm install --silent --global以非 root 的github-runner用户执行,该用户无全局 npm 目录写权限。--silent吞掉所有报错。通过在 action 运行前确保 qwen 已安装,action 的 install 变为空操作(包已是最新,无需写磁盘)。与qwen-code-pr-review.yml(L478)已有的 if-missing 模式一致。验证方式
触发一次 triage 运行。自托管 runner 上日志应显示 "qwen already installed:" + 版本号,action 的 install 步骤瞬间完成。GitHub-hosted runner 上前置步骤安装 qwen,action 的 install 发现已是最新。
风险与范围