Skip to content

Failed hooks can be reported as "Passed" when in a priority parallelism #1868

@nathanjmcdougall

Description

@nathanjmcdougall

Summary

I'm finding that if a hook fails, then it will be reported as "Passed" when being executed in parallel with another hook at the same priority level. Perhaps this is intended behaviour but I think it ought to at least be documented better.

To reproduce: consider an otherwise empty git repo with file violates.py containing bad formatting:

x = (
    2 + 
     11
)

Then with this .pre-commit-config.yaml file:

minimum_prek_version: 0.2.23
repos:
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.14.3
    hooks:
      - id: ruff-check
        priority: 0
      - id: ruff-format
        priority: 0

I get this output when running the hooks:

uvx prek@latest -a                                                                       
Files were modified by following hooks...................................Failed
  ┌ ruff check...........................................................Passed                                      
  └ ruff format..........................................................Passed

I would have expected ruff format to be labelled Failed here, not Passed, and to present the user with the stderr from ruff format.

If I change ruff-format to priority: 1 or remove the priority config entirely, I get:

uvx prek@latest                                                                          
ruff check...............................................................Passed
ruff format..............................................................Failed                                      
- hook id: ruff-format                                                                                               
- files were modified by this hook

  1 file reformatted

Which is the expected behaviour.

Willing to submit a PR?

  • Yes — I’m willing to open a PR to fix this.

Platform

Windows 11 x86_64

Version

prek 0.3.8 (bb412c0 2026-03-23)

.pre-commit-config.yaml

minimum_prek_version: 0.2.23
repos:
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.14.3
    hooks:
      - id: ruff-check
        priority: 0
      - id: ruff-format
        priority: 0

Log file

2026-03-27T00:31:49.565628Z DEBUG prek: 0.3.8 (bb412c080 2026-03-23)
2026-03-27T00:31:49.565739Z DEBUG Args: ["C:\\Users\\namc\\AppData\\Local\\uv\\cache\\archive-v0\\TdnOTdnzPiu-p5gN1P3xd\\Scripts\\prek.exe"]
2026-03-27T00:31:49.639005Z TRACE get_root: close time.busy=73.2ms time.idle=9.10µs
2026-03-27T00:31:49.639084Z DEBUG Git root: C:/Users/namc/Temp/temp
2026-03-27T00:31:49.639111Z TRACE Executing `C:\Program Files\Git\cmd\git.exe ls-files --unmerged`
2026-03-27T00:31:49.704033Z DEBUG Found workspace root at `C:\Users\namc\Temp\temp`
2026-03-27T00:31:49.704077Z TRACE Include selectors: ``
2026-03-27T00:31:49.704088Z TRACE Skip selectors: ``
2026-03-27T00:31:49.704378Z DEBUG discover{root="C:\\Users\\namc\\Temp\\temp" config=None refresh=false}: Config file changed, invalidating cache path=C:\Users\namc\Temp\temp\.pre-commit-config.yaml
2026-03-27T00:31:49.704706Z DEBUG discover{root="C:\\Users\\namc\\Temp\\temp" config=None refresh=false}: Performing fresh workspace discovery
2026-03-27T00:31:49.704796Z TRACE discover{root="C:\\Users\\namc\\Temp\\temp" config=None refresh=false}:list_submodules{git_root="C:/Users/namc/Temp/temp"}: close time.busy=30.8µs time.idle=1.70µs
2026-03-27T00:31:49.708449Z DEBUG Loading project configuration path=.pre-commit-config.yaml
2026-03-27T00:31:49.711646Z TRACE discover{root="C:\\Users\\namc\\Temp\\temp" config=None refresh=false}: close time.busy=7.51ms time.idle=2.80µs
2026-03-27T00:31:49.711729Z TRACE Executing `C:\Program Files\Git\cmd\git.exe diff --exit-code --name-only -z C:\Users\namc\Temp\temp\.pre-commit-config.yaml`
2026-03-27T00:31:49.768623Z TRACE Checking lock resource="store" path=C:\Users\namc\AppData\Local\prek\.lock
2026-03-27T00:31:49.768672Z DEBUG Acquired lock resource="store"
2026-03-27T00:31:49.770132Z TRACE No requires-python found in pyproject.toml hook=ruff-check
2026-03-27T00:31:49.770355Z TRACE No requires-python found in pyproject.toml hook=ruff-format
2026-03-27T00:31:49.770852Z DEBUG Hooks going to run: ["ruff-check", "ruff-format"]
2026-03-27T00:31:49.773255Z TRACE Executing `\\?\C:\Users\namc\AppData\Local\prek\hooks\python-ylye5EDyWNAytTX8B1Vc\Scripts\python.exe -I -c import sys, json
info = {
    "version": ".".join(map(str, sys.version_info[:3])),
    "base_exec_prefix": sys.base_exec_prefix,
}
print(json.dumps(info))
 [...]`
