From dd41d4b2a23fa93709c590c634f1064225a884eb Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:10:33 -0500 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9B=20fix(packs):=20follow=20live?= =?UTF-8?q?=20gateway=20backend=20overrides=20when=20placing=20the=20revie?= =?UTF-8?q?wer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: MikeSpreitzer <14296719+MikeSpreitzer@users.noreply.github.com> --- ...14678-reviewer-follows-gateway-override.md | 1 + src/pkg/dashboard/api_packs.go | 29 ++++++++++++- src/pkg/dashboard/pack_gateway_model_test.go | 41 +++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 changelog.d/fixed-14678-reviewer-follows-gateway-override.md diff --git a/changelog.d/fixed-14678-reviewer-follows-gateway-override.md b/changelog.d/fixed-14678-reviewer-follows-gateway-override.md new file mode 100644 index 0000000000..e873b85086 --- /dev/null +++ b/changelog.d/fixed-14678-reviewer-follows-gateway-override.md @@ -0,0 +1 @@ +The ACMM level pack now places the reviewer on the inference gateway the operator moved the other agents onto from the dashboard, instead of leaving it on copilot (#14678). diff --git a/src/pkg/dashboard/api_packs.go b/src/pkg/dashboard/api_packs.go index 2eeafe1832..a4f763608e 100644 --- a/src/pkg/dashboard/api_packs.go +++ b/src/pkg/dashboard/api_packs.go @@ -1173,6 +1173,16 @@ type agentBackendVote struct { // hiveAgentBackends snapshots the backend of every enabled agent, keyed by // name, for hiveGatewayBackend. +// +// An agent's backend is the one it actually runs on: a live BackendOverride +// wins over its config backend, exactly as the dashboard's agent cards and +// config dialog show it (#14678). The override is replayed from +// /data/hive-state.json before the boot-time pack apply, so a hive whose +// operator moved scanner/quality/guide onto LiteLLM through an override saw +// LiteLLM on every card while this vote still read their pack-owned copilot +// config backend, found no gateway, and left the reviewer on copilot. An +// override differing from the config backend is an explicit placement, so it +// counts as an operator pick. func (s *Server) hiveAgentBackends() map[string]agentBackendVote { backends := map[string]agentBackendVote{} for name, agent := range s.deps.Config.Agents { @@ -1180,15 +1190,32 @@ func (s *Server) hiveAgentBackends() map[string]agentBackendVote { continue } backend := strings.TrimSpace(agent.Backend) - backends[name] = agentBackendVote{ + vote := agentBackendVote{ backend: backend, operatorOwned: agent.BackendIsOperatorOwned() || s.unownedGatewayBackend(agent), packCLI: agent.BackendIsPackOwned() && config.IsCLIBackend(backend), } + if override := s.agentBackendOverride(name); override != "" && !strings.EqualFold(override, backend) { + vote = agentBackendVote{backend: override, operatorOwned: true} + } + backends[name] = vote } return backends } +// agentBackendOverride is name's live BackendOverride, or "" when the agent +// has none or is not in the manager's process table. +func (s *Server) agentBackendOverride(name string) string { + if s.deps.AgentMgr == nil { + return "" + } + proc, err := s.deps.AgentMgr.GetStatus(name) + if err != nil || proc == nil { + return "" + } + return strings.TrimSpace(proc.BackendOverride) +} + // unownedGatewayBackend reports whether agent sits on an inference backend or // configured gateway with no backend_owner stamp. A pack only ever writes a // subscription CLI, and stamps a gateway it moved an agent onto as pack-owned, diff --git a/src/pkg/dashboard/pack_gateway_model_test.go b/src/pkg/dashboard/pack_gateway_model_test.go index 20074ba669..e86946904c 100644 --- a/src/pkg/dashboard/pack_gateway_model_test.go +++ b/src/pkg/dashboard/pack_gateway_model_test.go @@ -447,3 +447,44 @@ func TestApplyPackUnownedCLIBackendsDoNotChooseGateway(t *testing.T) { t.Errorf("reviewer moved onto %q with no gateway picked", got.Backend) } } + +// TestApplyPackFollowsGatewayBackendOverrides covers the second #14678 reopen: +// the operator's agents ran on LiteLLM through a live BackendOverride (replayed +// from hive-state.json before the boot-time pack apply) while their config +// backend was still the pack's copilot. The dashboard showed LiteLLM on every +// card, but the pack read only the config backend, found no gateway, and kept +// the L2 reviewer on copilot. +func TestApplyPackFollowsGatewayBackendOverrides(t *testing.T) { + for _, tt := range []struct { + name string + reviewer *config.AgentConfig + }{ + {"reviewer created by the level", nil}, + {"pack-owned copilot reviewer repaired", &config.AgentConfig{ + ID: "reviewer", Role: "reviewer", Enabled: true, + Backend: "copilot", BackendOwner: config.FieldOwnerPack, + Model: "claude-fable-5", ModelOwner: config.FieldOwnerPack, + }}, + } { + t.Run(tt.name, func(t *testing.T) { + srv := newFullServer(t) + for _, name := range []string{"scanner", "quality", "guide"} { + a := packCLIAgent(name) + srv.deps.Config.Agents[name] = a + srv.deps.AgentMgr.AddAgent(name, a) + if err := srv.deps.AgentMgr.SetBackendOverride(name, "litellm"); err != nil { + t.Fatalf("SetBackendOverride(%s): %v", name, err) + } + } + if tt.reviewer != nil { + srv.deps.Config.Agents["reviewer"] = *tt.reviewer + } + if _, err := srv.ApplyPack(2); err != nil { + t.Fatalf("ApplyPack(2): %v", err) + } + if got := srv.deps.Config.Agents["reviewer"]; got.Backend != "litellm" || got.Model != "" { + t.Errorf("reviewer backend=%q model=%q, want litellm with no model like the agents the operator moved", got.Backend, got.Model) + } + }) + } +} From 83d5cbd2a5c852cca5b78c866dddad9962cae79f Mon Sep 17 00:00:00 2001 From: "hivecommons-hive[bot]" <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:12:20 +0000 Subject: [PATCH 2/3] changelog: fragment for #16301 Generated by changelog-fragment-guard from the PR title (#5675). Edit the wording freely, or replace this file with the no-changelog label if the change is not user-visible. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- changelog.d/fixed-16301.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/fixed-16301.md diff --git a/changelog.d/fixed-16301.md b/changelog.d/fixed-16301.md new file mode 100644 index 0000000000..11887ee4ad --- /dev/null +++ b/changelog.d/fixed-16301.md @@ -0,0 +1 @@ +- fix(packs): follow live gateway backend overrides when placing the reviewer (#16301) From a605dcd4e41b01c4c0ebbfcf7a5d15f0db75c9f8 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:38:02 -0500 Subject: [PATCH 3/3] chore(changelog): bullet the fragment and drop the duplicate Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- changelog.d/fixed-14678-reviewer-follows-gateway-override.md | 2 +- changelog.d/fixed-16301.md | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 changelog.d/fixed-16301.md diff --git a/changelog.d/fixed-14678-reviewer-follows-gateway-override.md b/changelog.d/fixed-14678-reviewer-follows-gateway-override.md index e873b85086..0cf9076cc2 100644 --- a/changelog.d/fixed-14678-reviewer-follows-gateway-override.md +++ b/changelog.d/fixed-14678-reviewer-follows-gateway-override.md @@ -1 +1 @@ -The ACMM level pack now places the reviewer on the inference gateway the operator moved the other agents onto from the dashboard, instead of leaving it on copilot (#14678). +- The ACMM level pack now places the reviewer on the inference gateway the operator moved the other agents onto from the dashboard, instead of leaving it on copilot (#14678). diff --git a/changelog.d/fixed-16301.md b/changelog.d/fixed-16301.md deleted file mode 100644 index 11887ee4ad..0000000000 --- a/changelog.d/fixed-16301.md +++ /dev/null @@ -1 +0,0 @@ -- fix(packs): follow live gateway backend overrides when placing the reviewer (#16301)