Skip to content

Handle cursor logs being not there in time#713

Draft
Soph wants to merge 2 commits intomainfrom
soph/cursor-fix-v2
Draft

Handle cursor logs being not there in time#713
Soph wants to merge 2 commits intomainfrom
soph/cursor-fix-v2

Conversation

@Soph
Copy link
Collaborator

@Soph Soph commented Mar 17, 2026

This handles an issue with cursor where logs weren't ready when the hook expected them but were later when the commit was made so let's retry than.

Entire-Checkpoint: bd9be44c4666
Copilot AI review requested due to automatic review settings March 17, 2026 19:50
@cursor
Copy link

cursor bot commented Mar 17, 2026

PR Summary

Medium Risk
Changes post-commit checkpoint tracking and stop-time finalization paths; if incorrect, commits could be mis-linked or checkpoints created with wrong metadata/files touched.

Overview
Improves resilience to agent (e.g., Cursor) race conditions where the transcript isn’t available at post-commit time.

PostCommit now records turn checkpoint IDs whenever condensation was attempted (not only when it succeeded), enabling HandleTurnEnd to retry later. At turn end, finalization now falls back to creating a missing committed checkpoint (via WriteCommitted) when UpdateCommitted returns ErrCheckpointNotFound, including a helper that locates the originating commit by Entire-Checkpoint trailer and derives FilesTouched from that commit.

Adds tests covering failed-condensation tracking, stop-time checkpoint creation, and trailer-based file discovery.

Written by Cursor Bugbot for commit 9f40b26. Configure here.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a Cursor-specific race where PostCommit may run before Cursor has finished writing its transcript/logs, causing condensation to fail at commit time; the fix ensures the checkpoint can be retried and finalized once the full transcript is available.

Changes:

  • Track TurnCheckpointIDs when condensation was attempted even if it failed, enabling stop-time retry.
  • Extend stop-time finalization to create missing checkpoints from the full transcript when they weren’t created during PostCommit.
  • Add test coverage for the failed-condensation/retry flow and for computing FilesTouched from a checkpoint trailer.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
cmd/entire/cli/strategy/manual_commit_hooks.go Tracks attempted condensations and adds a stop-time fallback to create missing checkpoints, including a helper to infer touched files via git history.
cmd/entire/cli/strategy/phase_postcommit_test.go Adds tests for the Cursor race condition flow (failed condensation → retry at turn end) plus helper behavior tests.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +2262 to +2264
repoDir, repoErr := paths.WorktreeRoot(ctx)
if repoErr != nil {
repoDir = ""
Comment on lines +2361 to +2362
out, err := exec.CommandContext(ctx, "git", "-C", repoDir,
"log", "--all", "--grep=Entire-Checkpoint: "+cpID, "--format=%H", "-1").Output()
}

logging.Warn(logCtx, "finalize: failed to update checkpoint",
slog.String("checkpoint_id", cpIDStr),
Entire-Checkpoint: 18e2aff440f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants