Skip to content

Retry session capture in git hooks when data not yet available #76

@jcleira

Description

@jcleira

Description

When the git hook fires (e.g., post-commit), the AI session log or checkpoint data may not be fully flushed to disk yet. Implement a retry loop in the hook execution path that waits and re-attempts reading session data for a short window (e.g., up to 2-3 seconds with exponential backoff) before giving up or proceeding without it.

Why

Race conditions between the hook firing and session data being written can cause checkpoints to be silently dropped, leading to incomplete attribution. Retrying ensures session data is captured even when the agent writes it slightly after the commit hook fires.

Source

Target Repos

  • cli

Acceptance Criteria

  • Hook retries reading session data if the expected file is missing or empty at first check
  • Retry window is bounded (no infinite loop) and configurable
  • If data is eventually found within the retry window, it is captured normally
  • If data is never found, hook exits cleanly without error and logs a warning

Context Hints

  • cli/internal/hook/
  • cli/internal/session/

Comment /minion build or add the minion-approved label to begin implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions