Repository navigation
hooks: warn at session start when the plugin pin lags the marketplace clone - #4412
Conversation
… clone Claude Code runs ai-config hooks from a per-scope cache pin recorded in ~/.claude/plugins/installed_plugins.json, and the pin does not advance when the marketplace clone updates. Merged hook fixes went unrun for weeks with nothing saying so (four measurements on #2439, the latest 2026-10-08). New SessionStart hook warn-stale-plugin-pin.py compares each applicable ai-config pin (user scope, or a project scope covering the session directory) against the local marketplace clone's HEAD and, when it lags, names the commit count and the per-scope update commands. It never blocks, does not fetch, and is silent when there is no plugin record. Registered in hooks/hooks.json, README catalog row added, generated plugin manifest refreshed, keep-checkouts-fresh.md updated. Thirteen test assertions; four mutations (scope filter, equality check, plugin-name filter, ancestor check) each turn a named case red. A pin ahead of the clone is not reported. Closes #2439 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vwcai8NPoZC3GjwGwhcKHa
|
/review Generated by Claude Code |
validate failed on check-unpinned-git-fixtures (init without -b, and a variable named clone that the scanner reads as a git clone call) and check-text-encoding (two bare write_text calls). Both checks now pass locally, and the suite still passes. Refs #2439 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vwcai8NPoZC3GjwGwhcKHa
|
/review Generated by Claude Code |
|
Claude finished review — View run SummaryThis PR adds Verification performed
FindingsNo blocking issues found. Two very minor, non-blocking documentation nits:
Both are cosmetic and don't block merge. VerdictReady for merge Structured Review Data (JSON){
"schema_version": "1.1",
"reviewer": "claude",
"commit_sha": "af69a8761499af750715f15462503a81d9134c10",
"verdict": "CLEAN",
"findings": [],
"detailed_assessment": "Traced warn-stale-plugin-pin.py's applies/pin_is_current/behind helpers against every test-warn-stale-plugin-pin.py scenario and live machine state; no failure mode found in staleness, ahead-of-clone, or malformed-record handling.",
"holistic_assessment": "Checked generator sync, README catalog script, hook-delivery check, and keep-checkouts-fresh.md cross-references for integration regressions; all pass and scope matches the closed issue 2439 requirement."
}Reviewed commit: af69a87 |
Before: Claude Code runs ai-config hooks from a per-scope cache pin in
~/.claude/plugins/installed_plugins.json, and that pin does not advance when the marketplace clone updates. Merged hook fixes went unrun for weeks with nothing saying so. #2439 records four measurements, the latest on 2026-10-08, where a user pin of6a4f97ebfc79refused pushes that main no longer refuses. The manual check inkeep-checkouts-fresh.mdandscripts/check-hook-delivery.pyonly run once a session already suspects the cache.After: a new
SessionStarthook,hooks/warn-stale-plugin-pin.py, compares each ai-config pin that applies to the session (user scope, or a project/local scope whoseprojectPathcovers the session directory) against the local marketplace clone's HEAD. When a pin lags, it names the commit count and the per-scopeclaude plugin marketplace update/claude plugin updatecommands.Behavior:
One limit: a pin cannot warn about itself, so pins that predate this hook need one manual update first. The docstring and README row say so.
How:
hooks/hooks.json.plugins/ai-config-hooks/hooks/hooks.jsonregenerated (gen-hooks-plugin.py --checkpasses locally).check-hook-catalog.pypasses locally).keep-checkouts-fresh.mdnow points to the hook instead of saying the check is still tracked.hooks/test-warn-stale-plugin-pin.pyhas 13 assertions and passes locally. Four mutations (scope filter, equality check, plugin-name filter, ancestor check) each turn a named case red.pluginsvalue crashing the hook, and the bootstrap limit undocumented. All four are fixed in this commit.Closes #2439
🤖 Generated with Claude Code
https://claude.ai/code/session_01Vwcai8NPoZC3GjwGwhcKHa
Generated by Claude Code