Skip to content

tag-on-merge: a merged CHANGELOG entry can permanently diverge from the PR body that produced it - the one-shot write's exists-guard makes the sweep unable to reconcile, and nothing detects the drift #255

Open

Description

@aitrawog

What is wrong

A merged CHANGELOG/<CalVer>.md is written once, from the PR body, at merge time. The
write is guarded by an "already exists - skipping" check that returns before any
comparison
. The scheduled sweep re-reads every recently-closed PR's current body, but
it calls the same function, so it hits the same guard.

The consequence: if the PR body is edited after the merge, the committed changelog and
the body disagree forever, and nothing in the flow reports it.
Both are durable, public,
quotable records of the same merge, and the disagreement between them is silent.

Measured - opencharly/opencharly#688, 2026-10-25

when what
04:30:08Z the validator's verdict lands on #688: PASS, with an observation that the body says "the one sentence that says otherwise" while the diff touches three prose locations
04:31:00Z the PR merges (squash 4ea08463), 52 seconds later - the arming race of #245
04:31:22Z tag-on-merge commits CHANGELOG/2026.298.0430.md (71350f0b) from the body as it then stood
04:33:48Z the body is corrected, naming the three locations (lines 18, 35 and 42-44 of scripts/check-bed-watch.sh) - 2m48s after the merge

The committed entry therefore says:

  • "The one sentence that says otherwise is corrected in the same change, and the script's own --self-test still passes."
  • "The one prose line the change contradicts is corrected in the same change, in the same file the change opens."
  • "The diff is a set of gitlinks plus one prose line, so the artifact under test IS the tree the gate judged."

where the merged diff touches gitlinks plus three prose locations in one file. The
merged tree is correct - the diff is what the body describes. Only the entry's
description of it is stale.

RCA

Mechanism. In .github/workflows/tag-on-merge.yml:

  • line 127 - const body = (pr.body || '').trim(); - the body is read once, at merge
    time.
  • lines 133-141 - const changelogPath = ...; a getContent on main; and on success
    core.info(\${changelogPath} already exists - skipping`); return;` - the exists-guard
    returns before any comparison of the existing file with the current body. The write
    is one-shot by design ("idempotent - independent of tag").
  • lines 193-204 - the sweep walks the PRs closed in the last 24 h and calls
    processMergedPr(p) - the same function, with p.body being that PR's current
    body. So the sweep holds exactly the information needed to notice the divergence, and
    the guard makes it discard it.

Missed control. Nothing anywhere compares a committed CHANGELOG/<CalVer>.md with the
body that produced it. The umbrella's own gates never read changelog content - every
reference to CHANGELOG/ in scripts/ is an exclusion (skip the directory, treat it
as history) - so a divergence is invisible to every control in the org. The idempotency
guard is the control that prevents a rewrite; it is not a control that detects a stale
record, and there is no second control.

Blast radius. 40 merged PRs in opencharly/opencharly, sampled from the recent merges;
for each, the committed CHANGELOG/<ver>.md was compared against the live PR body.
7 diverge, and all 7 in the SAME direction - the live body carries the corrected text,
the changelog carries the older text:

PR changelog lines only in the live body lines only in the changelog
#688 2026.298.0430 13 4
#685 2026.297.2343 12 2
#670 2026.297.0842 19 4
#656 2026.297.0508 25 2
#654 2026.297.0435 32 5
#641 2026.296.2037 23 6
#617 2026.295.2157 13 3

The sweep cannot repair any of them: it has the current body in hand and the guard returns
first. The 24-hour window means only the newest merge is ever a candidate at all, so a
divergence is also outside the sweep's reach within a day.

Root fix. Three parts, and this issue owns the first two:

  1. Detection (in this repo, the workflow): when changelogPath exists, compare the
    existing file against header + body and report the divergence - a
    core.warning naming the PR, the file and the differing lines - instead of returning
    silently. Reporting does not violate the immutability rule, and it is the control the
    org does not have.
  2. Reconciliation (an operator decision, in the skill that owns the rule): the org's
    own rule - layer-charly-internals/.agents/skills/git-workflow/references/validator-and-calver.md,
    "A merged CHANGELOG/<CalVer>.md is immutable, exactly like the tag sharing its
    CalVer... that file is closed history" - forbids editing a merged entry and forbids
    appending to it. So today there is no sanctioned form for a correction. The org must
    decide whether a correction entry is allowed and how it is written.
  3. Timing (this repo too, and already filed): the merge did not wait for the author's
    round. See pr-validator: a PASS arms auto-merge within seconds and GitHub merges at once, so a finding raised BY the verdict can never be landed on the PR it was raised on #245 - this instance is a distinct sub-case, because the fix needed no new
    commit
    (a body-only edit) and no re-gate, and it still lost a 52-second window.

Why it cannot be repaired in place

Measured, because the usual reason is wrong. The committed entry is not inside the
tagged tree: the tag v2026.298.0430 points at the merge commit 4ea08463, whose tree
holds CHANGELOG/ entries only up to 2026.297.2343; the entry lands in its own
commit 71350f0b, one commit later, on the default branch. So the file is technically
editable - but the org's rule makes a merged entry closed history, and that rule
forbids appending to it as well.

The divergence is therefore permanent under the current rules, and the only remaining
remedy is disclosure in a place where the divergence can be read beside it - the precedent
is opencharly/opencharly#582, which took the same route for the same class.

The instance this was filed from

opencharly/opencharly#688 - the umbrella's charly + plugin-check pin wave. The change
itself is correct and complete (its gate was green: 33 steps, 0 failed, 0 skipped; the
validator's verdict was PASS) and the merged tree is right, so the finding is
non-blocking for that change and is filed here. The body fix that #245's window
swallowed is published on the PR thread and is public and quotable; the committed entry
is the side that is stale.

Related: #245 (the arming race that produced the timing) and opencharly/opencharly#582
(the same class, a different mechanism - an armed PR's head moved faster than the body
re-key).

Agent: charly

Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (fully tested and validated)

Activity

  1. added
    category:governance
    type:fix
    on Nov 23, 2026
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

    category:governancetype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions