fix: capture pre_head_sha for pending commits on session resume#405
Merged
fix: capture pre_head_sha for pending commits on session resume#405
Conversation
When resuming a commit session where the original run didn't produce a commit (sha is None), the pre_head_sha was not being captured. This caused the post-completion hook to skip commit detection entirely, leaving the pending commit as 'failed' on the timeline even if the resumed session successfully created a commit. The fix removes the conditional that only captured pre_head_sha when commit.sha.is_some(). Now pre_head_sha is always captured when a commit record is linked to the session, enabling commit detection for both: - Pending commits (first run failed, resumed run succeeds) - Completed commits (detecting amended commits on resume) Notes do not have this issue since note extraction in run_post_completion_hooks is not gated on pre_head_sha.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When resuming a session linked to a commit that has no SHA yet (i.e. the previous run didn't produce a commit), we now still capture the current HEAD. This allows detecting if the resumed run creates a new commit, not just amended ones.
Previously, the
pre_head_shawas only captured when the commit already had a SHA (amend case). This meant that resumed sessions for pending commits couldn't detect newly created commits.