itdove/devaiflow#324: Branch sync on session reopen: commits_behind() ignores branch parameter causing incorrect update suggestions#328
Merged
Conversation
- Make _handle_branch_checkout return boolean to indicate success/failure - Add early return when checkout fails before attempting sync - Add safety check to verify current branch before syncing with base - Prevent sync operations when not on the expected branch 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Related Issue: #324
Description
This PR fixes a bug in the branch sync logic where the
commits_behind()function ignores its branch parameter, causing incorrect update suggestions when reopening sessions. The fix adds safety checks for branch checkout and sync operations to ensure the correct branch is used when determining if a branch is behind its remote.The changes include:
commits_behind()indevflow/git/utils.pyto properly respect the branch parameterdevflow/cli/commands/open_command.pyfor branch checkout and sync operationstests/test_branch_sync_fixes.pyto prevent regressionAssisted-by: Claude
Testing
Steps to test
daf opento reopen a session on that branchpytest tests/test_branch_sync_fixes.py -vScenarios tested
Deployment considerations