Skip to content

Cross-repo choreography is circular, and every way it broke today failed green — drop the ENGINE_REF dance, machine-check the invariants #2682

Closed

Description

@squid-protocol

Raised after running the full cross-repo choreography end-to-end for Batch B.3 (gitgalaxy#2681 + keyword-rosetta#35). Three separate things went wrong in one day, and they share a root cause.

The choreography is circular by construction

  • Corpus expected values depend on engine code → the corpus PR needs ENGINE_REF=pull/N/head
  • The engine PR's rosetta-audit depends on the corpus SHA → needs the corpus PR merged
  • But ENGINE_REF must be back to main before the corpus PR merges — and with main, the corpus gates fail, because engine main does not yet contain the fixes

No ordering satisfies all three. docs/GATING.md's step 2 in keyword-rosetta showed the strain directly — it trailed off mid-sentence: "engine PR must merge before the reset lands... in practice:". I rewrote that paragraph to read cleanly earlier today, which made a procedure that does not close sound like it does. That edit should be revisited.

In practice the deadlock is broken by merging the corpus PR with a knowingly-wrong ENGINE_REF, which is what happened: keyword-rosetta#35 merged with ENGINE_REF=pull/2681/head, so corpus main is now pinned to an engine branch and owes a reset that nothing enforces.

The dance is not necessary

Neither repo requires any status check to merge:

gitgalaxy main:        required_status_checks.contexts: []   checks: []
keyword-rosetta main:  "Branch not protected"

So rosetta-audit is advisory. The entire ENGINE_REF mechanism exists to make an advisory check green before merge. A simpler order has always been available:

  1. Merge the engine PR — rosetta-audit red, advisory, harmless
  2. Merge the corpus PR — ENGINE_REF never leaves main; its gates pass because engine main now has the fixes
  3. Bump KEYWORD_ROSETTA_REF

No ENGINE_REF edit, no reset debt, no deadlock, one fewer thing to forget.

ENGINE_REF's real value — verifying corpus numbers against unmerged engine code before committing to them — does not require a committed file. It is already achievable locally, and was: pointing GALAXYSCOPE_BIN at the engine working tree ran all 46 gates green before anything was pushed.

Everything that went wrong today failed GREEN

failure how it presented
KEYWORD_ROSETTA_REF set to a 7-char SHA (#2680) actions/checkout resolved it as a ref name, job died at checkout — indistinguishable from a real gate failure, red for hours on main
ENGINE_REF left at pull/N/head on corpus main nothing fails; future corpus PRs would silently build against a frozen ref
tree_sitter_accuracy_audit.py / tri_comparison_chart.py without galaxyscope on PATH (#2680) skipped every language, printed all OK, exit 0

Three cross-repo references that were wrong, none of which announced itself. Documentation caught none of them — including the documentation written the same day.

Proposals, cheapest first

  1. Drop ENGINE_REF from the normal flow. Document merge-engine-then-corpus-then-pin as the default, and keep ENGINE_REF only for the rare case where the corpus genuinely must be verified in CI against unmerged engine code. Removes the deadlock and the reset step entirely.
  2. Assert the invariant on push to corpus main. A one-step workflow that fails (or opens an issue) when ENGINE_REF != main on main. Catches the forgotten reset automatically instead of relying on a person.
  3. Make the pin format machine-checked. A step in rosetta-audit.yml that fails loudly when KEYWORD_ROSETTA_REF is not 40 hex characters, before the checkout step swallows it as a ref name.
  4. Make "did it actually run?" explicit. Every audit that can no-op should assert a plausible unit count and fail otherwise — 0 languages checked, all OK must be a failure, not a pass.

(2) and (3) are each a handful of YAML lines and would have caught two of today's three incidents outright.

Activity

  1. added
    enhancement
    ci-cd
    on Sep 3, 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

    ci-cdenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions