Skip to content

fix(cli): diagnose and safely repair commit-trailer hook integration #746

Closed

Description

@blafourcade

The AIDD commit trailer depends on a call from prepare-commit-msg to the AIDD delegate. If that call is overwritten, commit-to-session attribution is lost silently while commits and telemetry records continue.

Observed

The delegate is owned by AIDD. The fragile part is its caller: a hook manager can regenerate prepare-commit-msg, or the file can be replaced manually or moved through core.hooksPath.

Behaviour

At the next eligible session-start, AIDD verifies the resolved hooks directory and repairs a regular prepare-commit-msg hook when its delegate call has disappeared. It runs at most once per session and does nothing when telemetry is off or the delegate is absent.

Lefthook and Husky are manager-owned cases. Their hook files and configuration may be committed and regenerated, so AIDD does not append directly to them. aidd telemetry check detects that ownership, verifies whether the manager calls the delegate, and prints the integration snippet when it does not.

Done when

  • A regular prepare-commit-msg overwritten between two commits calls the delegate again after the next session start.
  • The repair does not run when telemetry is off or the delegate is absent, and it runs at most once per session.
  • aidd telemetry check reports the effective hooks directory, delegate availability and executability, caller wiring, shared or manager-owned integration, and a count of recent commits carrying AIDD-Session-Id.
  • Lefthook and Husky are diagnosed without AIDD rewriting manager-owned configuration; the required wiring is shown when missing.
  • A commit still succeeds when the delegate is deleted, non-executable, or fails; the delegate reaches no Node process or network and exits 0.

Bounds

An erased call loses commit-level attribution, not the telemetry record itself. The safe automatic repair applies to regular hooks. Manager-owned integration remains owned by that manager and is made explicit by the diagnostic.

Relations

Field Value
follows #630

Activity

  1. added theissue type on Sep 2, 2026
  2. moved this from Ideation to Todo in AIDD Roadmapon Sep 2, 2026
  3. moved this from Todo to In Progress in AIDD Roadmapon Sep 3, 2026
  4. changed the title [-]fix(cli): the commit trailer survives a hook another tool regenerates, and check says whether it did[/-] [+]fix(cli): diagnose and safely repair commit-trailer hook integration[/+] on Sep 14, 2026
  5. blafourcade commented on Sep 14, 2026

    @blafourcade
    ContributorAuthor

    Implemented in #749, with one deliberate boundary to the original repair approach.

    For a regular prepare-commit-msg hook, AIDD repairs the delegate caller at the next eligible session start and telemetry check reports the effective wiring and recent trailer coverage.

    Lefthook and Husky are treated differently: their hooks and configuration are manager-owned, often committed and regenerated. AIDD therefore does not append directly to them. telemetry check detects that ownership, reports whether the manager already calls the AIDD delegate, and prints the exact wiring snippet when it does not.

    This keeps the integration safe and avoids silently rewriting shared third-party configuration. The generic hook-repair path, manager-owned path, disabled telemetry, missing delegates, permissions, symlinks, and diagnostic output are covered by the merged tests.

    I propose closing this as completed with that manager-aware boundary, rather than adding automation that mutates Lefthook or Husky configuration.

  6. moved this from In Progress to Done in AIDD Roadmapon Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions