Skip to content

bug(ci): an Alembic version-line fork passes every required check, and the backstop for it is defeated by a learnings.md conflict #2828

Closed

Description

@vybe

What happened

The 2026-09-15 merge train walked 9 open PRs. Two of them (#2728, #2805) carried a live #2068 two-heads Alembic fork, and both had fully green checks — including pg-migrations and schema-parity, the required job whose unconditional single-head step (scripts/ci/check_alembic_heads.py) exists precisely to catch this.

Neither was caught by CI. Both were caught by running the guard by hand against the merged tree.

# origin/dev + #2805
alembic-heads: FAIL — resolves to 2 heads across 64 revision(s); exactly 1 is required.
  • 0062_agent_sync_state_git_dir_bytes_bigint
  • 0062_execution_fan_out_task_id
They fork at: 0061_execution_open_canvas

# origin/dev + #2728
alembic-heads: FAIL — resolves to 2 heads across 64 revision(s); exactly 1 is required.
  • 0059_telegram_group_context
  • 0062_execution_fan_out_task_id
They fork at: 0058_portal_file_dismissals

Because alembic upgrade head is singular and resolves its target before applying anything, either merge makes PostgreSQL apply zero revisions — every revision since the fork stops arriving, not only the forked one — while git reports no conflict, because each file is individually valid and the defect exists only in the relationship.

Why the required gate didn't fire

This is the #2533 class, already documented in architecture.md Invariant #3: the gate runs on the pull_request event, and GitHub does not re-trigger workflows when the base advances. #2805 branched before #2532 landed at 14:58; on the PR branch alone the graph genuinely is a single head (63 revision(s), 1 head), which is what the author ran and reported. The green tick is accurate about a base that no longer exists.

Why the backstop didn't cover it either — the new part

alembic-head-watch.yml exists for exactly this window. It did fire at 14:58 and posted on #2805:

PR #2805 conflicts with dev — head check not evaluated.

It could not evaluate because the PR had a conflict in docs/memory/learnings.md — an append collision in a prose file, entirely unrelated to migrations. So the guard for the silent-schema-fork class is disabled by the single most common merge conflict in this repo. On 2026-09-15, 4 of 9 open PRs conflicted on that one file.

That is the part worth fixing: a watcher that skips on any conflict is a watcher that is reliably absent on exactly the busy days when the fork is most likely.

Suggested direction

  1. Make the watch conflict-tolerant for its own concern. It doesn't need a mergeable tree — it needs the union of migrations/versions/ from dev and the PR. Read the PR's revision files directly (git show <pr-head>:<path>) and graft them onto dev's set, rather than requiring a clean git merge-tree of the whole repo.
  2. Report unevaluated as a distinct, visible state. "Not evaluated" currently reads like silence. If the watch cannot run, that should be legible on the PR as unknown, not absent.
  3. Consider whether a fork is cheap enough to detect at merge time as well (a pre-receive-equivalent check in the merge path), since that is the only moment the real merged graph exists.

Separately, the learnings.md collision itself has a durable fix that would reduce the blast radius here and elsewhere: per-PR fragment files under docs/memory/learnings/, assembled at release, the way changelog tooling does it.

Evidence

Found by /merge-train, 2026-09-15. Both PRs were ejected and their authors told to re-parent.

🤖 Generated with Claude Code

Activity

  1. added
    priority-p1
    type-bug
    theme-reliability
    on Sep 15, 2026
  2. dolho commented on Sep 16, 2026

    @dolho
    Contributor

    /claim

  3. added
    status-in-progress
    on Sep 16, 2026
  4. github-actions commented on Sep 16, 2026

    @github-actions

    Claimed by @dolho. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/2828-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #2828
  5. added
    status-in-dev
    and removed
    status-in-progress
    on Sep 16, 2026
  6. removed
    status-in-dev
    on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority-p1theme-reliabilitytype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions