Skip to content

fix: attribute builds to remote store for ssh-ng builds - #232

Open
lovesegfault wants to merge 1 commit into
maralorn:mainfrom
lovesegfault:fixes
Open

fix: attribute builds to remote store for ssh-ng builds#232
lovesegfault wants to merge 1 commit into
maralorn:mainfrom
lovesegfault:fixes

Conversation

@lovesegfault

@lovesegfault lovesegfault commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

Summary

When using --store "ssh-ng://...", Nix reports builds with empty host field in JSON output. nom was treating these as localhost. Now we detect the remote store from upload activities (which do have correct host info) and use that for builds.

Test plan

  • Tested local builds
  • Tested --store "ssh-ng://..." builds - now correctly attributed to remote host
  • Tested --builders "ssh://..." builds - works as before
  • Verified no parse errors for large activity IDs

@maralorn maralorn left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Hey, thank you for your contribution!

It’s a bit sad to switch from IntMap to a Map, but the Word-commit is probably fine. I will benchmark it just to be sure.

The empty hostname fix does not look correct enough to me, because I fear to many false positives when multiple remote builders and local builds are mixed.

Can we maybe explicitely track when we see a "ssh-ng://" with empty hostname and only apply the fix to those builds instead of all builds on Localhost?

Although I have to say, even then this feels super hacky. What if the source already exists on the remote-builder? Then this detection fails?

@lovesegfault

Copy link
Copy Markdown
Contributor Author

I fished out "Large activity IDs" into #243 so it can be handled separately.

@lovesegfault lovesegfault changed the title fix: remote store build attribution and large activity IDs fix: attribute builds to remote store for ssh-ng builds Jan 22, 2026
@lovesegfault

Copy link
Copy Markdown
Contributor Author

I've proposed a "real" fix for this upstream, but it's unfortunately a bit hacky there too. In the meantime, I'm going to try improving the fix here a bit.

When using remote stores via --store "ssh-ng://...", Nix reports Build
activities with an empty host field because the remote daemon thinks
it is building locally.

This uses the parent field from Nix JSON activity messages to scope
remote store detection to specific activity trees. When a CopyPath
upload to a remote host is observed, the remote store is associated
with that activity's parent. When a Build activity reports Localhost
as host, the parent chain is walked to find an associated remote store.
@lovesegfault

Copy link
Copy Markdown
Contributor Author

More upstream work in NixOS/nix#15215

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.

2 participants