fix hook policy open failures · Entire
fix hook policy open failures
Treat agent and Git hook repository open failures as unreadable checkpoint policy.
Agent hook policy lookup is separated from policy evaluation so callers decide how session-start and later hooks respond.
Sessions
Changes
cmd/entire/cli
Mhook_registry.go+45/-39
- Mhook_registry_test.go+18
- Mhooks_git_cmd.go+7/-4
- Mhooks_git_cmd_test.go+14
- strategy
- Mcheckpoint_policy.go-3
158 unmodified lines
// Cross-agent guard: when Cursor IDE invokes a hook configured under
// .claude/settings.json (because .cursor/hooks.json is missing), the
// Lifecycle event — use the generic dispatcher
Code Blocks
func shouldSkipAgentHookForPolicy(ctx context.Context, worktreeRoot string, errW io.Writer, ag agent.Agent, eventType agent.EventType) (skipHook bool, err error) {
// Some code logic
}
func sessionStartPolicyWarning(policy checkpointpolicy.Policy) string {
// Some code logic
}
Test Cases
func TestAgentHookPolicyFailsWhenRepoCannotOpen(t *testing.T) {
// Some test logic
}
func TestShouldSkipAgentHookForPolicy(t *testing.T) {
// Some test logic
}
// disable Entire checkpoint work, not make Git reject the user's operation.