Repository navigation
fix(daemon): map a single-commit cherry-pick by content when the reflog entry has no cherry-pick action - #91
Merged
sagnik11 merged 4 commits intoNov 13, 2026
Conversation
…og entry has no cherry-pick action The cherry-pick side effect rebuilt the pick from HEAD reflog entries that contain "cherry-pick". When the entry for the new head has a different action (an inherited GIT_REFLOG_ACTION, or a hook that amends the pick), the side effect failed and the authorship note was not rewritten. For a single-commit pick, accept the reflog path from the parent of the new head to the new head when the new commit has the same stable patch id as the source commit. Log the reflog actions (not the commit subjects) as a warning, so the next hit shows the trigger. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: 530e5807-a8fc-4702-82b4-b02677f92a61
…pick content fallback Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: 530e5807-a8fc-4702-82b4-b02677f92a61
Resolve the repo_state import list in src/daemon.rs: take main's list and add head_reflog_path_messages_for_worktree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rote the landing reflog entry
The content fallback accepted any commit whose parent-to-commit reflog path
existed and whose patch id matched the source. A stale ref state could then
name a commit that was already on the branch (a plain `commit:` entry with
the same patch) and rewrite its note with the source's attribution.
The fallback now requires the HEAD reflog entry that landed on the new head
to pass head_reflog_entry_written_by("cherry-pick", ...) (which also accepts
a renamed GIT_REFLOG_ACTION entry) or to be `commit (amend)`. The warn log
records whether the landing entry was accepted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sagnik11
marked this pull request as ready for review
November 13, 2026 16:58
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.
Problem
resolve_linear_head_commit_chain_for_worktreeaccepts only HEAD reflog entries whose message containscherry-pick.GIT_REFLOG_ACTION(custom-tool: <subject>), or a hook that amends the pick in the same command (commit (amend): <subject>). In these cases the side effect fails with "failed to reconstruct HEAD reflog chain".Origin
c2b5f87Changes
new_headas the original head,new_head, which can include more than one step, for example pick then amend (newhead_reflog_path_messages_for_worktree),git patch-id --stablefornew_headand the source commit. This reuses the existing helper inci_context.rs.log_messagewith the reflog actions andcontent_matches. The next hit then shows the trigger. The log does not include commit subjects, and no new error-tracking issues open from it.cherry-pickNote
The report says that the trigger is a hypothesis. The
GIT_REFLOG_ACTIONcase is confirmed by a test. The amend case is covered only at the reflog-walk level. The warn log will tell us if other triggers exist.Tests
test_single_commit_cherry_pick_with_custom_reflog_action. It fails without the fix and passes with it.cargo clippy --all-targets -- -D warnings: pass.cargo fmt --checkon the changed files: pass.cargo test --lib repo_state(13 tests): pass.cargo test --test integration cherry_pickin daemon mode with 8 threads: 62 of 63 pass. Each run had one different failing subdir test (..._multiple_ai_sessions_from_subdir_in_worktree, then..._multiple_commits_with_c_flag). Both pass when run alone. These are multi-commit picks that the strict path maps, so the new fallback does not run for them. I did not run the fulltask testsuite in the sandbox.Agent context
cherry-pickfilter for all counts. For multi-commit chains it prevents wrong matches against unrelated reflog entries.original_headfromhead_change. In the amend case it does not equal theoldof the last reflog entry. The parent ofnew_headis correct for both triggers.Created with PostHog Desktop from this inbox report.
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.