Skip to content

fix: capture pre_head_sha for pending commits on session resume#405

Merged
matt2e merged 1 commit intomainfrom
baxen-staged-continue
Mar 18, 2026
Merged

fix: capture pre_head_sha for pending commits on session resume#405
matt2e merged 1 commit intomainfrom
baxen-staged-continue

Conversation

@baxen
Copy link
Collaborator

@baxen baxen commented Mar 17, 2026

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_sha was 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.

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.
@baxen baxen requested review from matt2e and wesbillman as code owners March 17, 2026 23:36
@matt2e matt2e merged commit 56ff69f into main Mar 18, 2026
4 checks passed
@matt2e matt2e deleted the baxen-staged-continue branch March 18, 2026 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants