Repository navigation
fix(nix): make project agent CLI an explicit opt-in - #1968
Merged
Merged
Conversation
gerchowl
force-pushed
the
bugfix/1967-devshell-no-agent-cli
branch
from
October 29, 2026 19:25
35046a2 to
39c17c5
Compare
8 of 9 tasks
gerchowl
added a commit
that referenced
this pull request
Oct 30, 2026
…1972) ## Description Carry #1967 from PR #1968 onto the main-based 1.18.1 hotfix. Default project devShells leave `claude` to the machine; `withAgentCli = true` and devkit's `#with-agent-cli` output opt in using the same pin. Home/NixOS modules and the container image retain the CLI. ## Type of Change - [x] `fix` -- Bug fix - [x] `docs` -- Documentation only - [x] `test` -- Adding or updating tests ### Modifiers - [ ] Breaking change (`!`) ## Changes Made Cherry-picked in source order with `-x` provenance retained in each commit body (before the final `Refs` line): - d246518 — shell policy regression guard. - 0161007 — opt-in implementation, documentation and scaffold policy. - 831688b — shell-builder option comments, limited to existing files. - d31b02d — corrected migration wording. - 39c17c5 — distinguish devkit-output and consumer-builder opt-ins. Dropped from the carry: - Entire 260420a: Rust-only policy test bindings/assertions require `templates/rust`, absent from the release base. - `assets/flake.d/rust.flake.nix` comment hunk from 831688b: file absent from the release base. - Retained `nix/mk-rust-project.nix` option/pass-through and comment hunks: that file exists on the release base and the changes applied cleanly. - No unrelated development changelog entries carried. Both copies contain only #1967 in the seeded 1.18.1 section. ## Changelog Entry Under `## [1.18.1] - TBD` in both changelogs, per the hotfix lane: ### Changed - **Project shells leave the agent CLI to the machine** ([#1967](#1967)) - Repositories relying on the dev-shell's `claude` must install it machine-wide (or via the home module), or set `withAgentCli = true`; consumers of devkit's own `devShells` output can select `#with-agent-cli`. - Opting in shadows any system `claude` wrapper. Home modules and the container image retain the CLI. ## Testing - [x] Manual testing performed - Evaluation only: `nix eval --impure --json --expr 'import ./tests/agent-cli-policy.nix {}'` — exit 0 (`agentCliPolicy: true`). Asserts no CLI in default devShell, `lib.mkProjectShell` or scaffolded workspace; opt-in includes the same pinned package; home and NixOS modules retain it. - `nix eval --raw .#checks.x86_64-linux.agentCliPolicy.drvPath` — exit 0, check evaluates without building its closure. - Pre-change default-shell absence assertion evaluated against the test-only commit — exit 1, expected assertion failure because the CLI was present. - Repository commit hooks run inside `nix develop`; broader suites run in PR CI. ## Checklist - [x] Code follows project style; self-review performed - [x] Documentation and regression guard included - [x] Both changelogs updated in the hotfix release section - [x] No unrelated release changes ## Additional Notes Targets `release/1.18.1`. No release workflow dispatch or merge is part of this PR. Rebased onto `release/1.18.1` at 113d379 after security-register reconciliation PR #1973. Both existing release entries (uv under Changed and the exception reconciliation under Security) are preserved alongside #1967. No implementation changes were made in this rebase. Post-rebase verification: policy evaluation and `agentCliPolicy.drvPath` evaluation both exit 0. An additional evaluation asserts that the opt-in shell contains `claude-code` directly from the locked nixpkgs-unstable input: exit 0, version 2.1.309, unstable revision `674a2028661e550a97400c1cc992b9cca9a668a1`. All 18 checks are green on rebased head `00f791f6bda5d2a73a19615f12900f1114e07823`; `gh pr checks 1972 --watch` exited 0. Refs: #1967
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Project shells currently shadow a machine's
claudewrapper, bypassing its release channel and per-profile credentials. Leave the agent CLI to the machine by default and provide an explicit opt-in.Type of Change
fix-- Bug fixModifiers
!)Changes Made
withAgentCli = falsetomkProjectShellandmkRustProject. The fixeddevShells.<system>.with-agent-clioutput serves consumers who select a shell output rather than call the builder.Changelog Entry
Changed
claudemust install it machine-wide (or via the home module), or setwithAgentCli = true; consumers of devkit's owndevShellsoutput can select#with-agent-cli.claudewrapper. Home modules and the container image retain the CLI.Testing
Current-head CI: all 18 checks passed on
39c17c51433765c0e607180a92bbabba8b750fbd, including Test Summary, Project Flake Gates, Consumer Matrix, and both home matrices.gh pr checks 1968 --watchexited 0.Rust-path regression:
nix eval .#checks.x86_64-linux.agentCliPolicy.drvPathexited 1 for each temporary mutant (removedwithAgentCliforwarding; changed its Rust default totrue). Restoring each original implementation makes the evaluation pass (exit 0). Both mutants were restored before the guard was committed.The guard now evaluates
mkRustProjectagainsttemplates/rustwith default and opted-in CLI settings. Builder documentation and the Rust scaffold show the option and warn that it shadows a system wrapper.Touched tests pass locally
Manual evaluation performed
Manual Testing Details
nix eval --impure --json --file tests/agent-cli-policy.nixexited 1 on the default-shell assertion before implementation; committed first asd4566beb.e4e7f56bf396872e547f6847f6c8ac48535cfeff, including Project Flake Gates, Consumer Matrix, both home matrices, and Test Summary.gh pr checks 1968exited 0.nix eval .#checks.x86_64-linux.agentCliPolicy.drvPathexited 0. This evaluates package lists without building Claude Code.uv run --with pytest-xdist pytest tests/test_flake_devshell.py::test_devshell_tools_is_superset_of_agent_toolkit -n 4 --basetemp=$HOME/.cache/devkit-pytest/1967exited 0 (1 passed); isolated directory removed.just docsand commit hooks run insidenix develop; full suites/builds are left to CI on the shared host.Checklist
Additional Notes
The opt-in devkit shell output is necessary for consumers using an exported shell directly: such consumers cannot pass a builder argument. No full builds were run locally. The container CLI remains available as before.
Refs: #1967