2026-03-27T00:31:49.879911Z DEBUG Found installed environment for hook `ruff-check` at `C:\Users\namc\AppData\Local\prek\hooks\python-ylye5EDyWNAytTX8B1Vc`
2026-03-27T00:31:49.879958Z DEBUG Found installed environment for hook `ruff-format` at `C:\Users\namc\AppData\Local\prek\hooks\python-ylye5EDyWNAytTX8B1Vc`
2026-03-27T00:31:49.880730Z TRACE Released lock path=C:\Users\namc\AppData\Local\prek\.lock
2026-03-27T00:31:49.880846Z TRACE Executing `C:\Program Files\Git\cmd\git.exe diff --diff-filter=A --name-only -z -- C:\Users\namc\Temp\temp`
2026-03-27T00:31:49.942826Z TRACE Executing `C:\Program Files\Git\cmd\git.exe write-tree`
2026-03-27T00:31:50.016275Z TRACE Executing `C:\Program Files\Git\cmd\git.exe diff-index --binary --exit-code 57ee9008c2d5779fbac82fb14cdf86194807655a -- C:\Users\namc\Temp\temp`
2026-03-27T00:31:50.082872Z DEBUG Working tree is clean
2026-03-27T00:31:50.082962Z TRACE collect_files: Executing `C:\Program Files\Git\cmd\git.exe rev-parse --git-dir`
2026-03-27T00:31:50.134669Z TRACE collect_files: Executing `cd C:\Users\namc\Temp\temp && C:\Program Files\Git\cmd\git.exe diff --cached --name-only --diff-filter=ACMRTUXB -z`
2026-03-27T00:31:50.183189Z DEBUG collect_files: Staged files: 2
2026-03-27T00:31:50.183227Z TRACE collect_files: close time.busy=10.8ms time.idle=89.5ms
2026-03-27T00:31:50.183606Z TRACE for_project{project=.}: close time.busy=1.80µs time.idle=700ns
2026-03-27T00:31:50.183630Z TRACE Files for project `.` after filtered: 2
2026-03-27T00:31:50.183645Z TRACE get_diff{path="C:\\Users\\namc\\Temp\\temp"}: Executing `C:\Program Files\Git\cmd\git.exe diff -- C:\Users\namc\Temp\temp`
2026-03-27T00:31:50.256051Z TRACE get_diff{path="C:\\Users\\namc\\Temp\\temp"}: close time.busy=4.15ms time.idle=68.3ms
2026-03-27T00:31:50.256139Z DEBUG Running priority group with priority 0 with concurrency 20: ["ruff-check", "ruff-format"]
2026-03-27T00:31:50.257082Z TRACE for_hook{hook="ruff-check"}: close time.busy=924µs time.idle=1.20µs
2026-03-27T00:31:50.257119Z TRACE Files for hook `ruff-check` after filtered: 1
2026-03-27T00:31:50.259380Z TRACE run{hook_id=ruff-check language=python}: Resolved command: C:\Users\namc\AppData\Local\prek\hooks\python-ylye5EDyWNAytTX8B1Vc\Scripts\ruff.exe
2026-03-27T00:31:50.259520Z TRACE run{hook_id=ruff-check language=python}: Running ruff-check total_files=1 concurrency=1
2026-03-27T00:31:50.259566Z TRACE run{hook_id=ruff-check language=python}: Executing `cd C:\Users\namc\Temp\temp && C:\Users\namc\AppData\Local\prek\hooks\python-ylye5EDyWNAytTX8B1Vc\Scripts\ruff.exe check --force-exclude violates.py`
2026-03-27T00:31:50.271090Z TRACE for_hook{hook="ruff-format"}: close time.busy=432µs time.idle=1.90µs
2026-03-27T00:31:50.271136Z TRACE Files for hook `ruff-format` after filtered: 1
2026-03-27T00:31:50.274372Z TRACE run{hook_id=ruff-format language=python}: Resolved command: C:\Users\namc\AppData\Local\prek\hooks\python-ylye5EDyWNAytTX8B1Vc\Scripts\ruff.exe
2026-03-27T00:31:50.274728Z TRACE run{hook_id=ruff-format language=python}: Running ruff-format total_files=1 concurrency=1
2026-03-27T00:31:50.274811Z TRACE run{hook_id=ruff-format language=python}: Executing `cd C:\Users\namc\Temp\temp && C:\Users\namc\AppData\Local\prek\hooks\python-ylye5EDyWNAytTX8B1Vc\Scripts\ruff.exe format --force-exclude violates.py`
2026-03-27T00:31:50.319918Z TRACE run{hook_id=ruff-check language=python}: close time.busy=14.4ms time.idle=48.4ms
2026-03-27T00:31:50.336725Z TRACE run{hook_id=ruff-format language=python}: close time.busy=15.2ms time.idle=50.4ms
2026-03-27T00:31:50.336801Z TRACE get_diff{path="C:\\Users\\namc\\Temp\\temp"}: Executing `C:\Program Files\Git\cmd\git.exe diff -- C:\Users\namc\Temp\temp`
2026-03-27T00:31:50.417384Z TRACE get_diff{path="C:\\Users\\namc\\Temp\\temp"}: close time.busy=5.82ms time.idle=74.8ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions