Skip to content

History-Rewrite Guidance Assumes filter-repo Re-Signs What It Rewrites, So Both Gates and the Verification Step Miss the Real Failure #1391

Closed

Description

@ptr727

Summary

git-commit-conventions and its references/history-rewrite.md already carry a history-rewrite
rule, and its central premise about what the tooling does is wrong. The reference states that
filtering history "re-signs every commit it touches with the rewriter's own key". git filter-repo
does not sign anything. It drops the gpgsig header and leaves every commit it rewrites unsigned.

Because the premise is wrong, the rule anticipates the wrong failure (a valid signature over a
mismatched committer, landing unknown_key) and misses the failure that actually occurs (no
signature at all, landing unsigned). Both of its gates and its verification step follow from that
premise, and all three fail to prevent or detect the real outcome.

This surfaced in ptr727/Utilities. A stale author identity was removed from 27 commits dating to
2018-2019 with git filter-repo --mailmap. Every commit on main and develop then reported
unsigned to GitHub, and the develop-to-main promotion pull request was blocked by
Commits must have verified signatures. Repairing it required a second full-history rewrite of 884
commits.

Root cause

Three facts compound. The current guidance carries only the third.

  1. A rewrite cascades to every descendant. A commit hash covers its parent hashes, so rewriting
    any commit changes the hash of every commit below it. The 27 commits in question sit near the
    root, so the rewrite reached all 880 commits on main and all 807 on develop.
  2. git filter-repo strips signatures and cannot create them. A signature cannot survive a
    content change, so the tool discards it. It has no signing capability to replace it with.
  3. GitHub verifies a signature against the commit's committer identity. The reference states
    this correctly, and it is why a naive re-sign of bot-committed commits does not verify.

Fact 1 plus fact 2 is the actual mechanism. Rewriting a handful of old commits silently unsigns the
entire mainline below them. On a repository whose ruleset requires verified signatures, nothing
fails at push time. The damage only surfaces later, at the next pull request that has to introduce
those commits to a protected branch.

Four defects in the current guidance

1. The premise is factually wrong. references/history-rewrite.md says filtering "re-signs
every commit it touches with the rewriter's own key". It does not. Verified directly against
GitHub's API: commits that returned verified: true with a full signature payload before the
mailmap run returned verified: false, reason: unsigned, signature: null afterward.

2. Gate 1 is unachievable whenever the target commits are not at the tip. The gate says to
"scope the rewrite to only the commits that must be modified". The cascade in fact 1 makes that
impossible. Rewriting 27 root-adjacent commits necessarily rewrites 880 descendants. The gate reads
as though blast radius is a choice, when the only choice is whether to rewrite at all. The first
question a rewrite has to answer is how far downstream it reaches, and the guidance never asks it.

3. The prescribed verification cannot detect the failure it is meant to catch. The reference
ends with git log --show-signature. That validates cryptography locally and knows nothing about
GitHub's committer-matching rule. A commit can be locally good and remotely rejected at the same
time. Measured on a deliberate probe:

Variant Committer git log %G? GitHub API
Re-sign only, committer preserved GitHub <[email protected]> G (good) verified: false, unknown_key
Re-sign, committer set to rewriter rewriter's noreply identity G (good) verified: true, valid

The prescribed check passes on both rows. Only the GitHub API distinguishes them, so verification
has to query it.

4. Gate 2 gives up author attribution unnecessarily. It says to set committer "and its author
too". The second row above sets only committer and preserves author as dependabot[bot], and
GitHub returns valid. Author attribution is irrelevant to verification, so a rewrite that changes
no content should keep it. The full repair preserved dependabot[bot], Copilot,
github-actions[bot], and ptr727-codegen[bot] as authors across all 884 commits while every one
of them verified. The reference's parenthetical justifies dropping author for "a rewrite that
alters content", which is a different case and should be distinguished rather than applied to both.

Collateral the guidance does not mention

The repair surfaced consequences that belong in a rewrite procedure and are absent today.

  • Open pull requests are auto-closed by a base force-push, and cannot always be reopened. The
    promotion pull request recorded base_ref_force_pushed and closed at the same timestamp. Its
    recorded head SHA became unreachable, and GitHub then refuses reopenPullRequest outright. The
    work had to move to a new pull request.
  • Every tag needs re-pointing, and a tag whose name embeds a short SHA from git describe
    becomes permanently inconsistent with the history it names.
  • Published package provenance never catches up. Source-link metadata in already-published
    artifacts references SHAs that no longer exist, and no rewrite can reach it.
  • Every other clone diverges and needs a hard reset rather than a pull.

Proposal: a dedicated git-history-rewrite skill

The current rule is one section inside a commit-conventions skill. The operation it governs is a
multi-step, high-blast-radius procedure with its own pre-flight, tool selection, verification, and
cleanup. That does not fit as a paragraph, which is plausibly why the wrong premise went unnoticed.

A dedicated skill should own:

  • Blast-radius pre-flight. Compute and report git rev-list --count <earliest-target>..<branch>
    for every branch before touching anything, plus what else is anchored to those SHAs (tags, open
    pull requests, published provenance, other clones). A rewrite whose reach is not stated up front
    is not ready to run.
  • Tool selection by signing behavior, stated explicitly rather than assumed:
    • git filter-repo: rewrites well, strips signatures, cannot sign.
    • git filter-branch --commit-filter 'git commit-tree -S "$@"': signs, and preserves the DAG
      including merge commits. Deprecated, and still the tool that does this job.
    • git rebase: re-signs, and does not preserve merge topology.
  • The identity rule, corrected. Set committer to the rewriter's signing identity on every
    rewritten commit. Preserve author. Preserve both dates by leaving GIT_AUTHOR_DATE and
    GIT_COMMITTER_DATE untouched.
  • Verification against GitHub, not the local checkout. Sweep every commit on every rewritten
    branch and require a 100 percent verified count, for example
    gh api --paginate "repos/{owner}/{repo}/commits?sha={branch}&per_page=100" --jq '.[].commit.verification.verified' | sort | uniq -c.
    Pair it with a content-integrity assertion that tree hashes and commit counts are unchanged, which
    is what proves a rewrite altered metadata only.
  • Sequencing and cleanup. Take a mirror backup and verify it with fsck before pushing, expect
    open pull requests to close, re-point tags, restore branch protection afterward, and reset every
    local clone.

One detail worth recording in the skill: ed25519 signing is deterministic, so re-running the same
rewrite over the same input reproduces byte-identical commits and hashes. A rewrite can be repeated
or extended to another branch later and still converge on the same history.

Suggested disposition

The premise error in references/history-rewrite.md is worth correcting on its own, ahead of any
skill work, because the file currently tells a reader that signatures survive a filter-repo run.

Activity

  1. ptr727 commented on Nov 1, 2026

    @ptr727
    OwnerAuthor

    Decision triage split the undecided item out of this issue into #3750, which carries the decision label. Everything else here stays as ordinary work an agent can do without the maintainer.

  2. ptr727 commented on Nov 1, 2026

    @ptr727
    OwnerAuthor

    Maintainer answer to the split decision #3750 (decision triage, 2026-11-01): Option 1: no new skill. Rewrite git-commit-conventions references/history-rewrite.md (and the matching premise at SKILL.md:134-135 and docs/repo-config.md:77).

  3. ptr727 commented on Nov 9, 2026

    @ptr727
    OwnerAuthor

    CodeRabbit raised this same defect again, on the carried copy in ptr727/VSCode-Server-DotNetCore#196 (tracker #3984, now closed into this issue). Re-checked on hub main at 42f2155b, git-commit-conventions SKILL.md and references/history-rewrite.md both still say filtering re-signs each touched commit. git filter-repo drops the signature, so the rewritten commits land unsigned.

    🤖 Generated with Claude Code

  4. ptr727 commented on Nov 13, 2026

    @ptr727
    OwnerAuthor

    Backlog burndown claim (round 8, group 2, away mode): branch burndown/history-rewrite-premise.

    Issues: #1391.

    Predicted file set:

    • .agents/skills/git-commit-conventions/SKILL.md, .github/skills/git-commit-conventions/SKILL.md, .claude-plugin/fleet-skills/skills/git-commit-conventions/SKILL.md
    • .agents/skills/git-commit-conventions/references/history-rewrite.md, .github/skills/git-commit-conventions/references/history-rewrite.md, .claude-plugin/fleet-skills/skills/git-commit-conventions/references/history-rewrite.md
    • .claude-plugin/fleet-skills/.source-digests/git-commit-conventions
    • docs/repo-config.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions