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

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.