Skip to content

fix(ci): ensure qwen CLI before triage action to avoid redundant install - #8337

Merged
yiliang114 merged 1 commit into
QwenLM:mainfrom
yiliang114:fix/triage-skip-install-if-exists
Aug 1, 2026
Merged

fix(ci): ensure qwen CLI before triage action to avoid redundant install#8337
yiliang114 merged 1 commit into
QwenLM:mainfrom
yiliang114:fix/triage-skip-install-if-exists

Conversation

@yiliang114

@yiliang114 yiliang114 commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

What this PR does

Adds an Ensure qwen CLI pre-step before the qwen-code-action invocation in the triage job. If qwen is 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=error for 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 --global runs as the non-root github-runner user which lacks write permission to the global npm prefix. The --silent flag 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 in qwen-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/91392543453

After: pre-step prints version, action install exits 0 as no-op.

Tested on

OS Status
🍏 macOS N/A
🪟 Windows N/A
🐧 Linux ✅ (verified 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

  • Main risk or tradeoff: The action's internal install step still runs (until fix: skip install when qwen CLI already exists qwen-code-action#14 merges), but becomes a no-op since the package is already at latest. Negligible added time (~200ms npm version check).
  • Not validated / out of scope: Removing the action dependency entirely (future cleanup). Fixing sg runner permissions (separate infra task).
  • Breaking changes / migration notes: None. Additive pre-step only.

Linked Issues

Companion PR: QwenLM/qwen-code-action#14 (adds if-missing guard + --loglevel=error inside 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 发现已是最新。

风险与范围

  • 主要风险:action 内部 install 仍会执行(等 qwen-code-action#14 合并后彻底跳过),但因包已最新,仅为一次 npm 版本检查(~200ms)。
  • 不在范围内:彻底移除 action 依赖(后续清理);sg runner 权限修复(独立 infra 任务)。
  • 无破坏性变更。

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.
@yiliang114
yiliang114 enabled auto-merge August 1, 2026 17:52
@qwen-code-ci-bot

qwen-code-ci-bot commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Qwen Triage finished — CI landed green on 5cedb0b and the deferred approval was posted. finalize run

Qwen Triage 已完成 —— 5cedb0b 的 CI 全绿,延迟审批已提交。查看 finalize 运行

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

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 npm install --silent --global runs as the non-root github-runner user without write permission to the global npm prefix, and --silent swallows the error.

Direction: aligned. This is a CI infrastructure fix for the triage pipeline itself — clearly within scope. The if-missing pattern already exists in qwen-code-pr-review.yml (L478), so this is consistent with established practice.

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 内部的 npm install --silent --global 以非 root 的 github-runner 用户执行,无全局 npm 目录写权限,且 --silent 吞掉了报错。

方向:对齐。这是 triage 流水线本身的 CI 基础设施修复,完全在范围内。if-missing 模式在 qwen-code-pr-review.yml(L478)已有先例,与既有实践一致。

规模:不适用——未触及核心路径。单个 CI 工作流文件,+11 行。

方案:范围合理。这是最小改动——一个附加的前置步骤,使 action 内部的 install 变为空操作。配套 PR(QwenLM/qwen-code-action#14)解决 action 内部的根因;本 PR 是在其合并前的务实变通。无无关改动,无范围蔓延。

风险:无升级风险信号。

进入代码审查 🔍

Qwen Code · qwen3.8-max-preview

Reviewed at 5cedb0b8efc8403dad693cb1a275631c4338d763 · re-run with @qwen-code /triage

@qwen-code-ci-bot

qwen-code-ci-bot commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Code Review

Clean, minimal change. The script does exactly what it says: check if qwen is in PATH, print the version and skip if so, otherwise install from npm with --loglevel=error (diagnosable, unlike the --silent flag that caused the original blind failure) and --no-audit (skips the audit round-trip for speed).

One minor observation: the existing pattern in qwen-code-pr-review.yml (L482) pins --registry=https://registry.npmjs.org, while this step uses the default registry. Not a blocker — the default should resolve fine on both self-hosted and GitHub-hosted runners — but worth noting for consistency if the fleet ever configures a mirror.

No correctness issues, no security concerns, no convention violations.

Testing

This 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 5cedb0b (auto-updated by the triage finalize job after CI completed):

Check Conclusion
Classify PR ✅ success
Test (ubuntu-latest, Node 22.x) ✅ success
web-shell E2E Smoke (ubuntu-latest, Node 22.x) ✅ success

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.

中文说明

代码审查

干净、最小的改动。脚本逻辑清晰:检查 qwen 是否在 PATH 中,若在则打印版本并跳过,否则从 npm 安装(使用 --loglevel=error 以便失败时可诊断,而非原来导致盲目失败的 --silent;使用 --no-audit 跳过审计请求以提速)。

一个小观察:qwen-code-pr-review.yml(L482)的既有模式固定了 --registry=https://registry.npmjs.org,而本步骤使用默认 registry。不构成阻塞——默认 registry 在自托管和 GitHub-hosted runner 上都应正常解析——但如果 fleet 配置了镜像,值得注意一致性。

无正确性问题,无安全隐患,无规范违反。

测试

这是 CI 工作流变更——没有用户可见的产品行为需要在 tmux 中测试。真实场景测试不适用。

ubuntu 测试套件仍在运行。macOS/Windows/Integration 已跳过(CI-only 变更的预期行为)。目前无失败。本 PR 的真正验证是自托管 runner 上的下一次 triage 运行。

Qwen Code · qwen3.8-max-preview

Reviewed at 5cedb0b8efc8403dad693cb1a275631c4338d763 · re-run with @qwen-code /triage

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

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 --silent install into a no-op. It matches the pattern already running in qwen-code-pr-review.yml, the diff is 11 lines in one file, and there is nothing unrelated in it.

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 5cedb0b8efc8403dad693cb1a275631c4338d763.

中文说明

置信度:5/5 — 干净、最小、有充分证据的 CI 修复,遵循既有模式。

问题真实存在(全 fleet exit code 243 失败,有关联的失败运行记录为证),根因正确识别(全局 npm 前缀的权限不匹配),修复是最小可行方案:一个 if-missing 守卫,将 action 内部盲目的 --silent 安装变为空操作。与 qwen-code-pr-review.yml 中已运行的模式一致,diff 为单文件 11 行,无无关改动。

配套 PR(QwenLM/qwen-code-action#14)修复 action 内部的根因;本 PR 是其合并前的桥梁。两者结合是正确的方案。

审批延迟至 CI 在 5cedb0b8efc8403dad693cb1a275631c4338d763 上全部通过后执行。

Qwen Code · qwen3.8-max-preview

Reviewed at 5cedb0b8efc8403dad693cb1a275631c4338d763 · re-run with @qwen-code /triage

@qwen-code-ci-bot qwen-code-ci-bot added scope/ci-cd Continuous integration/deployment skip-changelog-auto Automatically exclude internal CI changes from release notes type/bug Something isn't working as expected labels Aug 1, 2026

@qwen-code-ci-bot qwen-code-ci-bot 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.

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)

Comment on lines +577 to +579
- name: 'Ensure qwen CLI'
run: |-
set -euo pipefail

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.

[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

Comment on lines +577 to +579
- name: 'Ensure qwen CLI'
run: |-
set -euo pipefail

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.

[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 qwen-code-ci-bot 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.

LGTM, looks ready to ship — CI landed green after the review. ✅

@yiliang114
yiliang114 added this pull request to the merge queue Aug 1, 2026
Merged via the queue into QwenLM:main with commit 1843653 Aug 1, 2026
98 of 99 checks passed
@github-actions github-actions Bot removed the skip-changelog-auto Automatically exclude internal CI changes from release notes label Aug 2, 2026
@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Released in v0.21.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ci-cd Continuous integration/deployment type/bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants