Fix CI quality gates and cross-platform Bash selection#1
Merged
Conversation
PRINCE2-AI
marked this pull request as ready for review
July 12, 2026 18:00
There was a problem hiding this comment.
Pull request overview
This PR tightens CI “quality gate” behavior (non-mutating, blocking Ruff/MyPy/Black), pins CI-only tooling, and improves Windows Bash resolution by explicitly preferring Git Bash (avoiding accidental selection of the WSL launcher). It also includes broad formatting/typing cleanups and strengthens tests around tools and frozen config behavior.
Changes:
- Make CI lint/typecheck steps non-mutating and blocking; restrict workflow permissions; install pinned dev tools via
requirements-dev.txt. - Add Windows-aware Bash executable resolution for
bash_tool. - Formatting, typing modernizations (PEP 604 unions), and test hardening/cleanup across the Python codebase.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tools.py |
Adds Windows Git Bash detection for bash_tool; minor robustness tweaks in file tool path handling and typing. |
tests/test_tools.py |
Updates tool tests to validate Bash selection and applies formatting cleanup. |
tests/test_task.py |
Import ordering/formatting cleanup. |
tests/test_rate_limiter.py |
Removes unused imports / formatting cleanup. |
tests/test_plugins.py |
Removes unused imports; adjusts broken-plugin test string quoting. |
tests/test_persistence.py |
Reorders imports and formatting cleanup. |
tests/test_metrics.py |
Import ordering/formatting cleanup. |
tests/test_main.py |
Simplifies “no exception” tests and formatting cleanup. |
tests/test_exceptions.py |
Import ordering/formatting cleanup. |
tests/test_cost_tracker.py |
Formatting cleanup in assertions and __main__ block. |
tests/test_context.py |
Formatting cleanup in __main__ block. |
tests/test_config.py |
Strengthens frozen-dataclass assertion by catching FrozenInstanceError specifically. |
task.py |
Typing/formatting updates; adopts PEP 604 unions. |
security.py |
Typing modernization and clearer multi-line error strings. |
requirements-dev.txt |
Introduces pinned CI/dev-only tooling via a dedicated requirements file. |
rate_limiter.py |
Formatting cleanup. |
plugins.py |
Formatting cleanup. |
persistence.py |
Typing modernization, improved exception chaining, and formatting cleanup. |
metrics.py |
Typing modernization and formatting cleanup; expands one-line properties for clarity. |
main.py |
Formatting cleanup and minor import reordering. |
logger.py |
Formatting cleanup for regex patterns and formatter setup. |
exceptions.py |
Formatting cleanup in exception definitions/messages. |
cost_tracker.py |
Import ordering, typing modernization, and formatting cleanup. |
context.py |
Typing modernization and formatting cleanup of long strings. |
config.py |
Formatting cleanup; expands config sets for readability; no functional config intent change beyond layout. |
agent.py |
Import ordering and formatting cleanup. |
.github/workflows/ci.yml |
Updates workflow triggers/permissions and makes Ruff/MyPy blocking; installs dev toolchain from requirements-dev.txt. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+37
to
+51
| def _find_bash_executable() -> str: | ||
| """Return a real Bash executable, preferring Git Bash on Windows.""" | ||
| if os.name == "nt": | ||
| git_executable = shutil.which("git") | ||
| if git_executable: | ||
| git_root = Path(git_executable).resolve().parent.parent | ||
| for relative_path in ("bin/bash.exe", "usr/bin/bash.exe"): | ||
| candidate = git_root / relative_path | ||
| if candidate.is_file(): | ||
| return str(candidate) | ||
|
|
||
| bash_executable = shutil.which("bash") | ||
| if bash_executable: | ||
| return bash_executable | ||
| raise FileNotFoundError("Bash was not found. Install Git Bash or Bash.") |
Comment on lines
+18
to
22
| uses: actions/checkout@v7 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| uses: actions/setup-python@v6 | ||
| with: |
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.
What changed
requirements-dev.txtRoot cause
The workflow ran
ruff check --fixinside CI, but remaining non-fixable lint findings stopped the job before Black, MyPy, or Pytest could run. Windows also resolvedbashto the WSL launcher even when Git Bash was installed.Validation
ruff check .black --check .mypy .(27 source files, 0 issues)pytest -q(156 passed)