Repository navigation
feat: add crash-safe prepare-commit-msg hooks - #13
Conversation
CI Fix & Reliability HardeningAll checks are now green across GitHub Actions CI ( Fixes Applied in
|
…ack, and free-tier metrics - Persist free_tier as a real metrics column; stop inferring it from zero-cost rows at read time so free-tier spend can't be inflated - Hook mode falls back to the Phase 4 template on BudgetCapExceededError instead of going silent; covered by a real-git-commit test - Bound hook-mode Gemini calls to 2 attempts, zero backoff, 900ms HTTP caps (worst case ~2.7s of the 4s hook budget); interactive commands keep full retry resilience - Remove --hook-mode/commit_msg_file from the user-facing commit command; hooks run only via the gitmate-hook entry point - Overwrite gitmate-marked hooks on reinstall so upgraded interpreter paths are refreshed - Prune stale .COMMIT_EDITMSG.* orphans left by SIGKILLed workers - Fall back to gemini*/claude* context-window family defaults for unrecognized models
Verification Report — All 7 Review Fixes Implemented (c72ba19)Status: All fixes are in commit c72ba19. Item-by-item against the review's ordering: 1.
|
The previous commit captured a stale pre-fix version of the provider and test files. Restore the verified implementation: - Split Gemini retries into _generate_with_retry (3 attempts, exponential backoff) and _generate_with_hook_retry (2 attempts, zero backoff) sharing _generate_once; retry_with on an instance method re-wraps the unbound function and misbinds arguments - Type hook_http_options() as types.HttpOptions (mypy --strict) - Rework the hook timeout test around MagicMock and add a test proving hook mode exhausts after 2 attempts, not 3 - Drop duplicated hook reinstall/prune tests - Assert free-tier rows contribute $0 to monthly spend
Correction: verified implementation is in 59e2bdeThe previous comment referenced c72ba19 as containing the fixes — that commit turned out to capture a stale pre-fix snapshot of Commit 59e2bde (
The commit object itself was content-verified before pushing (staged blob and CI on 59e2bde: all checks pass — |
Summary
prepare-commit-msgintegration with a four-second timeout, atomic message-file replacement, and unconditional success from the hook launcher.templatesources; preserve explicit messages, merges, squashes, and other Git message sources.gitmate install-hook/uninstall-hook, with idempotent installs and refusal to overwrite unmanaged hooks.prepare-commit-msgpre-commit hook and document the local versus team setup.commit-hookmetrics while reusing the existing cache and fallback pipeline.Verification
uv run pytest -q— 278 passed, including real-repository generation,-mpreservation, merge preservation, simulated worker crash, and timeout tests.uv run ruff check .— passed.uv run ruff format --check .— passed.uv run mypy src/gitmate— passed.uv build— built source distribution and wheel.Safety behavior
The hook only prepares Git's message file and never runs
git commit. A provider failure uses the normal fallback; any worker error or timeout leaves Git's current message in place and allows the normal editor flow to continue.