Skip to content

pr_gates: clean-env lint/mypy PATH names the dir the matched tool is in - #5511

Merged
squid-protocol merged 1 commit into
mainfrom
fix/pr-gates-tool-bin-dir
Oct 18, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/pr-gates-tool-bin-dir

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Problem

The churn precheck on nyx has sent back green PRs with pr_gates --fast is red: FAIL lint 0s: #5483, #5493 and #5504 today. Workers could never reproduce it.

Root cause: pinned_ruff_lint and pinned_mypy_audit check the caller's ruff/mypy against CI's pin. When the version matches, they run the audit under env -i PATH=<dir of the interpreter>:/usr/bin:/bin. churn runs pr_gates under /usr/bin/python3 (its own sys.executable), but the pinned ruff is on ~/.local/bin (nyx's systemd user PATH includes it). The clean PATH was /usr/bin:/usr/bin:/bin, with no ruff, so ruff_audit.py died at once:

NOTE  ruff used: NOT FOUND on /usr/bin:/usr/bin:/bin
FAIL  lint           0s
      FileNotFoundError: [Errno 2] No such file or directory: 'ruff'

Workers rerun the gate with the venv python, whose bin dir does contain ruff, so for them it always passed.

Fix

_tool_bin_dir(tool, env) returns the resolved directory of the tool found on the caller's PATH (the one local_versions just matched). If there is none, it falls back to the interpreter's bin dir, the old behaviour. Both clean-env gates now use it.

Verification

  • New test test_matching_tool_off_the_interpreter_bin_dir_is_on_the_clean_path: fails on main, passes here. tests/tools/test_pr_gates_fleet.py 10/10.
  • On nyx, the precheck's exact command, tests/tools/box/heavy-run.sh /usr/bin/python3 tests/tools/pr_gates.py --fast: lint failed at 0 s before; it now shows ruff used: ruff 0.16.10 (~/.cache/gitgalaxy/ruff-0.16.10/bin/ruff) and 6/6 gates pass.

🤖 Generated with Claude Code

pinned_ruff_lint / pinned_mypy_audit matched the caller's ruff/mypy against
CI's pin, then ran the audit under `env -i PATH=<interpreter bin>:/usr/bin:/bin`.
churn's precheck runs pr_gates under /usr/bin/python3 while the pinned ruff
sits on ~/.local/bin (nyx), so that PATH had no ruff: lint failed in 0 s with
FileNotFoundError and green PRs (#5483, #5493, #5504) were sent back; workers
rerunning under the venv python could never reproduce it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@squid-protocol squid-protocol added ci-cd Continuous integration, delivery, and automated runners scope:infra CI, tooling, churn/factory, docs infrastructure shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md labels Oct 18, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol enabled auto-merge (squash) October 18, 2026 17:58
@squid-protocol
squid-protocol merged commit 4dd2632 into main Oct 18, 2026
29 checks passed
@squid-protocol
squid-protocol deleted the fix/pr-gates-tool-bin-dir branch October 18, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-cd Continuous integration, delivery, and automated runners scope:infra CI, tooling, churn/factory, docs infrastructure shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant