Repository navigation
Description
Summary
When a hotfix release (hotfixes → master) merges, the post-release automation force-resets next to master. Because a hotfix ships only its own commits — not whatever is queued on next — this discards every commit that was queued-but-unreleased on next, and then auto-closes the queued next → master release PR because its diff is now empty.
This is silent data loss: the queued work vanishes from all branches and its release PR closes as if it had shipped, when in fact nothing of it shipped.
Concrete occurrence (CLDMV/gh-broker)
Timeline:
- PR docs(embedded-tests): surface the embedded-tests-ci feature in onboarding #43 (
fix/... → next) merged intonext, advancing it to6625426(which carried the v0.2.5 version bump). This created the queuednext → masterrelease PR fix(v4): per-branch merge methods + PR-ref annotation in release-PR changelogs #44 (v0.2.5). - Separately, a Dependabot security bump went via
hotfixes, creating hotfix release PR docs(readme): modernize for v4; drop stale v3-launch markers; fix ruleset-generator links #46 (hotfixes → master) — also labeled v0.2.5. - docs(readme): modernize for v4; drop stale v3-launch markers; fix ruleset-generator links #46 merged to
master→master=6902569(v0.2.5), shipping only the hotfix's deps bump. - Post-release automation force-updated
next— reflog:This discardedorigin/next: 6625426 → 6902569 "forced-update"6625426and everything unique to it (all of docs(embedded-tests): surface the embedded-tests-ci feature in onboarding #43's commits:861ca99,a3c2247,fadfd29). nextnow equalsmaster(0 commits ahead), so the bot auto-closed release PR fix(v4): per-branch merge methods + PR-ref annotation in release-PR changelogs #44 as having nothing to release.
After the fact, #43's commits are on no branch — master, next, and hotfixes all point at 6902569, none of which contain them. They survive in this repo only because a separate in-flight feature branch happened to be forked from next while #43 was on it; absent that coincidence the work would have been recoverable only via reflog/SHA archaeology.
Root cause
The post-release next sync is a hard reset of next to master. That is only ever safe after a next → master release, where next's commits actually shipped to master. After a hotfix release, next still holds unrelated queued commits that did not ship, and resetting drops them.
Contributing factor — version collision: both the queued release PR (#44) and the hotfix release PR (#46) were assigned v0.2.5. The hotfix consumed the version, making the queued PR's version moot and its post-reset diff empty, which is what triggered the auto-close.
Recommended fix
- After a hotfix release, MERGE
masterintonext(or rebasenextontomaster) — never hard-resetnexttomaster. The merge brings the hotfix intonextwhile preserving next's queued commits. Reserve the reset-style sync fornext → masterreleases only (and even there, a merge is safer). - Don't hand the same version to a concurrent hotfix and next release. The version resolver should account for an in-flight hotfix so the queued
nextrelease doesn't collide on the sameX.Y.Z. - Guard the release-PR auto-close: only auto-close a
next → masterrelease PR when its content genuinely shipped to master (its head commits are ancestors of the new master tag), not merely becausenextwas reset to equalmaster.
Impact / severity
High — this is a silent data-loss path that fires whenever a hotfix ships while next has queued work. The queued commits disappear from every branch and the release PR closes as if released. It affects every consumer using the v4 next/hotfixes staging flow, not one repo.
Notes
Filed from CLDMV/gh-broker (release PRs #44 vs #46, feature PR #43). Related but distinct from #275 (the vars-in-composite CI break). Reflog evidence and orphaned-tip SHA (6625426) available on request.
Activity
Shinrai commentedon Sep 6, 2026
Triaged as a confirmed, critical data-loss bug (
Bug/priority: critical), verified against the release-flow code and the gh-broker incident.One correction to the framing worth recording: recommended fix #1 is already implemented and shipped. Since v4.16.11 (#169),
workflow-next-reset.ymldetermines the released lane from the squash commit's trailing(#N)→ PR head ref and, for a hotfix release, mergesmasterintonext(viamerge-master-into-branch) instead of force-resetting — preserving next's queued work. It's on the current@v4, so "always reset" is no longer the happy path.That leaves three real, still-live gaps:
Lane detection fails open to the destructive path. In
workflow-next-reset.yml(the "Determine released lane" step), the lane ishotfixonly whengh pr view <N> --json headRefNamereturns exactlyhotfixes. On any lookup failure (auth / rate-limit / mis-parsed(#N)— the error is swallowed by2>/dev/null || echo "") it falls through tolane=other, which force-resetsnext. The safe default must be the preserve path (merge), never the reset. This is the most likely proximate cause of the gh-broker occurrence —nextshows a plainforced-update, not a merge commit.Version collision (fix Min version not set in publish causes multiple tests to run #2) — unaddressed.
npm/steps/resolve-versionhas no awareness of an in-flight hotfix, so a queuednextrelease and a concurrenthotfixesrelease can both resolve to the sameX.Y.Z(fix(v4): per-branch merge methods + PR-ref annotation in release-PR changelogs #44 and docs(readme): modernize for v4; drop stale v3-launch markers; fix ruleset-generator links #46 both → v0.2.5). How the resolver should learn the in-flight hotfix version at resolve time is an open design question.Release-PR auto-close (fix release/v3.0.0 #3) — unaddressed / partly GitHub-native. fix(v4): per-branch merge methods + PR-ref annotation in release-PR changelogs #44 closed because after the reset
next == master(0 ahead), which GitHub itself treats as fully-merged and closes. Fixing gap 1 removes the trigger; a belt-and-braces guard is still worth adding.Fix scope and the design decision for #2 to follow before opening a PR.
Shinrai commentedon Sep 6, 2026
Root cause confirmed from the reset run's logs (gh-broker run 34014340050, the reset fired when #46 merged). Correcting my earlier note: fix #1's merge path exists but never executed — it has been dead code on every hotfix release.
The "Determine released lane" step logged:
prnumparsed correctly as46, butgh pr view 46 --json headRefNamereturned empty, sohead=""→lane=other→ the "Ensure next = master HEAD (normal release)" force-reset ran (✅ Force-reset complete via API. next → 6902569). Steps 8/9 (the hotfix merge) were skipped.Why the PR read returned nothing:
workflow-next-reset.yml's app-token step requestspermission_contents+permission_workflowsonly.create-app-tokenswitches to fine-grained mode as soon as any permission flag is set, granting only the requested scopes — so the token has nopull_requestspermission, andgh pr viewis silently denied (the error is swallowed by2>/dev/null || echo ""). Net: lane detection resolves tootherfor every hotfix release, the merge path never runs, andnextis force-reset — this exact data loss, on any repo with queued work onnext.Two independent defects, either alone sufficient to cause it:
pull_requestsscope → lane detection can't read the PR head → alwaysother.Fix plan (one PR into
next):permission_pull_requests: "true"to the token step (revives the merge path).nextwhen it holds commits not already onmaster— merge instead — so data loss is impossible regardless of lane detection. Stop swallowing thegherror.Version collision (fix #2) and the auto-close guard (fix #3) remain separate follow-ups.
refactor(release): request pull-requests READ (not write) for next-re…
fix(release): next-reset reads the released PR + fails safe to preser…
fix(release): floor release version at highest tag + reopen a spuriou…
cldmv-bot commentedon Sep 6, 2026
Closed in v4.26.2 — resolved by #278.