The URL of a local build repo keeps changing

I posted this on StackExchange also, but there’s not a lot of flatpak traffic there, and this is a weird one.

In short, I build my application like this:

flatpak-builder --repo=buildrepo --force-clean --user --collection-id=org.flathub.Stable --gpg-sign=<my key fingerprint> build-dir com.example.myapp.json

Then to install, I first do this:

flatpak remote-add --user --collection-id=org.flathub.Stable --gpg-import=<my keyring> buildrepo ./buildrepo

And I expect to have a remote added called buildrepo, which has a URL like file:///path/to/buildrepo. Instead, I get:

$ flatpak remotes --user -d
Name      Title   URL                          Collection ID
buildrepo Flathub https://dl.flathub.org/repo/ org.flathub.Stable
flathub   Flathub https://dl.flathub.org/repo/ org.flathub.Stable

OK, weird, right? So let’s fix it.

$ flatpak remote-modify --user --url=file:///path/to/buildrepo --title="My Repo" buildrepo
$ flatpak remotes --user -d
Name      Title   URL                                  Collection ID
buildrepo My Repo file:///path/to/buildrepo            org.flathub.Stable
flathub   Flathub https://dl.flathub.org/repo/         org.flathub.Stable

Great. Now let’s make sure my app is in there…

$ flatpak remote-ls --user buildrepo
Name        Application ID                       Version       Branch
myapp       com.example.myapp                                  master
$ flatpak remotes --user -d
Name      Title   URL                                  Collection ID
buildrepo My Repo file:///path/to/buildrepo            org.flathub.Stable
flathub   Flathub https://dl.flathub.org/repo/         org.flathub.Stable

Everything still seems to be fine, so now we install…

$ flatpak install --user buildrepo com.example.myapp
Looking for matches…
error: No remotes found which provide these refs: [(org.flathub.Stable, app/com.example.myapp/x86_64/master)]
$ flatpak remotes --user -d
Name      Title   URL                          Collection ID
buildrepo My Repo https://dl.flathub.org/repo/ org.flathub.Stable
flathub   Flathub https://dl.flathub.org/repo/ org.flathub.Stable

It set my URL to flathub’s again!

There’s an added wrinkle. I have two Ubuntu Focal VMs set up, both with the same versions of flatpak (1.6.5) and flatpak-builder (1.0.10). On one of them, it behaves perfectly fine. The other, which I intend to use as a build machine, I see this behavior. So I don’t think it’s a bug, because the executables are identical (I checked their hashes on both machines). Does anyone have any suggestions?