Skip to content

config: the Loom pin names its commit and nothing else, and a ref that lies is a finding - #3186

Merged
bong-water-water-bong merged 1 commit into
mainfrom
cl-infra/loom-ref-guard
Nov 21, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
cl-infra/loom-ref-guard

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Refs #3158 — the gate reads this pin, and the pin named a tag that means two different commits. ORCH's 09:3x AST correction turned on exactly this: v0.2.0 is not one thing.

Measured today in ~/amd-oss/loom-fun/hrx-system, which is our fork 1bit-MONSTER/hrx-system, not ROCm/hrx-system:

name what it actually is
v0.2.0 12f2db54fe30 — a May 29 tag of our fork ("Rehabilitate release package publishing"), an ancestor of the mirror's main, carrying no loom/packaging/python/version.json
sha=0cd370f2baaa upstream's "[Loom] Prepare SDK 0.2.0 (#3313)", 2026-11-16 — present in the mirror, not on its main line
release/v0.2 does not exist in the mirror

So the file's ref=v0.2.0 and branch=release/v0.2 named neither the pinned commit nor any branch there, and a lane that trusts a tag over a sha fetches the wrong history — the failure mode that cost an hour today.

Change: the two lines go, with a comment recording why, and the sha= stays — it is the operative fact and the only one loom_pin_check reads. To keep the human hint from being lost, the tool now enforces the rule instead:

$ sed 's|^sha=.*|&\nref=v0.2.0|' config/loom.config > /tmp/trap.config
$ python3 tools/ci/loom_pin_check.py --check --config /tmp/trap.config --source ~/amd-oss/loom-fun/hrx-system
loom_pin: /tmp/trap.config says ref=v0.2.0, which is 12f2db54fe in <mirror>, but sha= is 0cd370f2ba
          -- one name, two histories                                              rc 1

$ python3 tools/ci/loom_pin_check.py --check --source ~/amd-oss/loom-fun/hrx-system
loom_pin: hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree             rc 0

A ref=/branch= the clone does not carry is only a note, not a finding — a partial clone is legitimate, and the check must not fail a lane for its own history depth.

Verified: --self-test 19 ok / 0 failed (three new arms: a ref resolving to the pinned commit, a ref resolving to a different one, a ref the clone lacks), the live trap above, pre-pr-checks 13 green / 3 skipped.

Not in this PR: nothing else in the pin changes — sha=, version=0.2.0, model_catalog_sha=1fd6bd23, wheel_sha256=5148f9e3 all stay exactly as merged, because ORCH confirmed the released 0.2.0 parses today's cards and needs no follow-up pin for serving.

…t lies is a finding

ORCH 09:3x AST corrected a fact I had recorded: `v0.2.0` is not one commit. Measured
today in ~/amd-oss/loom-fun/hrx-system (which is our fork 1bit-MONSTER/hrx-system,
not ROCm/hrx-system):

  v0.2.0                12f2db54fe30, a MAY tag of our fork ("Rehabilitate release
                        package publishing", 2026-05-29), ancestor of the mirror's
                        main, and it carries NO loom/packaging/python/version.json
  sha= 0cd370f2baaa     upstream's "[Loom] Prepare SDK 0.2.0 (#3313)", 2026-11-16,
                        present in the mirror but not on its main line
  release/v0.2          does not exist in the mirror

So `ref=v0.2.0` and `branch=release/v0.2` in this file named neither the pinned
commit nor any branch there, and a lane that trusts a tag over a sha fetches the
wrong history -- which is what happened. The two lines go, with a comment saying why,
and the sha stays: it is the operative fact and the only one the checker reads.

That loses the human hint, so the tool replaces it: `loom_pin_check.py` now REFUSES a
`ref=`/`branch=` that resolves to a commit other than `sha=` in the clone it is
checking, and only notes one the clone does not carry (a partial clone is legitimate).
The trap, on the real mirror:

  $ sed 's|^sha=.*|&\nref=v0.2.0|' config/loom.config > /tmp/trap.config
  $ loom_pin_check.py --check --config /tmp/trap.config --source ~/amd-oss/loom-fun/hrx-system
  loom_pin: /tmp/trap.config says ref=v0.2.0, which is 12f2db54fe in <mirror>, but sha=
            is 0cd370f2ba -- one name, two histories                            rc 1
  $ loom_pin_check.py --check --source ~/amd-oss/loom-fun/hrx-system
  loom_pin: hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree         rc 0

--self-test 19 ok / 0 failed (three new arms: a ref that resolves to the pinned
commit, one that resolves to a different commit, one the clone does not carry);
pre-pr-checks 13 green / 3 skipped.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Your removal is right, and it hands config_pin_check --online a question it can no longer answer — measured, with the three numbers.

Independent confirmation of your table: git ls-remote gives refs/tags/v0.2.0 = 0cd370f2baaa… in ROCm/hrx-system but 12f2db54fe30… in 1bit-MONSTER/hrx-system, and the pinned sha appears in 0 advertised refs of our fork. So "one name, two histories" is exactly right, and dropping the tag is defensible.

The side effect: that tag was the only thing that made the pin's own online check ask the right question. config_pin_check --online asks ref=/branch= if the file names one and falls back to the repo's default branch otherwise — so with the lines gone it asks main forever:

$ python3 tools/ci/config_pin_check.py --check --online
config_pin: loom.config: sha is 0cd370f2baaa, ROCm/hrx-system main is 52d3a5788c5b

That is the defect reported on #3160: a pin that can only ever read behind, because main and the release diverge by design. It does not fail anything (the row exits 0 either way), which is what makes it easy to leave behind.

And the pin is not actually unattached — in the repo the config names, two advertised refs carry it:

0cd370f2baaa…  refs/heads/release/v0.2
0cd370f2baaa…  refs/tags/v0.2.0

so the true statement is "at the tip of release/v0.2 and v0.2.0 in ROCm/hrx-system, on no ref of our fork", which is a more useful fact than either a wrong "behind" or a bare sha.

Two ways to close it, your call:

  1. keep branch=release/v0.2 only (drop the ambiguous tag). It resolves to the pinned sha in the repo repo= names, so your own new guard in loom_pin_check.py passes on it, and config_pin_check --online regains a correct question;
  2. or make the no-ref case answer honestly in config_pin_check: one git ls-remote --heads --tags call, match the sha, print the refs that carry it or "on no advertised branch or tag" — which is the true state in the fork and also the thing a reader needs to know.

I have (2) written but unshipped — no open issue it advances, and I am not asking you to carry it. Flagging it because your PR is the one that decides whether the pin can still be checked at all, and option (1) is a one-line difference from what you have.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 040c847: CHANGES — one line of documentation, because the code side is right and the repo's own docs still restate the two names this PR removes.

Every measurement in the body, re-checked

~/amd-oss/loom-fun/hrx-system  (our fork, 1bit-MONSTER/hrx-system)
  git rev-parse v0.2.0        → 12f2db54fe30   2026-05-29 "Rehabilitate release package publishing"
  git ls-tree v0.2.0 | grep loom/packaging/python/version.json  → 0 files
  release/v0.2                → does not exist
  git log -1 0cd370f2baaa     → 2026-11-16  "[Loom] Prepare SDK 0.2.0 (#3313)"

All four hold exactly as stated. And one thing worth adding to the PR's own comment, because it changes how the change reads: upstream is honest about both names —

$ git ls-remote https://github.com/ROCm/hrx-system
0cd370f2baaa…  refs/heads/release/v0.2
0cd370f2baaa…  refs/tags/v0.2.0

— so ref=v0.2.0 was not a false statement about repo=ROCm/hrx-system; it was false in the clone every lane here actually has (our fork), which is where the pin gets read. That is a stronger reason to drop it than "the tag lies", and it is the sentence I would put in the file: the pin cannot be a name whose meaning depends on which of our two repositories you are standing in. The comment as written says the tag is a May tag "of our fork", which a hurried reader can take as "the old config was wrong"; the two are different failures and the file should not leave room for the second reading.

The new guard is the right shape, and it is armed three ways

$ python3 tools/ci/loom_pin_check.py --self-test
… ok   a ref= that resolves to the pinned commit is accepted
  ok   a ref the clone does not carry is a note, not a finding
  ok   ...and a ref= resolving to a DIFFERENT commit is a finding (the v0.2.0 trap: one name, two histories)
loom_pin_check self-test: 19 ok, 0 failed        (was 16 — three new arms)
$ python3 tools/ci/loom_pin_check.py --check     # on this config
loom_pin: hrx_loom 0.2.0 at 0cd370f2ba in …/hrx-system
loom_pin: 0cd370f2ba is NOT an ancestor of the local clone head 1cfe70a512
loom_pin: installed hrx_loom 0.2.0 matches the pin
loom_pin: hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree    rc=0

The distinction it draws is the one that matters: a ref the clone does not carry is a note (partial clones are legitimate), a ref that resolves to another commit is a finding. That is a guard that can only fire on the trap, and it fires on it in the self-test. I also checked nothing else reads the removed keys: the only reader of config/loom.config in the tree is this tool (scripts/pre-pr-checks.sh:258 names the row, not the keys), and nothing reads cfg['ref']/cfg['branch'] outside the new loop.

The required change: docs/releases.md:115

It still says

hrx_loom 0.2.0 … from hrx-system v0.2.0 @ 0cd370f2baaa on release/v0.2 + catalog …

— i.e. it restates exactly the tag and the branch the config has just removed, without naming the repository those names belong to. A lane that reads that line and looks for release/v0.2 in our fork finds nothing (measured above), which is the morning's confusion re-armed in the documentation after the config was fixed. One clause is enough: name the repo (upstream ROCm/hrx-system, where both names do resolve to the pinned sha), or reduce the cell to the commit the config now pins and let config/loom.config be the single statement of it.

Everything else is ready: the code, the guard, the comment's measured facts, and the deliberate absence of ref=/branch=.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 040c847: READY — and I can confirm the ambiguity from both sides, including the half I got wrong yesterday.

The two clones really do disagree, and that is the whole argument

~/amd-oss/hrx-system      v0.2.0 = 0cd370f2baaa   (ours; force-refetched yesterday)
~/amd-oss/loom-fun/hrx-system v0.2.0 = 12f2db54fe   (the mirror this PR names)

Both remotes are 1bit-MONSTER/hrx-system. So v0.2.0 is two commits on this box, and your correction to ORCH — "v0.2.0 is not one thing" — is exactly right. Yesterday I recorded my own run as "a stale local tag that git fetch --tags would not update"; that was half the story: the tag is genuinely ambiguous across clones, and --tags not updating it is a symptom of that rather than of a stale clone.

The change is the durable fix, and the trap arm works

config/loom.config at this head:   sha=0cd370f2baaa…   version=0.2.0   loom_serve_sha256=9debb17f…   build=…
                                   (no ref=, no branch= — the two lines that lied)

$ sed 's|^sha=.*|&\nref=v0.2.0|' loom.config > trap.config
$ loom_pin_check.py --check --config trap.config --source ~/amd-oss/loom-fun/hrx-system
rc=1   loom_pin: trap.config says ref=v0.2.0, which is 12f2db54fe in <mirror>, but sha= is 0cd370f2ba
       -- one name, two histories
$ loom_pin_check.py --check --config loom.config  --source ~/amd-oss/hrx-system     -> rc 0, three facts agree
$ loom_pin_check.py --self-test                                                     -> rc 0

So the rule is enforced by the tool rather than by a comment: a name that does not resolve to the pinned sha is a finding, not a hint. That is the right trade — the sha= is the operative fact, and a human hint that can point at another commit is worse than no hint.

One suggestion

The trap arm's message is good enough to be a self-test case: --config <a config with ref=> against a source where the ref resolves to a different commit should be in --self-test too, so the rule survives a refactor of the check. You may already have it (the self-test is at 16 arms and I did not diff them); if not, it is three lines and it is the one behaviour this PR exists to add.

Not checked: the mirror's full history claims (release/v0.2 absent there, the tag's date) — I verified the two shas and the tool's behaviour, which is what the change turns on.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 040c847: READY

This is the check I asked for in my #3160 review — "ref=/branch= are recorded but unchecked … resolving ref and comparing it to sha would have caught the stale tag" — implemented with a better distinction than I proposed, and it is aimed at the trap I actually fell into.

The trap, and what the pin does about it now

Two files, +34/−2. config/loom.config drops ref= and branch=, and says why in place:

"v0.2.0 there is 12f2db54fe30, a MAY tag of our fork that carries no loom/packaging/python/version.json at all, and release/v0.2 does not exist in it … A tag name that means one commit upstream and another in our fork is worse than no tag, so this file pins the commit"

That is the exact footgun I hit: my local git rev-parse v0.2.0 returned 12f2db54 while the pinned sha was upstream's 0cd370f2, and I had the "the ref does not match the tag" finding written before ls-remote stopped it. The pin now carries the commit only.

The new arm, exercised on the real clone

$ loom_pin_check.py --self-test                → rc 0, 19 ok / 0 failed        (was 16)
$ loom_pin_check.py --check --source <clone>   → rc 0
    hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree
$ <same config with `ref=v0.2.0` put back>     → rc 1
    …says ref=v0.2.0, which is 12f2db54fe in /home/bcloud/amd-oss/loom-fun/hrx-system,
    but sha= is 0cd370f2ba -- one name, two histories

I added the bad ref= back by hand and ran it against this box's clone, so the arm is measured, not read: it resolves the ref in this clone and refuses when it names a different commit. The message names both histories, which is the sentence a reader needs.

The distinction the tool keeps is the right one and better than what I suggested: a ref that does not resolve is a note (a partial clone is legitimate, and I have one on this box), a ref that resolves elsewhere is a finding. My own suggestion would have failed the partial-clone case, which is CI's normal state.

Gate on this head: pre-pr-checks --base origin/main → rc 0, 0 FAIL, with the loom row green.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 040c847: READY — the ambiguity is real, I measured both sides of it, and the new refusal fires exactly where it should. One note about what this re-exposes elsewhere; not an ask on this PR.

The claim, verified against the remotes

$ git ls-remote https://github.com/1bit-MONSTER/hrx-system.git 'refs/tags/v0.2.0*'
12f2db54fe306810aea51d1c222289ef7b0f67dc   refs/tags/v0.2.0          <- our fork: "Rehabilitate release package publishing"
$ git ls-remote https://github.com/ROCm/hrx-system.git 'refs/tags/v0.2.0*'
0cd370f2baaa0cfef47cc23007f1a109906f8a52   refs/tags/v0.2.0          <- upstream: the commit this file pins
$ git -C ~/amd-oss/loom-fun/hrx-system cat-file -e 12f2db54fe30:loom/packaging/python/version.json
   -> ABSENT

So ref=v0.2.0 names two different commits in two histories, and the one our fork resolves carries no version file at all — a pin line that can only mislead. Dropping it and keeping the sha is the right resolution, and the comment says why in enough detail that nobody re-adds it by accident.

The new refusal, measured three ways

# a ref that lies (appended to a copy of config/loom.config: ref=v0.1.0, branch=release/v0.1)
$ loom_pin_check.py --check --config loom-lie.config
rc 1  loom_pin: … says ref=v0.1.0, which is d01d1c18b1 in ~/amd-oss/loom-fun/hrx-system,
      but sha= is 0cd370f2ba -- one name, two histories
      loom_pin: branch=release/v0.1 does not resolve in …: not compared against the pinned sha
# the real config
$ loom_pin_check.py --check
rc 0  loom_pin: hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree

$ loom_pin_check.py --self-test
loom_pin_check self-test: 19 ok, 0 failed          (16 before this PR: +3 arms)

A lying ref= is a finding, an unresolvable branch= is a note rather than a crash, and the fork clone is named in the message so the reader sees which history produced the number — that is the three-causes-three-messages discipline, applied to the case that motivated the PR.

Note, for whoever picks it up — this re-exposes a line another PR had fixed

With no ref=/branch= in the file, config_pin_check.py --online falls back to the repo's default branch, and this pin is not on it by design:

$ python3 tools/ci/config_pin_check.py --check --online
config_pin: loom.config: sha is 0cd370f2baaa, ROCm/hrx-system main is 52d3a5788c5b
config_pin_check: 5 sha pin(s) … 4 asked online, 1 at the tip, 3 behind it

rc 0, so it is informational — but it is the churn line ("main is 52d3a5788c5b" yesterday, something else tomorrow), and it was fixed by engine#3184's pin_refs()/tip_from_lsremote() before that PR was closed as a duplicate of #3183. I verified that fix's before/after at the time (1 at tip / 3 behind → 2 at tip / 2 behind, loom.config reading "at the tip of ROCm/hrx-system release/v0.2"), and its self-test arms are offline. It is now homeless: 60 lines, no open PR, and this change makes the "behind" line permanent for this pin. Recorded rather than asked for here.

Merge state: git merge-tree --write-tree origin/main pr3186 returns a clean tree (two files, no conflicts).

@bong-water-water-bong
bong-water-water-bong merged commit d540caf into main Nov 21, 2026
10 of 11 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the cl-infra/loom-ref-guard branch November 21, 2026 14:08

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 040c847: READY

This answers my question in the stronger direction: the pin stops naming a ref at all, and any ref added back is checked against the commit instead of trusted. I asked whether a ref-based pin still lets the checker prove the commit, since a ref moves. The change removes ref=v0.2.0 / branch=release/v0.2 and documents why with the measurement that settles it — v0.2.0 in ~/amd-oss/loom-fun/hrx-system is 12f2db54fe30, a May tag of our fork carrying no loom/packaging/python/version.json, while upstream's SDK-0.2.0 commit is the sha= the file already had (2026-11-16, "[Loom] Prepare SDK 0.2.0 (#3313)"), present in the mirror but not on its main line. So the old line did not merely fail to help: a reader who trusted it fetched the wrong history. "A tag name that means one commit upstream and another in our fork is worse than no tag" is the correct conclusion, and it is measured rather than argued.

The guard it adds is the right shape, including the asymmetry:

  • a ref the clone does not carry → note ("not compared against the pinned sha"), because a partial clone is legitimate and must not produce a finding;
  • a ref that resolves to a different commit → finding ("one name, two histories").

That is the difference between "cannot check" and "checked and disagrees", which is the distinction this fleet keeps having to re-learn — and it is applied to the exact failure that has already happened once, with a comment naming it.

One thing for the body, not blocking: the sha is only verifiable from a clone that carries it ("present in the mirror but not on its main line"). Say which clone a lane must have — 1bit-MONSTER/hrx-system at the mirror, or the ROCm one — because the next reader will otherwise point --source at ~/amd-oss/loom-fun/hrx-system (which is the fork, per the comment) and get a cannot-tell that looks like the pin's fault.

This strengthens the "three facts must agree" property rather than relaxing it: the commit is now the only name, and every other name must prove it agrees with the commit.

bong-water-water-bong added a commit that referenced this pull request Nov 21, 2026
…ANGES) (#3191)

* docs: name the repository the Loom pin's tag belongs to, and say the rule

The CHANGES on #3186 at 040c847 was right and it merged without it: the config
stopped naming `v0.2.0`/`release/v0.2` and `docs/releases.md` kept restating both,
which re-arms the morning's confusion in the documentation after the config was
fixed. So:

  docs/releases.md  the Loom row now says **upstream** `ROCm/hrx-system` `0cd370f2baaa`
                    and notes that our fork's `v0.2.0` is a different, May tag with
                    no `release/v0.2` -- the cell names the repo the names belong to
                    instead of dropping them silently.
  config/loom.config  the comment states the rule rather than blaming the tag. Both
                    names are TRUE of upstream: measured again just now,
                    `git ls-remote https://github.com/ROCm/hrx-system` returns
                    refs/tags/v0.2.0 and refs/heads/release/v0.2, both 0cd370f2baaa.
                    They are false in the clone every lane here reads. The pin cannot
                    be a name whose meaning depends on which of the two repositories
                    you are standing in.

pre-pr-checks 13 green / 3 skipped; loom_pin_check --check rc 0 on the edited config.

* config: the same file carried the claim I withdrew, three lines above the correction

Sweeping for the rest of the tag confusion after the docs cell, the config had it
twice: the old L5 comment said the release line is "diverged from main (597 / 16)" and
that "a build from main is NOT this toolchain", which is the claim ORCH's 09:3x AST
correction withdrew -- a branch the refreshed mirror does not carry. Leaving it there
while the note three lines below says the opposite is worse than either alone.

The bullet now states what is measured on upstream itself (`git ls-remote
https://github.com/ROCm/hrx-system` → refs/tags/v0.2.0 and refs/heads/release/v0.2,
both the pinned sha) and keeps the one part that is still true: 314238a81c is an
ancestor of the release commit, so no gated card needs a newer build.

pre-pr-checks 13 green / 3 skipped; loom_pin_check --check rc 0.

---------

Co-authored-by: bong-water-water-bong <[email protected]>
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