Skip to content

The mixed-version gate builds N-1 from HEAD~1, the parent of the commit it checks - #691

Merged
zlareb1 merged 1 commit into
mainfrom
fix/mixed-version-base
Nov 15, 2026
Merged

zlareb1 merged 1 commit into
mainfrom
fix/mixed-version-base

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 15, 2026

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

...

Why

On a pull request the mixed-version gate built N-1 from origin/<base_ref>, the target branch's tip when the job starts, while N is the merge ref, made against the target branch as it was when the pull request event fired. When the run starts later than that (a fork pull request waits for a maintainer to approve its workflows) and the target branch has gained a migration in between, N-1 is not an ancestor of N: it carries a migration N lacks.

The gate gives N+1 one no-op migration more than N, numbered after N's latest. That number is then the one the new migration on the target branch already holds, so N-1 is at N+1's schema version, does not see a newer build and keeps the workers_supervisor lease. Two checks fail: one process of the newest build runs the workers and N-1 leaves the lease to N+1. Both failing runs fit this exactly:

Run Merge ref's base, latest migration Target tip at job start, latest migration N+1 carries
#669 096 097 (#665 merged while the run waited) 097
#677 098 099 (#678 merged while the run waited) 099

The lease hand-off itself is correct: N-1 rightly keeps a lease from a build that is not newer than it. The gate's base is wrong.

The fix passes --base HEAD~1 for every event. On a pull request HEAD is the merge commit and HEAD~1 its first parent, the target branch the merge was made against, so N-1 is always N's parent, on main and on a release/X.Y line alike. On a push it is the previous commit, as before.

Scope and risk

.github/workflows/ci.yml (the gate's --base) and the gate's row in docs/development/testing.md. The gate script and the lease code are unchanged. A pull request run now checks the upgrade from the base its merge ref was made on, not from a newer tip; the push run on the target branch after the merge checks the upgrade from the real previous commit.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none.
  • Rollback: revert the commit.

Tests

  • The failing cases were checked against the migrations: each merge ref's base and the target tip at job start, as in the table above. No local run of the gate: it builds three servers and dashboards, and the mixed-version job on this pull request runs the new command.
  • pytest tests/unit/test_ci_clickhouse_pin.py tests/unit/test_code_test_gate.py tests/unit/test_compose_workers_service.py tests/unit/test_help_docs.py tests/unit/test_public_copy.py tests/unit/test_doc_links.py tests/unit/test_mixed_version_gate.py tests/unit/test_agent_instructions.py: 532 passed.
  • The full unit suite runs in CI.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code; the failing cases, the migration numbers at each merge ref's base and target tip, were checked.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

…it it checks

On a pull request origin/<base_ref> is the target tip at job start, which can carry a migration the merge ref lacks; N-1 then sits at N+1's schema and keeps the workers lease.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
@zlareb1
zlareb1 merged commit cec9d09 into main Nov 15, 2026
79 of 80 checks passed
@zlareb1
zlareb1 deleted the fix/mixed-version-base branch November 15, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant