fix(#978): stage roles.json in sync_agents alongside topology.json

topology::reconcile_roles writes roles.json to the meta dir, but
sync_agents never staged it. After #978 merged, roles.json showed up
as an untracked file in the meta repo (visible in `git status`) because
it followed the same pattern as topology.json and tool-groups.json but
was missed in the git add list.

Add the same conditional stage for roles.json: git add is a no-op when
the file is unchanged or absent, matching the existing pattern.
This commit is contained in:
atlas 2026-06-01 19:43:23 +02:00 committed by mara
commit 994f53d06f

View file

@ -148,6 +148,13 @@ pub async fn sync_agents(
if crate::tool_groups::tool_groups_path().exists() {
git(&dir, &["add", "tool-groups.json"]).await?;
}
// Stage roles.json when it exists. Written by topology::write_roles /
// reconcile_roles on first role assignment or manager default seeding.
// Without this, roles.json appears as untracked in the meta repo
// (visible in `git status`) which can confuse nix dirty-tree fetches.
if crate::topology::roles_path().exists() {
git(&dir, &["add", "roles.json"]).await?;
}
nix(&dir, &["flake", "lock"]).await?;
if std::path::Path::new(&dir).join("flake.lock").exists() {
git(&dir, &["add", "flake.lock"]).await?;