fix(sancta-claw): vendor agent-browser-cli via importCargoLock (crates.io 403s python-requests UA)#461
Merged
Conversation
…s.io 403s python-requests UA) The "Build sancta-claw" CI job has failed on every push since the agent-browser-cli 0.14.0 vendor FOD fell out of the binary cache: crates.io returns HTTP 403 to rustPlatform.fetchCargoVendor because its Python `requests`-based fetcher sends a `python-requests/*` User-Agent, which crates.io's crawler policy now blocks (rust-lang/crates.io#13482). Switch the single agent-browser-cli buildRustPackage call from cargoHash to cargoLock (importCargoLock), which fetches each crate via Nix's libcurl fetchurl — not blocked by crates.io. The CLI lockfile (cli/Cargo.lock, v4) has only crates.io-registry deps and zero git sources, so no cargoLock.outputHashes are needed and there is one fewer hash to maintain than cargoHash. Upstream fix is NixOS/nixpkgs#512735 (set a descriptive User-Agent), backported to release-25.11 on 2026-04-26 but not yet in this flake's nixpkgs pin (2026-03-18); revert to cargoHash once the pin carries it. Verified locally on aarch64-darwin: sancta-claw evaluates to a valid drvPath, and the importCargoLock vendor dir builds end-to-end (all 43 crates fetched via libcurl, zero 403). The x86_64-linux compile/link is exercised by the previously-failing "Build sancta-claw" CI job. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Code Review PR 461: Switch Rust CLI to cargoLock.lockFile. The change replaces cargoHash with cargoLock.lockFile to work around crates.io HTTP 403ing the python-requests User-Agent used by fetchCargoVendor. FINDINGS: LOW - verbose comment but well justified. ANALYSIS: (1) cargoLock.lockFile path reference is valid Nix syntax. (2) No outputHashes needed since lockfile has only crates.io-registry deps. (3) version/cargoRoot/buildAndTestSubdir unchanged. (4) Integrity equivalent to cargoHash. (5) Revert condition documented. VERDICT: PASS - no critical or high severity issues. |
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.
Problem
The NixOS Configuration Check → Build x86_64 Configs → Build sancta-claw job has been red on
mainfor every push since theagent-browser-cli0.14.0 vendor FOD fell out of the binary cache:Root cause (verified empirically)
rustPlatform.fetchCargoVendor(triggered bycargoHash) vendors crates with a Pythonrequests-based fetcher (fetch-cargo-vendor-util.py) that sets noUser-Agent, so it sendspython-requests/*. crates.io's crawler policy now 403-blocks that UA. Confirmed from a clean host:python-requests/2.32.3curl/8.xfetchurl(nix store prefetch-file)This is the upstream issue rust-lang/crates.io#13482. The nixpkgs fix is NixOS/nixpkgs#512735 (set a descriptive UA), merged 2026-04-26 and backported to
release-25.11— but this flake'snixpkgspin is2026-03-18, before the backport.Fix
Switch the single
agent-browser-clibuildRustPackagecall fromcargoHashtocargoLock(importCargoLock), which fetches each crate via Nix's libcurlfetchurl— structurally immune to the crates.io UA policy.cli/Cargo.lock(v4) has only crates.io-registry deps and zero git sources, so nocargoLock.outputHashesare needed; crate hashes come from the lockfile's own checksums (one fewer hash to maintain thancargoHash).sancta-clawis touched.cargoHashonce the nixpkgs pin carries the #512735 backport.Alternatives considered (via a multi-agent design + judge workflow)
fetchCargoVendor's UA (mirrors #512735) — fixes all Rust builds repo-wide, butrustPlatform.overrideScoperewrites the vendor builder on every host, and hardcodes the UA string crates.io currently accepts. Runner-up.nixpkgsinput — ~3656 commits / ~2.3 months of churn rebuilding every host to unblock one CI job. Rejected as primary; fine as later routine maintenance.Verification (local, aarch64-darwin)
nixpkgs-fmt --checkcleannix eval .#nixosConfigurations.sancta-claw...toplevel.drvPath→ valid drv (IFD readingcli/Cargo.lockworks)importCargoLockvendor dir builds end-to-end — all 43 crates fetched via libcurl, zero 403 (/nix/store/...-cargo-vendor-dir)rpi5-fullstill evaluates (unaffected)🤖 Generated with Claude Code