Push finalized checkpoint transcripts on turn-end#636
Conversation
When an agent commits and pushes during a turn, the remote checkpoint contains a provisional transcript. HandleTurnEnd finalizes it with the complete conversation but previously didn't push the update, leaving the remote stale. Now PrePush marks ACTIVE sessions with TurnCheckpointIDs by setting PushedDuringTurnRemote on their state. HandleTurnEnd checks this flag after finalizing transcripts and pushes entire/checkpoints/v1 to the same remote, keeping the remote consistent. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 738ef53b2521
PR SummaryMedium Risk Overview
Adds coverage for the flag lifecycle and turn-end push behavior via new unit tests, integration tests, and an e2e canary flow (including extending the Vogon prompt parser/executor to support Written by Cursor Bugbot for commit aca417a. Configure here. |
There was a problem hiding this comment.
Pull request overview
This PR adds a “turn-end push” mechanism to ensure that when checkpoints are pushed mid-turn (with provisional transcripts), the finalized checkpoint transcripts are also pushed at turn end to keep the remote metadata consistent.
Changes:
- Track mid-turn remote pushes via a new session-state flag (
PushedDuringTurnRemote) set duringPrePush. - On
HandleTurnEnd, finalize transcripts and (if flagged) best-effort push the checkpoints metadata branch to the same remote, then clear the flag. - Add unit + integration coverage for flag marking/clearing and turn-end push behavior; deduplicate test transcript fixtures.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/strategy/phase_postcommit_test.go | Adds unit tests covering turn-end push behavior (flagged vs unflagged). |
| cmd/entire/cli/strategy/manual_commit_test.go | Adds unit test ensuring InitializeSession clears the new push flag. |
| cmd/entire/cli/strategy/manual_commit_push_test.go | New unit tests for markActiveSessionsPushed behavior across phases / checkpoint presence. |
| cmd/entire/cli/strategy/manual_commit_push.go | Marks ACTIVE sessions as “pushed during turn” after checkpoint-branch push in PrePush. |
| cmd/entire/cli/strategy/manual_commit_hooks.go | Implements best-effort turn-end push when PushedDuringTurnRemote is set; clears the flag. |
| cmd/entire/cli/strategy/common_test.go | Introduces shared minimal transcript constant to satisfy goconst. |
| cmd/entire/cli/session/state.go | Adds PushedDuringTurnRemote to persisted session state with lifecycle documentation. |
| cmd/entire/cli/integration_test/turn_end_push_test.go | New integration tests validating full lifecycle and stale-flag clearing on new prompt. |
| CLAUDE.md | Documents the new turn-end push behavior and key file locations. |
- Remove unreachable error branches in pushFinalizedCheckpointsIfNeeded (doPushBranch always returns nil, handling errors internally via stderr) - Add multi-session test for markActiveSessionsPushed verifying all ACTIVE sessions get marked while IDLE sessions are skipped Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 80c2d8b615c0
…ls push - Only mark sessions as pushed when push_sessions is not disabled, preventing incorrect flag state when pushing is off - Remove trails push from pushFinalizedCheckpointsIfNeeded — trails have a different lifecycle and don't need to be coupled here Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 67f4c6e88c77
- Add push support to Vogon agent (regex parsing + git push execution) - Add 3 E2E tests: - Manual push triggers pre-push hook, checkpoints arrive at remote - Mid-turn push + turn-end pushes finalized transcripts (agent-agnostic) - No push during turn = no remote checkpoint advancement Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 37bb6a89bb73
|
bugbot run |
- Remove `continue` after commit in parseNumberedSteps so push check runs on combined steps like "(2) commit and push" - Add comment on pushBranchIfNeeded error check explaining it's defensive (currently always returns nil but kept for correctness if that changes) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 7f7c3a582840
…s-remote-checkpoints # Conflicts: # cmd/entire/cli/strategy/manual_commit_test.go
…eckpoints' into alex/stop-hook-updates-remote-checkpoints
Entire-Checkpoint: ebaa181741e1
Summary
TurnCheckpointIDsby settingPushedDuringTurnRemoteon session stateHandleTurnEndchecks this flag after finalizing transcripts and pushesentire/checkpoints/v1to the same remoteInitializeSession)Closes the gap where the remote had a provisional transcript after a mid-turn push, but the finalized version (with trailing conversation) stayed local.
Design doc
docs/plans/2026-03-06-turn-end-checkpoint-push-design.md(in worktree, not committed — contains full analysis of multi-session scenarios and known limitations)Known limitation
In the concurrent multi-session edge case where a session has both pushed and unpushed checkpoints, the turn-end push will push the entire
entire/checkpoints/v1branch — including metadata for unpushed code commits. This is rare and can be addressed with future checkpoint GC.Test plan
markActiveSessionsPushed(ACTIVE/IDLE/no-checkpoint cases)HandleTurnEndpush behavior (flagged vs not flagged)InitializeSessionclearing the flaggit push origin HEAD)mise run test:ci— 46/46 including new E2E canary tests)🤖 Generated with Claude Code