fix: retry push_files on concurrent branch updates#2622
Open
advancedresearcharray wants to merge 1 commit into
Open
fix: retry push_files on concurrent branch updates#2622advancedresearcharray wants to merge 1 commit into
advancedresearcharray wants to merge 1 commit into
Conversation
7276459 to
27178da
Compare
push_files used a read-modify-write sequence without retrying when UpdateRef failed with a non-fast-forward conflict. During rapid multi-file pushes this left orphaned commits and intermittent failures. Retry with the latest ref and accept flexible files argument encodings from MCP hosts. Closes github#2481
Author
|
Rebased onto latest |
27178da to
1983ac7
Compare
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.
Summary
push_fileswhen GitHub rejects a ref update with a non-fast-forward conflict, which occurs during rapid sequential pushes to the same branchfilesargument from multiple MCP host encodings ([]any, typed slices, JSON strings)Problem
Issue #2481 reports intermittent commit/push failures during heavy multi-file refactoring sessions. The
push_filestool performed a read-modify-write sequence (get ref → create tree → create commit → update ref) without handling concurrent branch updates. When another push landed between the initial ref read andUpdateRef, GitHub returned a 422 non-fast-forward error, leaving an orphaned commit and a failed push.Some MCP hosts also send the
filesparameter in encodings that failed the strict[]anytype assertion, producing JSON parsing errors.Test plan
go test ./pkg/github/...UpdateReffilesparameter parsingCloses #2481