Skip to content

Fix: subsequent commits within the same agent turn don't get checkpoint trailers #159

@jcleira

Description

@jcleira

Description

When using the manual-commit strategy, only the first commit in an agent session turn gets the Partio-Checkpoint trailer. Subsequent commits within the same active session are silently skipped, causing their changes to be orphaned from the session transcript.

Root cause (analogous to entireio/cli#784): The pre-commit hook saves detection state to .partio/state/pre-commit.json. The post-commit hook reads and immediately deletes this file before creating the checkpoint. For the second commit in the same turn, if the session state or detection logic produces a result that is filtered out (e.g., the session appears to have no new content since the previous checkpoint was already written), the linking is silently skipped.

Fix: Ensure the session new-content detection in internal/hooks/post_commit.go accounts for content added between checkpoints within the same turn, not just between the previous checkpoint and the start of the turn. The detection cursor should advance after each commit's checkpoint is written.

Source: entireio/cli#784

Acceptance Criteria

  • All commits made within the same agent session turn receive the Partio-Checkpoint trailer
  • The pre-commit hook correctly detects and saves state for each commit, not just the first
  • A regression test covers the case of two sequential commits within the same active session
  • The fix does not affect the hook re-entry prevention logic for git commit --amend

Context Hints

  • internal/hooks/ — pre-commit and post-commit hook implementations
  • internal/session/ — session state tracking
  • internal/agent/claude/ — JSONL parsing and new-content detection

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