fix: fix patch application#228
Open
derekbarbosa wants to merge 5 commits into
Open
Conversation
git worktree add rejects commit SHAs that exist in the object store but are not reachable from any named ref. This occurs when patchsets specify a base-commit SHA from a subsystem tree that has been fetched but is not pointed to by a local branch or tag. Add a fallback that retries worktree creation at HEAD when the initial attempt with the target SHA fails. The existing phase 2 reset --hard repositions the worktree to the correct commit, which works with loose objects regardless of ref reachability. This fixes worktree creation failures for 9 patchsets observed in production where base-commit SHAs were valid objects but unreachable from any ref. Assisted-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: derekbarbosa <derekasobrab@gmail.com>
When both git am and git apply fail due to minor context divergence between the patch baseline and the tested tree, fall back to git apply -C2 which requires only 2 lines of surrounding context instead of the default 3. Add apply_raw_diff_relaxed to GitWorktree for reduced-context application. Mark results with method git-apply-C2 in the review metadata so downstream consumers can distinguish reduced-context applications from strict ones. The commit message for patches applied via this fallback includes an explicit annotation: (Applied via git apply -C2). Assisted-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: derekbarbosa <derekasobrab@gmail.com>
GIT PULL messages are maintainer pull requests containing a git URL and branch to fetch, not applicable diffs. They often include inline diffstats that trigger diff detection, causing them to be classified as patchsets. These always fail patch application since there is no diff to apply. Exclude subjects containing [GIT PULL] from patchset classification alongside the existing reply and reproducer filters. Messages are still stored for threading and archive purposes but no patchset record is created. 40 GIT PULL messages were observed as patchsets in production, with 29 pending review (all destined to fail) and 7 already marked Failed To Apply. Assisted-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: derekbarbosa <derekasobrab@gmail.com>
When extract_version_tag produces a kernel version from the subject (e.g., 7.1 from Fixes for 7.1), the code adds a LocalRef candidate like v7.1. During release candidate phases these tags do not yet exist in the local repo, producing a guaranteed failed resolution attempt and noise in the baseline attempt logs. Verify the tag exists via git rev-parse before adding it as a candidate. The stable branch RemoteTarget is still added unconditionally for .y versions since it relies on remote fetching rather than local tag presence. Assisted-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: derekbarbosa <derekasobrab@gmail.com>
Add structured logging across the patch application pipeline so failures and fallback paths are visible in production logs: - git_ops: warn when worktree creation falls back to HEAD, error when both attempts fail - reviewer: warn with git am stderr when it fails before falling back, warn when all apply methods are exhausted for a patch - patch: info when a GIT PULL message is filtered out - baseline: info when a version tag candidate is skipped because it does not exist locally Assisted-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: derekbarbosa <derekasobrab@gmail.com>
7ea9999 to
cf05777
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.
Fix patch application failures and add diagnostics
Investigation of patchsets stuck in Failed To Apply status revealed four distinct root causes in the reviewer pipeline:
To fix this, we employ the following:
along with more logging on failure failure/success paths.
Assisted-by: Claude Opus 4.6 noreply@anthropic.com
Signed-off-by: derekbarbosa derekasobrab@gmail.com