hook: hook-freshness warns when the checkout behind the hooks is stale - #290
Open
EdbertChan wants to merge 1 commit into
Conversation
5 tasks
OwnerAuthor
This pull request is part of a Mergify stack:
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_6075ebf6-a809-48cd-9271-bddd8bfedfbd) |
This was referenced Sep 9, 2026
install.sh symlinks ~/.claude/hooks at a catstack checkout, so a merged hook or skill fix is inert on a machine whose checkout sits on a feature branch or behind origin/main. One advisory line per session names the branch, the distance from trunk, and the two commands that fix it. Advisory only, no network unless CATSTACK_HOOK_FRESHNESS_FETCH=1, fail-open. Ships with its own installer wiring, since the repo's install test requires every hook entrypoint to be wired in the commit that adds it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KU2pPKob4MJ1NqjsfTNyYJ Change-Id: Ie2558c7af1ea3a88f5e39811340a628ccf9f7c39
EdbertChanforce-pushed
the
stack/EdbertChan/reflect/ui-input-guard-hook-freshness-20260908/hook-freshness-warns-checkout-behind-hooks-stale--e2558c7a
branch
from
September 9, 2026 06:22
817ee2a to
2d1bff8CompareBugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_10bac660-3242-40a6-8e1d-ae3756bc5811) |
4 tasks
EdbertChan
commented
Sep 9, 2026
OwnerAuthor
Revision history
|
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 freeto 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.
Summary
The installed hooks are only as new as the checkout behind them.
install.shsymlinks~/.claude/hooks/<name>at a catstack checkout, so a hook fix merged onorigin/maindoes nothing on a machine whose checkout has drifted.That is not hypothetical. The merged
UNVERIFIED:prove-it block reached a machine whose checkout sat on a feature branch, 40 commits behindorigin/main. The user asked why the stop hook had not forced a verification. It was never installed.This adds one advisory line per session naming the branch, the distance from trunk, and the two commands that fix it.
Review Claim
A stale hooks checkout announces itself once per session instead of silently disabling merged hook fixes.
Review Lane
behavior
Review Unit
tooling-policy
Safety Invariant
Advisory only: the hook returns
additionalContextand never blocks a prompt. It makes no network call unlessCATSTACK_HOOK_FRESHNESS_FETCH=1, times git out, and fails open on a missing symlink, a detached HEAD, a missing remote, or any subprocess error.CATSTACK_HOOK_FRESHNESS=0silences it.Slice Rationale
The hook ships with its own installer wiring, because the repo's install test requires every hook entrypoint to be wired in the commit that adds it. Splitting the wiring into a later slice left this one red on its own.
Non-goals
Does not fetch by default, so the count can lag a remote that moved since the last fetch. Does not check other harnesses' hook directories, and does not run
install.shfor the user.Test Plan
Test Plan
python3 -m unittest discover -s engine/hooks/hook-freshness/tests— 13 tests, OKpython3 scripts/check_hook_test_coverage.py— OK (23 hooks)python3 -m unittest tests.test_install— 59 tests, OK (links the hook and asserts its UserPromptSubmit wiring)python3 scripts/check_no_dated_provenance.py --base origin/main— okRevert Plan
Revert Plan
git revert <sha>./install.sh(drops the settings.json entry), thenrm -rf ~/.claude/hooks/hook-freshness🤖 Generated with Claude Code
https://claude.ai/code/session_01KU2pPKob4MJ1NqjsfTNyYJ