Pre-commit hook re-staging loops block auto-commits across many repos #23
Labels
No labels
blocked:needs-attention
blocked:needs-decision
bug
chore
in-progress
quickfix
security/high
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AuWoMe/forgeflow#23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this is
Multiple repos have pre-commit hooks that reformat staged files in place
(typically
ruff-formatorprettier). When the hook modifies a filein-place during
git commit, the file is now staged-with-different-contentthan HEAD. Pre-commit's own check then detects "unstaged files detected"
because the modification is unstaged w.r.t. the index, and re-runs the
hook, which reformats again. The commit never completes.
This is a recurring pattern that has blocked commits across many repos
in the Hermes-managed fleet. Examples from session history:
ruff-formatre-stages files;--no-verifyworkaroundcheck-python-versionfails (Python 3.11 vs 3.12 req).gsd/tracked files cause conflictsThe runner-side workaround (
git commit --no-verify) was added to~/.hermes/scripts/quickfix-kiloto keep quickfix flowing, but thatbypasses the hooks entirely which defeats their purpose.
Reproduction (pc2cad as canonical case)
Expected
git commitshould commit once after hooks run, regardless of whetherhooks re-stage files.
Actual
git commitruns hooks, hooks reformat, pre-commit detects'unstaged files', re-runs hooks, etc. Loop. Manual
--no-verifyworks.
Suggested structural fix
Three layers, pick one or do all:
Per-repo fix (cheapest): document the
--no-verifyworkaroundin each repo's
.pre-commit-config.yamland addpass_filenames: falseto auto-formatting hooks (e.g. ruff-format)so they don't re-stage. Tracked in pc2cad#37 as canonical example.
Runner-side enhancement (medium): add a pre-commit-loop detector
to
~/.hermes/scripts/quickfix-kiloandkilo-gsd.pythat:--no-verifyonly on loop detection, not by defaultbypass fired
(Implemented in commit
quickfix-kilo2026-06-21 — pendingcross-script rollout to kilo-gsd.py)
Repo-agnostic sanitizer (best): add a hermes-managed
~/.hermes/bin/pre-commit-loop-detector.shthat wrapsgit commit, watches for re-staging loops, and either:Environment
.venv/bin/ruff --versionWhy I'm filing this here
This is bigger than any one repo. The runner-side patch
(
commit-fallbackin quickfix-kilo) is a band-aid. The rightfix is either per-repo (layer 1) or hermes-managed (layer 3),
and either way needs to be tracked centrally so the workaround
can eventually be retired.