Skip to content

Checkpoint data not pushed when agent commits and pushes in the same turn #275

@danielweinmann

Description

@danielweinmann

What happened?

When an AI agent (Claude Code) commits and pushes in the same turn, the session checkpoint data is never included in that push. It's always one push behind.

Root cause: The post-commit hook sees the session in ACTIVE state (the agent hasn't finished its turn yet), so it defers condensation — transitioning to ACTIVE_COMMITTED and setting PendingCheckpointID. Condensation to entire/checkpoints/v1 only happens later when the turn ends (HandleTurnEnd). But by then, the pre-push hook has already pushed the stale entire/checkpoints/v1 branch.

Timeline:

  1. Agent calls git commitprepare-commit-msg adds trailer → post-commit fires
  2. Post-commit: session is ACTIVEEventGitCommit emits ActionMigrateShadowBranch (not ActionCondense) → transitions to ACTIVE_COMMITTED
  3. Agent calls git pushpre-push fires → pushes entire/checkpoints/v1stale data (current session not condensed yet)
  4. Turn ends → EventTurnEnd on ACTIVE_COMMITTEDActionCondensehandleTurnEndCondense() writes to entire/checkpoints/v1
  5. Data is now on the local branch but not on the remote

This is the most common workflow for AI agents — they commit and push in the same turn.

Evidence

Local entire/checkpoints/v1 has 1 commit ahead of origin/entire/checkpoints/v1:

$ git log --oneline entire/checkpoints/v1 -5
220d61a2 Checkpoint: 02014f017e49   ← unpushed (our session)
9613e5b0 Checkpoint: d3e2e412302d
99ee6252 Checkpoint: 809f1211c49d
...

$ git log --oneline remotes/origin/entire/checkpoints/v1 -5
9613e5b0 Checkpoint: d3e2e412302d
99ee6252 Checkpoint: 809f1211c49d
...

Logs confirm condensation happens after the push:

18:23:48 prepare-commit-msg: agent commit trailer added (checkpoint_id: 02014f017e49)
18:23:48 phase transition: GitCommit, from: active, to: active_committed
         [git push runs here — pre-push pushes stale entire/checkpoints/v1]
18:24:00 stop hook fires
18:24:02 session condensed (checkpoint_id: 02014f017e49)  ← too late
18:24:02 shadow branch deleted (turn-end)

Entire CLI version

Entire CLI 0.4.2 (2a9998e) Go version: go1.25.6 OS/Arch: darwin/arm64

OS and architecture

Darwin 24.6.0 arm64

Agent

Claude Code

Strategy

manual-commit (default)

Terminal

zsh

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions