Agent-job engine-install "Setup Node.js" step ignores `runtimes.node.version`

未关闭 适合新手
#76,559 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
github-actions, go
领域
ci-cd, devtools

调研方向

阅读 pkg/workflow/nodejs.go,并追踪 generateNodeJsSetupStep(data) 和 resolveNodeSetupActionOverride(data),了解运行时设置如何传递到生成的设置步骤。检查导入的 runtimes.node.version 值如何表示,然后运行相关的 workflow 测试或添加一个有针对性的用例。完成标准是:agent job 的引擎安装设置使用固定版本,包括导入的固定版本,而不是默认版本。

由索引模型根据 Issue 内容生成。

描述

ai-inspected

Summary

When a workflow pins runtimes.node.version, the agent job still gets a second Setup Node.js step that uses the compiler default node-version: '24'. That step comes right before Install AWF binary / the engine CLI install, so it runs after the pinned runtime setup step and overrides it on PATH. The agent and the engine CLI therefore run on whatever 24.x the runner resolves, not on the pinned version.

This is the same class of bug as #65939 (threat-detection job), which ADR 66040 fixed only for the detection / evals jobs.

Repro

Frontmatter:

engine:
  id: claude
runtimes:
  node:
    version: "24.22.1"

Compiled with gh-aw v0.93.2, the agent job contains:

      - name: Setup Node.js            # runtime setup step, honors the pin
        uses: actions/setup-node@... # v7.1.0
        with:
          node-version: '24.22.1'
      ...
      - name: Setup Node.js            # engine install step, ignores the pin
        uses: actions/setup-node@... # v7.1.0
        with:
          node-version: '24'
          package-manager-cache: false
      - name: Install AWF binary
      - name: Install Claude Code CLI

The detection job correctly emits '24.22.1'.

Cause

pkg/workflow/nodejs.go, generateNodeJsSetupStep hardcodes constants.DefaultNodeVersion:

fmt.Sprintf("          node-version: '%s'", constants.DefaultNodeVersion),

It already honors runtimes.node.action-repo / action-version through resolveNodeSetupActionOverride(data), but not version. This is still the case on main as of 2026-11-10 (also present in v1.2.2).

Expected

When runtimes.node.version is set (including through imports), generateNodeJsSetupStep(data) should emit that version. Alternatively, it should skip the redundant setup-node step when the runtime setup step has already installed Node in the same job.

Impact

Anyone who pins Node for a security fix ends up with the engine and agent running on an unpinned Node. The only workaround is to hand-patch the .lock.yml after every gh aw compile.

主要语言
Go
星标
5.6k
派生
615
平均合并
5 小时 21 分钟
30 天内合并 PR
792

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/gh-aw 的其他 Issue

查看 github/gh-aw 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。