LearnNewsExamplesServices
Frontmatter
id13710
titlefriction→gold: mechanical pre-push branch-freshness guard (the revert-trap) — #10212 discipline-mandate recurs across families
stateClosed
labels
aiarchitecturemodel-experience
assigneesneo-opus-ada
createdAtJun 21, 2026, 6:34 AM
updatedAtJun 21, 2026, 11:25 AM
githubUrlhttps://github.com/neomjs/neo/issues/13710
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtJun 21, 2026, 11:25 AM

friction→gold: mechanical pre-push branch-freshness guard (the revert-trap) — #10212 discipline-mandate recurs across families

Closed v13.1.0/archive-v13-1-0-chunk-4 aiarchitecturemodel-experience
neo-opus-ada
neo-opus-ada commented on Jun 21, 2026, 6:34 AM

Premise

#10212 (CLOSED-COMPLETED 2026-04-22) closed the stale-branch hygiene gap with a discipline-mandate ("rebase before push", pull-request skill §). #11133 then shipped a mechanical pre-push gate for the chore-sync sub-pattern (buildScripts/util/check-branch-discipline.mjs) explicitly because "discipline-only enforcement failed empirically; mechanical gate is load-bearing." Its JSDoc cites a sister "branch freshness check" — mis-numbered @see #11141 (#11141 is actually the ai:restore ticket) — that was never built mechanically.

The branch-freshness / revert-trap sub-pattern still recurs despite #10212's discipline-mandate, across families:

  • #10212's own anchor: 4× stale-branch in ~4h (PRs #10193/#10196/#10204/#10211) — branches forked pre-merge re-introduced merged hunks.
  • #13635 (operator, 2026-06-20): a soft-reset on a branch 3 behind origin/dev force-pushed REVERTS of swarm work.
  • #13699→#13708 (me, 2026-06-21): committed to a MERGED+deleted branch from a stale summary → re-pushed it 5 PRs behind dev (revert-trap: git diff origin/dev..HEAD = 32 files / −1716, would revert merged peer work).

Discipline-only failed (3+ recurrences across families + the operator); the mechanical gate is the §self_evolving_systems next step — exactly #11133's own established pattern.

The Fix (direction; design converges on review)

Extend check-branch-discipline.mjs (it already fetches origin/dev + computes origin/dev..HEAD) with a branch-freshness check: detect when HEAD is behind origin/dev in a way that would mislead the PR diff (e.g. the two-dot origin/dev..HEAD carries files outside the three-dot origin/dev...HEAD actual-changes), and surface remediation (rebase / cherry-pick onto fresh origin/dev). Also fix the stale @see #11141 → this ticket.

Open design questions (for the reviewer):

  • Signature: behind-count threshold vs two-dot≠three-dot file-delta vs "this branch's PR is already merged" detection.
  • Severity: warn (advisory, exit 0) vs block (like the chore-sync check, with --no-verify bypass). Lean warn-first to avoid noise on normally-behind branches.

Acceptance Criteria

  • check-branch-discipline.mjs surfaces the revert-trap signature at pre-push (low false-positive rate — does not fire on normally-current branches).
  • Stale @see #11141 corrected to this ticket.
  • A focused test for the detection logic.

Surfaced by @neo-opus-ada (empirical: the #13708 recovery this session). Siblings: #10212 (discipline-mandate), #11133 (chore-sync mechanical gate).

tobiu referenced in commit d15b6c3 - "feat(ai): mechanical pre-push branch-freshness guard for the revert-trap (#13710) (#13713) on Jun 21, 2026, 11:25 AM
tobiu closed this issue on Jun 21, 2026, 11:25 AM
tobiu referenced in commit 1493fc7 - "feat(ai): diff-scope the ticket-archaeology pre-commit hook to staged-added lines (#13717) (#13718) on Jun 21, 2026, 11:28 AM
tobiu referenced in commit 53688a3 - "feat(ai): diff-scope block-alignment to staged-added lines via --staged (#13720) (#13721) on Jun 21, 2026, 11:36 AM