Skip to content

Detect when git hooks are overwritten during an active agent session #123

@jcleira

Description

@jcleira

Description

Some tools (Husky, lefthook, npm scripts) install their own hook scripts and silently overwrite existing ones during project setup. If this happens while an agent is running and about to commit, Partio's post-commit hook will no longer execute — dropping the checkpoint with no error or warning.

Implementation

  1. partio doctor: Compare current hook file contents against the expected Partio hook template. Report which hooks are intact, missing, or replaced by another tool. Give the user actionable output: partio disable && partio enable to restore.
  2. Post-commit log warning: If the hook script content doesn't match the expected Partio signature at post-commit time, emit a WARN-level slog message.

Detection doesn't need to run at every commit (too slow). Surfacing it in partio doctor is sufficient.

Context hints

  • internal/git/hooks/ — hook script generation
  • cmd/partio/ — doctor command

Why this matters

When another tool replaces Partio's hooks, users silently lose checkpoint coverage with no indication why. The partio doctor command is the natural place to surface this.

Source

Inspired by entireio/cli PR#791: capture scenario where git hooks are overwritten during a running agent prompt.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions