Skip to content

fix: reliably verify rollback stash creation - #1786

Open
wgnrai wants to merge 1 commit into
agent0ai:mainfrom
wgnrai:fix/self-update-stash-verification
Open

fix: reliably verify rollback stash creation#1786
wgnrai wants to merge 1 commit into
agent0ai:mainfrom
wgnrai:fix/self-update-stash-verification

Conversation

@wgnrai

@wgnrai wgnrai commented Jul 27, 2026

Copy link
Copy Markdown

Summary

Fixes the rollback-stash verification bug reported in #1753.

When the repository already has a stash, git stash list --format=%gd -n 1 returns stash@{0} both before and after a successful git stash push. The updater therefore falsely raises Failed to create the pre-update rollback stash. and never reaches the requested checkout.

Root cause

The positional stash ref is stable while the stash commit changes.

Fix

  • Keep stash@{0} as the lifecycle ref used by stash apply/stash drop.
  • Add a commit-hash lookup using %H for before/after creation verification.
  • Compare commit hashes instead of positional refs.

Tests

Added regression coverage for detecting a new stash when an existing stash is present and retaining a positional ref that works with stash apply and stash drop. Both tests pass when run directly in temporary Git repositories.

This PR addresses the stash-verification bug only. The separate health-check timeout issue in #1753 remains outside this PR.

Related to #1753

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.

1 participant