Skip to content

ci: run language tools from the flake dev shell - #112

Merged
furedea merged 4 commits into
mainfrom
ci/23-dev-shell
Nov 9, 2026
Merged

furedea merged 4 commits into
mainfrom
ci/23-dev-shell

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

概要

CI で使う言語のツールを,flake の devShell から動かす形に統一する(furedea/reusable-workflows#23 のレーン 2).

  • setup-uv,setup-node,setup-rust-toolchain,install-nix-action,cache-nix-action をやめ,reusable-workflows の composite action nix-setup(v1.3.0)に置き換えた.
  • defaults.run.shell を nix develop --command bash -eo pipefail {0} にした.bootstrap,nix-build,all-green は devShell が要らないので bash に戻した.
  • devShell に nodejs_22(22.23.3,setup-node の pin と同じ)を追加した.
  • install-agent-harness は Rust の installer をやめ,devShell agent-harness-build(cargo,rustc)で cargo install する.キャッシュキーは v2 にし,flake.lock のハッシュを加えた(バイナリが Nix の glibc に依存するため).
  • lint,typecheck,audit の timeout-minutes を 10 から 20 にした(キャッシュ未命中時に Python 3.15.1 をビルドするため).
  • job 名と all-green の needs は変えていない.x86_64-linux の devShell は元からある.

計画

agent-config 専用の Issue はなく,計画は furedea/reusable-workflows#23 のレーン表(レーン 2)に従う.

検証

内容 結果
nix flake check --all-systems --no-build --option allow-import-from-derivation false 成功
devShell 内の node --version v22.23.3
devShell 内の bats tests/bootstrap_server.bats 81 件すべて成功
devShell 内の shfmt,nixfmt --check 成功
CI(e7d8543) all-green,claude-review,codex-review ともに成功

CI の時間

変更前は main の直近成功 run(42614971850),変更後はこの PR の run(c0f4b1c は 42622498139,最終の e7d8543 は 42627453854).

job 変更前 c0f4b1c e7d8543
lint 9 秒 55 秒 57 秒
typecheck 7 秒 57 秒 47 秒
audit 10 秒 1 分 8 秒 1 分 8 秒
test 3 分 59 秒 4 分 54 秒 3 分 47 秒
bats 2 分 6 秒 1 分 50 秒 2 分 2 秒
render 50 秒 1 分 53 秒 1 分 7 秒
execpolicy 1 分 12 秒 1 分 51 秒 1 分 2 秒
shell-lint 57 秒 1 分 0 秒 1 分 1 秒
nix-build 1 分 0 秒 42 秒 57 秒
nix-check(変更なし) 4 分 58 秒 7 分 55 秒 6 分 23 秒
全体 5 分 8 秒 8 分 5 秒 6 分 33 秒
  • lint,typecheck,audit は,Nix の準備で 40〜60 秒増えた.ほかの job は,agent-harness のビルドが入る test,render,execpolicy を除き,ほぼ同じだった.
  • job は並列なので,全体の待ち時間を決めるのは変更のない nix-check である.全体の差(5 分 8 秒から 6 分 33 秒)は,ほぼ nix-check の変動(4 分 58 秒から 6 分 23 秒)と一致する.main の別の run(42613251996)も全体で 8 分 19 秒だった.
  • c0f4b1c の run は v2 キーとキャッシュ未命中で走った遅い側の値で,e7d8543 の run は Nix ストアのキャッシュが効いた値.

レビューの指摘

指摘 対応
P1: キャッシュキーが Nix の glibc に依存する c0f4b1c でキーを v2 にし,flake.lock のハッシュを加えた
P2: rustc が 1.98.1 から nixpkgs の 1.95.0 になる 変更しない.キー未命中の run で 1.95.0 によるビルドが通った(render の install が 56 秒,test,render,execpolicy 成功).返信済み
P2: lint,typecheck,audit の timeout が 10 分 e7d8543 で 20 分にした.返信済み.この push の再レビューで新しい指摘はなかった

計画からの変更点

  • install-agent-harness の Rust は,nixpkgs の rustc 1.95.0 になる(以前は 1.98.1 を pin).上のとおり CI のビルドで確認した.

Refs furedea/reusable-workflows#23

🤖 Generated with Claude Code

furedea and others added 2 commits November 9, 2026 21:41
…hell

CI will run every language tool from the flake dev shell, so Node.js 22
(same 22.23.3 that setup-node pinned) joins the default shell, and a
separate agent-harness-build shell provides cargo and rustc for building
the locked agent-harness where its flake has no package.

Refs furedea/reusable-workflows#23

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Replace setup-uv, setup-node, setup-rust-toolchain, install-nix-action and
cache-nix-action with the nix-setup composite action (v1.3.0), and run
every tool step through `nix develop`. The jobs that must not run in the
dev shell (bootstrap, nix-build, all-green) keep plain bash. Job names and
the all-green needs are unchanged.

Refs furedea/reusable-workflows#23

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Nov 9, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T13:42:38.041581Z e7d8543 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@@ -20,20 +20,14 @@ runs:
path: ${{ runner.temp }}/agent-harness/bin/agent-harness
key: agent-harness-v1-${{ runner.os }}-${{ runner.arch }}-${{ steps.agent_harness.outputs.revision }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 — The cached binary now depends on the Nix store, but the cache key still only uses the agent-harness revision.

Before this change, cargo install used the rustup toolchain and the system linker, so the binary linked against /lib64/ld-linux-x86-64.so.2. Now it builds inside nix develop .#agent-harness-build, and Nix's cc-wrapper sets the ELF interpreter and RPATH to a specific /nix/store/...-glibc-* path. Nothing outside the binary records that dependency.

How it breaks:

  1. Someone bumps nixpkgs in flake.lock but not agent-harness (agent-harness follows our nixpkgs, so nix flake update nixpkgs does exactly this).
  2. The key agent-harness-v1-<os>-<arch>-<rev> still matches, so the old binary is restored.
  3. The restored Nix store holds the closure for the new nixpkgs, and the old glibc path is missing (or was garbage-collected before the save).
  4. agent-harness fails with No such file or directory (missing interpreter) in test, render and execpolicy.

The same thing happens if the Nix store cache misses or is evicted while the binary cache still hits.

Also, the v1 entries already in the cache hold rustup-built binaries, so this PR's own CI run will likely hit them and never exercise the new Nix build. The rustc 1.95 build the description says CI will confirm may never actually run.

Suggested fix: bump the key (e.g. v2) and include the nixpkgs lock, e.g. hashFiles('flake.lock') or the nixpkgs locked rev. Another option is to build a static or system-linked binary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c0f4b1c: the cache key is now agent-harness-v2----. A nixpkgs bump changes the key, and the v1 entries (rustup-built binaries) are no longer hit, so this run builds with the Nix rustc.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Review summary

1 blocking finding (P1)

  • P1 .github/actions/install-agent-harness/action.yml: the cache key is still only the agent-harness revision.
    • The binary is now built in a Nix devShell, so it links against a specific /nix/store glibc path.
    • After a nixpkgs bump, or if the Nix store cache misses, the restored binary will not run.
    • The existing v1 cache entries also mean this PR's CI probably never tests the new rustc 1.95 build.
    • Fix: bump the key and include the nixpkgs lock.

Checked, no problem found

  • The custom defaults.run.shell setup.
  • The per-job bash overrides (bootstrap, nix-build, all-green).
  • GITHUB_PATH entries: they still apply inside nix develop, and the devShell does not shadow codex or agent-harness on Linux.
  • uv picks the devShell Python 3.15.1 (UV_PYTHON_PREFERENCE=only-system).
  • nodejs_22 supplies npm.

This PR only changes CI, so I did not flag missing tests.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 4607443a2a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The binary is now built in the Nix dev shell and links against a Nix store
glibc, so a cache entry restored after a nixpkgs bump would not run. Bump
the key to v2 and add the flake.lock hash. This also drops the entries of
rustup-built binaries, so the Nix build is exercised.

Refs furedea/reusable-workflows#23

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Nov 9, 2026

Copy link
Copy Markdown
Owner

@codex review

AGENT_HARNESS_REV: ${{ steps.agent_harness.outputs.revision }}
run: |
cargo install \
nix develop .#agent-harness-build --command cargo install \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This switches the Rust toolchain from the pinned 1.98.1 to the nixpkgs rustc, which is 1.95.0 according to the PR description. Because cargo install --locked uses the exact locked dependency versions, it fails if any crate in agent-harness's Cargo.lock sets a rust-version above 1.95. A missing MSRV in agent-harness's own Cargo.toml doesn't rule this out. The build could also break later, when agent-harness or one of its locked dependencies moves to a newer Rust feature, while the nixpkgs input stays put. To keep the old guarantee, pin the toolchain, for example with fenix or rust-overlay at 1.98.1. Otherwise, check this path's CI run on a cache miss before merging.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this. The v2 cache key missed, so the final run built agent-harness with the Nix rustc 1.95.0 and passed: the Install locked agent-harness step took 56 s in render (13:06:59 to 13:07:55; a cache hit takes about 1 s), and test, render and execpolicy all passed on that binary. That is the cache-miss check the comment asks for. Pinning 1.98.1 would need a new flake input (fenix or rust-overlay) for a toolchain the build does not need. If a locked crate later needs a newer Rust, the build fails visibly in CI and the toolchain follows nixpkgs.

Comment thread .github/workflows/ci.yml
with:
version: "0.13.5"
python-version: "3.15.1"
save: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: lint, typecheck and audit keep timeout-minutes: 10, but they now enter the default devShell. That shell includes the custom Python 3.15.1 from nix/python.nix, which is built from source and isn't in cache.nixos.org. Before, these jobs got a prebuilt Python from setup-uv. When the Nix store cache misses, or a flake.lock bump changes the Python derivation so the prefix-restored cache no longer contains it, each job compiles CPython (LTO on Linux) and then runs uv sync. That can exceed 10 minutes and fail. Consider raising these timeouts to match test/shell-lint (20).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e7d8543: lint, typecheck and audit now have timeout-minutes: 20, the same as test and shell-lint. The run on that commit passed (all-green).

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Review summary

No blocking findings (0 × P0/P1). Two P2 comments are posted inline:

  • P2: install-agent-harness now builds with the nixpkgs rustc 1.95 instead of the pinned 1.98.1. cargo install --locked fails if any locked crate needs a newer Rust (rust-version above 1.95), and it can break later when agent-harness moves to newer Rust features.
  • P2: lint, typecheck and audit keep timeout-minutes: 10 but now need the devShell's Python 3.15.1, which is built from source. If the Nix store cache misses (for example after a flake.lock bump), compiling CPython can exceed 10 minutes.

Checked and found no problem:

  • Jobs without Nix (bootstrap, nix-build, all-green) override the default shell back to bash.
  • Called reusable workflows don't inherit defaults.run.
  • GITHUB_PATH entries (node_modules/.bin, the agent-harness bin) are still on PATH inside nix develop.
  • The agent-harness cache key now includes flake.lock, so it changes whenever the Nix-store glibc the binary links against changes.

I couldn't fetch the agent-harness Cargo.lock or the nix-setup v1.3.0 action source, so the MSRV risk is unverified. A CI run with an agent-harness cache miss would settle it.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: c0f4b1c63a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

lint, typecheck and audit now enter the dev shell, whose Python 3.15.1 is
built from source when the Nix store cache misses. Raise their timeout from
10 to 20 minutes, as test and shell-lint have.

Refs furedea/reusable-workflows#23

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Nov 9, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Review summary (read-only)

No P0–P3 findings.

What I checked:

  • The new default shell nix develop --command bash -eo pipefail {0}. Every job that keeps it runs nix-setup before its first run step. bootstrap, nix-build and all-green switch back to plain bash. The reusable-workflow jobs aren't affected.
  • GITHUB_PATH entries (node_modules/.bin, the agent-harness bin dir) still reach later steps that run inside the devShell. On Linux the devShell has no agent-harness or codex, so nothing hides the locally installed copies.
  • The agent-harness cache key now includes hashFiles('flake.lock') and is bumped to v2. A cached binary therefore can't outlive the Nix glibc it links against.
  • install-agent-harness still runs jq under plain bash. That uses the runner's own jq, so it doesn't depend on the devShell.
  • nodejs_22 in the devShell takes the place of setup-node. The npm ci and codex steps now pick it up from the devShell.

One limit: I couldn't read the pinned [email protected] action, so I took its save-on-push default from the comment in the bats job.

The Rust downgrade (1.98.1 → nixpkgs 1.95.0) is already discussed in the PR, and the CI run shows it builds.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: e7d8543bb6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@furedea
furedea merged commit 7d33f03 into main Nov 9, 2026
24 checks passed
@furedea
furedea deleted the ci/23-dev-shell branch November 9, 2026 13:53
furedea added a commit that referenced this pull request Nov 9, 2026
## 概要

CPython 3.15.2 は,侵害された eMudhra 中間証明書を `ssl` モジュールの拒否リストに加えた最初の 3.15
系リリースです(3.15.1 は同梱の pip と certifi の更新のみ).nixpkgs は 3.15.0 のままなので,自前ビルドの
`nix/python.nix` を 3.15.2 に上げます.

## 変更

- `nix/python.nix`: 3.15.2 に更新(`nix store prefetch-file` の SRI
ハッシュ).TODO コメントを「nixpkgs が 3.15.2 以降を提供したら削除」に書き換え.mimetypes の postPatch
は引き続き必要なので維持.
- `pyproject.toml` / `uv.lock`: `requires-python` を `>= 3.15.2, < 3.16`
に更新.`uv.lock` は `requires-python` の 1 行のみ変更(`pytest-mock==3.15.1`
は無関係なので据え置き).
- `scripts/bootstrap_server.sh`: Nix のないサーバー向けに,uv を 0.13.6(3.15.2
をインストールできる最初のリリース),`PYTHON_VERSION` を 3.15.2 に更新.uv の
x86_64-unknown-linux-musl の SHA256 は,公開されている `.sha256` と実際にダウンロードした
tarball の両方で一致を確認.Renovate の注釈は維持.
- `tests/bootstrap_server.bats` / `tests/test-helper/setup.bash`:
上記の値に追従.偽 uv の既定バージョンも 0.13.6 に更新.
- README / README_ja: 表記を 3.15.2 に更新.

CI は #112 で devShell 経由になったため,`ci.yml` の変更は不要です.

`nix/uv.nix` の uv 0.13.5 は devShell が Nix の Python を使うため,今回は対象外です.

## 検証

- `nix flake check`: 通過(3.15.2 のビルドと mimetypes の postPatch を含む)
- `nix develop` 内:`python --version` は 3.15.2,`uv run python -c 'import
sys; print(sys.executable)'` は worktree の `.venv/bin/python`
- `uv run pytest`: 4466 passed,1 skipped,4 xfailed
- `bats tests/bootstrap_server.bats`: 81 件すべて通過

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant