diff --git a/changelog.d/added-19237-heartbeat-feature-negotiation.md b/changelog.d/added-19237-heartbeat-feature-negotiation.md new file mode 100644 index 0000000000..5e5304d98f --- /dev/null +++ b/changelog.d/added-19237-heartbeat-feature-negotiation.md @@ -0,0 +1 @@ +- Hub heartbeat feature negotiation (rollout step 5 of [#19056](https://github.com/hivecommons/hive/issues/19056)): a spoke may send `protocol: {version, features}` in its heartbeat, and with `HIVE_HUB_HEARTBEAT_PROTOCOL` on (default off) the hub answers with `protocol: {version, accepted, ignored}`, so a spoke learns which optional features this hub honours instead of guessing from its version. A version below `1` is still accepted, with every feature ignored and `unsupported_version` echoed; a heartbeat without `protocol`, or any heartbeat while the flag is off, is answered exactly as before ([#19237](https://github.com/hivecommons/hive/issues/19237)). diff --git a/src/docs/api-reference/hub-server.md b/src/docs/api-reference/hub-server.md index 847a64b977..1b6464adbd 100644 --- a/src/docs/api-reference/hub-server.md +++ b/src/docs/api-reference/hub-server.md @@ -43,7 +43,7 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | `POST` | `/api/shared-agent-pool/leases` | Hub handler-specific | Acquire or renew a shared CLI session lease | `pkg/hub/server.go:1751` | | `PUT` | `/api/shared-agent-pool/leases` | Hub handler-specific | Renew an active shared CLI session lease | `pkg/hub/server.go:1752` | | `DELETE` | `/api/shared-agent-pool/leases` | Hub handler-specific | Release a shared CLI session lease | `pkg/hub/server.go:1753` | -| `POST` | `/api/heartbeat` | Hub handler-specific | Heartbeat. A request carrying `X-Hive-Activity-Update` is an activity-only update ([#15963](https://github.com/hivecommons/hive/issues/15963)): body `{"activity_update":{"hive_id","activity"}}`, the same per-hive bearer, accepted only for a hive already in the registry (`404` otherwise); it replaces the in-memory activity digest and nothing else, and the signed response carries `ok`, `activity_etag` and `activity_events_ack` (the highest activity event sequence number the hub holds for the hive, [#15964](https://github.com/hivecommons/hive/issues/15964); full heartbeat responses carry it too) | `pkg/hub/server.go:1754` | +| `POST` | `/api/heartbeat` | Hub handler-specific | Heartbeat. A request carrying `X-Hive-Activity-Update` is an activity-only update ([#15963](https://github.com/hivecommons/hive/issues/15963)): body `{"activity_update":{"hive_id","activity"}}`, the same per-hive bearer, accepted only for a hive already in the registry (`404` otherwise); it replaces the in-memory activity digest and nothing else, and the signed response carries `ok`, `activity_etag` and `activity_events_ack` (the highest activity event sequence number the hub holds for the hive, [#15964](https://github.com/hivecommons/hive/issues/15964); full heartbeat responses carry it too). A full heartbeat may carry `protocol: {version, features}`; while `HIVE_HUB_HEARTBEAT_PROTOCOL` is on the response answers with `protocol: {version, accepted, ignored, unsupported_version?}`, and a heartbeat without it is answered unchanged ([#19237](https://github.com/hivecommons/hive/issues/19237)) | `pkg/hub/server.go:1754` | | `POST` | `/api/task-status` | Hub handler-specific | Task Status | `pkg/hub/server.go:1755` | | `GET` | `/api/registry` | Hub handler-specific | Registry | `pkg/hub/server.go:1766` | | `GET` | `/api/hub/leaderboard` | Hub handler-specific | Leaderboard | `pkg/hub/server.go:1767` | diff --git a/src/docs/env-vars.md b/src/docs/env-vars.md index e8d92339f3..019ced95ed 100644 --- a/src/docs/env-vars.md +++ b/src/docs/env-vars.md @@ -127,6 +127,7 @@ behavior. [Maintenance limitations](#keeping-this-reference-current) still apply | `HIVE_HUB_SELFSERVICE_MAX_REPOS` | No | `20` | Maximum repos one self-service registration may list ([#18642](https://github.com/hivecommons/hive/issues/18642)). Each listed repo costs one read-only GitHub ownership check, so values above `500` are clamped to `500`; a non-numeric or non-positive value falls back to `20`. Advertised by `GET /api/hub/v1` as `limits.max_repos`. Over the cap, `POST /api/hub/selfservice/hives` answers `400`; `POST /api/hub/v1/registrations` answers `413` with `limit: max_repos`. Read per request. Only meaningful while `HIVE_HUB_SELFSERVICE_REGISTRATION` is on. | | `HIVE_HUB_SELFSERVICE_EXPIRY` | No | `24h` | How long a self-service hive may go without an accepted heartbeat before the expiry sweep revokes its key and removes its registry entry (counted from the last accepted heartbeat, or from registration while there has been none). Reported by `GET /api/hub/selfservice/status` as `expiry`. Go duration syntax. | | `HIVE_HUB_SELFSERVICE_SWEEP_INTERVAL` | No | `10m` | How often the self-service expiry sweep (`src/pkg/hub/selfservice_expiry.go`) runs. Each removal writes `audit: selfservice_hive_expired` (see [audit-log.md](audit-log.md)). Read at startup; restart after changing. Go duration syntax. | +| `HIVE_HUB_HEARTBEAT_PROTOCOL` | No | off | Heartbeat feature negotiation ([#19237](https://github.com/hivecommons/hive/issues/19237)). When on (`1/true/yes/on`), a heartbeat that carries `protocol: {version, features}` is answered with `protocol: {version, accepted, ignored}` (plus `unsupported_version` for a version below `1`). A heartbeat without `protocol` is answered exactly as before. Read per request. See [hub-deployment.md](hub-deployment.md#heartbeat-feature-negotiation). | | `HIVE_HUB_AGENT_RESTART_PROBLEM_THRESHOLD` | No | `5` | Hosted hub threshold for surfacing agent restart storms on `/fleet`. When an agent reports at least this many restarts in the last 24 hours (or since the hub-side reset marker), the hive gets a restart problem chip and drift signal. | | `HIVE_COVERAGE_BADGE_URL` | No | none (the flagship hivecommons/hive gist for org `hivecommons`/`kubestellar` only) | Where the ci-maintainer card's coverage percentage comes from. Either an `http(s)` URL to a shields-style JSON badge (`{"message":"85%"}`) or an SVG badge, or `repo:///` to read the badge file from the hive's primary repo through the GitHub App client — the form to use for a private repo, e.g. `repo://badges/coverage.svg` for octocov's default layout. Unset on a non-flagship hive, the card shows 0. | | `HIVE_BRANDING_CSS` | No | `/branding/custom.css`, where `` is the parent directory of the configured `data.agents_dir`, falling back to `/data` when that config field is empty — so the shipped default is `/data/branding/custom.css` | Absolute path of the operator override stylesheet the dashboard serves at `/branding/custom.css`. The index document links that URL unconditionally, so a missing file is the normal case and simply 404s. Read **per request**, so an edit takes effect on reload without a restart. The read is guarded (#5854): the file must be a regular file owned by the hive uid or root, not group- or world-writable, at most 128 KiB, and a symlink must resolve inside its own directory — anything else is refused with a logged warning, because whoever can write this path injects CSS into the operator's dashboard. See [Branding a hive, What the code enforces](branding.md#what-the-code-enforces). | diff --git a/src/docs/hub-deployment.md b/src/docs/hub-deployment.md index 2e6b774c98..1f78af3a14 100644 --- a/src/docs/hub-deployment.md +++ b/src/docs/hub-deployment.md @@ -217,6 +217,14 @@ The registry entry becomes a `self-hosted` hive in Active Hives and the fleet vi The route is part of the v1 registration protocol and follows the same switch as the rest of it, `HIVE_HUB_SELFSERVICE_REGISTRATION`; discovery (`GET /api/hub/v1`) lists it under `operations` with `if_match: "required"` and its fields under `patch_fields`, so a hub that does not offer it does not advertise it. The v6 `/api/hub/selfservice/*` routes are unchanged. +#### Heartbeat feature negotiation + +A spoke may send `protocol: {"version": 1, "features": [...]}` in its heartbeat ([#19237](https://github.com/hivecommons/hive/issues/19237)). With `HIVE_HUB_HEARTBEAT_PROTOCOL` on (`1/true/yes/on`, default off, read per request), the hub answers with `protocol: {"version", "accepted", "ignored"}`: the version it speaks for this beat, the requested features it honours, and the requested features it does not. The features a v1 hub accepts are `activity_digest`, `activity_events` and `host_aliases`, all of which it already serves to every spoke; negotiation changes nothing else in the response. + +- **No offer, or the flag off:** the response is exactly what it was before, with no `protocol` field. +- **Unknown version** (below `1`): the beat is still accepted, every requested feature is listed under `ignored`, and `unsupported_version` echoes what the spoke sent. A version above the hub's is answered with the hub's version, so a newer spoke can fall back to it. +- **Bounds:** at most 32 features are evaluated per beat. Names must be lowercase letters, digits, `_`, `-` or `.`, start with a letter and be at most 64 bytes; anything else is not echoed back. + #### Rotation The owner can rotate from the **Self-hosted hives** list or with `POST /api/hub/selfservice/hives/{id}/rotate`. The hub mints a new key and keeps the previous hash live for a 10 minute overlap so a running spoke can pick up the new value without a gap. After the overlap only the new key is accepted. Only the owner can rotate; a hub admin who does not own the hive gets `404`, the same answer as for a missing hive. diff --git a/src/pkg/hub/heartbeat.go b/src/pkg/hub/heartbeat.go index 11a07c9823..91696c7ca5 100644 --- a/src/pkg/hub/heartbeat.go +++ b/src/pkg/hub/heartbeat.go @@ -362,6 +362,10 @@ type HeartbeatPayload struct { // Absent from older or non-participating spokes; the hub re-sanitizes it // and keeps it in memory only (activityStore). Activity *hubactivity.Digest `json:"activity,omitempty"` + // Protocol is the optional feature negotiation offer (#19237). Absent + // from older spokes; answered only while HIVE_HUB_HEARTBEAT_PROTOCOL is + // on (heartbeat_protocol.go). + Protocol *HeartbeatProtocol `json:"protocol,omitempty"` } const ( @@ -493,6 +497,10 @@ type HeartbeatResponse struct { // converges its own Deployment, which is the only path on a push-reported // cluster. Decoded by spoke.HeartbeatResponse.HostAliases. HostAliases []ClusterHostAlias `json:"host_aliases,omitempty"` + // Protocol answers the payload's protocol offer with the accepted and + // ignored features (#19237). Nil (absent) when the spoke made no offer + // or HIVE_HUB_HEARTBEAT_PROTOCOL is off. + Protocol *HeartbeatProtocolAck `json:"protocol,omitempty"` } // HubBanner is a message from the hub admin displayed on spoke dashboards. diff --git a/src/pkg/hub/heartbeat_protocol.go b/src/pkg/hub/heartbeat_protocol.go new file mode 100644 index 0000000000..6a5a13842a --- /dev/null +++ b/src/pkg/hub/heartbeat_protocol.go @@ -0,0 +1,140 @@ +package hub + +// Heartbeat feature negotiation, hub registration protocol rollout step 5 +// (hivecommons/hive#18642, #19056, #19237). +// +// A spoke may send protocol: {version, features} in its heartbeat. While +// HIVE_HUB_HEARTBEAT_PROTOCOL is on, the hub answers with protocol: +// {version, accepted, ignored}: the protocol version it speaks for this beat, +// the requested features it honours, and the requested features it does not. +// +// Invariants: +// - Additive. A heartbeat without protocol, or any heartbeat while the flag +// is off, gets exactly the response it got before: no protocol field. +// - Informational only. Negotiation changes nothing else in the response; +// an accepted feature is one the hub already serves to every spoke. +// - A version the hub cannot speak (below 1) is answered, not refused: the +// beat is still accepted, every requested feature is ignored, and +// unsupported_version echoes what the spoke sent. +// - A newer version (above the hub's) is answered with the hub's version, so +// a newer spoke can fall back to it. +// - Only well-formed feature names are echoed back, at most +// heartbeatProtocolMaxFeatures of them, deduplicated and sorted. + +import ( + "os" + "sort" + "strings" +) + +const ( + heartbeatProtocolEnv = "HIVE_HUB_HEARTBEAT_PROTOCOL" + + // heartbeatProtocolVersion is the newest heartbeat protocol version this + // hub speaks. + heartbeatProtocolVersion = 1 + + // heartbeatProtocolMaxFeatures bounds how many requested features one + // beat may have evaluated and echoed back. + heartbeatProtocolMaxFeatures = 32 + // heartbeatProtocolMaxFeatureLen bounds one feature name. + heartbeatProtocolMaxFeatureLen = 64 + + HeartbeatFeatureActivityDigest = "activity_digest" + HeartbeatFeatureActivityEvents = "activity_events" + HeartbeatFeatureHostAliases = "host_aliases" +) + +// heartbeatProtocolFeatures are the features this hub accepts at +// heartbeatProtocolVersion. Each names behaviour the hub already serves. +var heartbeatProtocolFeatures = map[string]bool{ + HeartbeatFeatureActivityDigest: true, // activity digest and activity_etag (#15951) + HeartbeatFeatureActivityEvents: true, // activity events and activity_events_ack (#15964) + HeartbeatFeatureHostAliases: true, // host_aliases on every beat (#18637) +} + +// HeartbeatProtocol is the spoke's optional protocol offer in a heartbeat. +type HeartbeatProtocol struct { + Version int `json:"version"` + Features []string `json:"features,omitempty"` +} + +// HeartbeatProtocolAck is the hub's answer to a HeartbeatProtocol offer. +// Accepted and Ignored are always present (possibly empty) so a spoke can +// tell "nothing accepted" from an older hub that sent no answer at all. +type HeartbeatProtocolAck struct { + Version int `json:"version"` + Accepted []string `json:"accepted"` + Ignored []string `json:"ignored"` + UnsupportedVersion *int `json:"unsupported_version,omitempty"` +} + +// heartbeatProtocolEnabled reads the flag per request, like the other hub +// toggles, so it can be flipped without a restart. +func heartbeatProtocolEnabled() bool { + switch strings.ToLower(strings.TrimSpace(os.Getenv(heartbeatProtocolEnv))) { + case "1", "true", "yes", "on": + return true + } + return false +} + +// heartbeatProtocolAckFor returns the protocol answer for one heartbeat, or nil +// when the flag is off or the spoke made no offer (the response is then +// unchanged from before negotiation existed). +func heartbeatProtocolAckFor(offer *HeartbeatProtocol) *HeartbeatProtocolAck { + if offer == nil || !heartbeatProtocolEnabled() { + return nil + } + return negotiateHeartbeatProtocol(*offer) +} + +func negotiateHeartbeatProtocol(offer HeartbeatProtocol) *HeartbeatProtocolAck { + ack := &HeartbeatProtocolAck{ + Version: heartbeatProtocolVersion, + Accepted: []string{}, + Ignored: []string{}, + } + supported := offer.Version >= 1 + if !supported { + v := offer.Version + ack.UnsupportedVersion = &v + } + seen := map[string]bool{} + for _, raw := range offer.Features { + if len(seen) >= heartbeatProtocolMaxFeatures { + break + } + name := strings.TrimSpace(raw) + if !validHeartbeatFeatureName(name) || seen[name] { + continue + } + seen[name] = true + if supported && heartbeatProtocolFeatures[name] { + ack.Accepted = append(ack.Accepted, name) + } else { + ack.Ignored = append(ack.Ignored, name) + } + } + sort.Strings(ack.Accepted) + sort.Strings(ack.Ignored) + return ack +} + +// validHeartbeatFeatureName accepts lowercase letters, digits, '_', '-' and +// '.', starting with a letter, up to heartbeatProtocolMaxFeatureLen bytes. +func validHeartbeatFeatureName(name string) bool { + if name == "" || len(name) > heartbeatProtocolMaxFeatureLen { + return false + } + for i := 0; i < len(name); i++ { + c := name[i] + switch { + case c >= 'a' && c <= 'z': + case i > 0 && (c >= '0' && c <= '9' || c == '_' || c == '-' || c == '.'): + default: + return false + } + } + return true +} diff --git a/src/pkg/hub/heartbeat_protocol_test.go b/src/pkg/hub/heartbeat_protocol_test.go new file mode 100644 index 0000000000..d7860b4fce --- /dev/null +++ b/src/pkg/hub/heartbeat_protocol_test.go @@ -0,0 +1,158 @@ +package hub + +import ( + "encoding/json" + "net/http" + "net/http/httptest" + "reflect" + "strings" + "testing" +) + +func postProtocolHeartbeat(t *testing.T, s *HubServer, body string) map[string]json.RawMessage { + t.Helper() + req := httptest.NewRequest(http.MethodPost, "/api/heartbeat", strings.NewReader(body)) + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Authorization", heartbeatBearer(testHubSecret, "proto-hive")) + rec := httptest.NewRecorder() + s.handleHeartbeat(rec, req) + if rec.Code != http.StatusOK { + t.Fatalf("heartbeat: status %d body=%s", rec.Code, rec.Body.String()) + } + var raw map[string]json.RawMessage + if err := json.Unmarshal(rec.Body.Bytes(), &raw); err != nil { + t.Fatal(err) + } + return raw +} + +const protocolHeartbeatBase = `"hive_id":"proto-hive","org":"o","primary_repo":"r","repos":["r"]` + +func decodeProtocolAck(t *testing.T, raw map[string]json.RawMessage) HeartbeatProtocolAck { + t.Helper() + field, ok := raw["protocol"] + if !ok { + t.Fatalf("response has no protocol field: %v", raw) + } + var ack HeartbeatProtocolAck + if err := json.Unmarshal(field, &ack); err != nil { + t.Fatal(err) + } + return ack +} + +func TestNegotiateHeartbeatProtocolAcceptedAndIgnored(t *testing.T) { + ack := negotiateHeartbeatProtocol(HeartbeatProtocol{ + Version: 1, + Features: []string{"host_aliases", "future_thing", "activity_digest", " activity_digest ", "future_thing"}, + }) + if ack.Version != heartbeatProtocolVersion { + t.Fatalf("version = %d, want %d", ack.Version, heartbeatProtocolVersion) + } + if want := []string{"activity_digest", "host_aliases"}; !reflect.DeepEqual(ack.Accepted, want) { + t.Errorf("accepted = %v, want %v", ack.Accepted, want) + } + if want := []string{"future_thing"}; !reflect.DeepEqual(ack.Ignored, want) { + t.Errorf("ignored = %v, want %v", ack.Ignored, want) + } + if ack.UnsupportedVersion != nil { + t.Errorf("unsupported_version = %d, want absent", *ack.UnsupportedVersion) + } +} + +func TestNegotiateHeartbeatProtocolUnknownVersion(t *testing.T) { + for _, v := range []int{0, -3} { + ack := negotiateHeartbeatProtocol(HeartbeatProtocol{Version: v, Features: []string{"activity_digest", "x"}}) + if ack.UnsupportedVersion == nil || *ack.UnsupportedVersion != v { + t.Fatalf("version %d: unsupported_version = %v, want %d", v, ack.UnsupportedVersion, v) + } + if ack.Version != heartbeatProtocolVersion { + t.Errorf("version %d: answered version %d, want %d", v, ack.Version, heartbeatProtocolVersion) + } + if len(ack.Accepted) != 0 { + t.Errorf("version %d: accepted = %v, want none", v, ack.Accepted) + } + if want := []string{"activity_digest", "x"}; !reflect.DeepEqual(ack.Ignored, want) { + t.Errorf("version %d: ignored = %v, want %v", v, ack.Ignored, want) + } + } + + // A newer spoke is answered with the hub's version and its known features. + ack := negotiateHeartbeatProtocol(HeartbeatProtocol{Version: 7, Features: []string{"activity_events"}}) + if ack.Version != heartbeatProtocolVersion || ack.UnsupportedVersion != nil { + t.Fatalf("newer version: got %+v", ack) + } + if want := []string{"activity_events"}; !reflect.DeepEqual(ack.Accepted, want) { + t.Errorf("newer version: accepted = %v, want %v", ack.Accepted, want) + } +} + +func TestNegotiateHeartbeatProtocolBoundsAndMalformed(t *testing.T) { + features := []string{"", "Bad", "1abc", "has space", strings.Repeat("a", heartbeatProtocolMaxFeatureLen+1)} + for i := 0; i < heartbeatProtocolMaxFeatures+10; i++ { + features = append(features, "f_"+itoa3(i)) + } + ack := negotiateHeartbeatProtocol(HeartbeatProtocol{Version: 1, Features: features}) + if got := len(ack.Accepted) + len(ack.Ignored); got != heartbeatProtocolMaxFeatures { + t.Fatalf("echoed %d features, want %d", got, heartbeatProtocolMaxFeatures) + } + for _, name := range ack.Ignored { + if !validHeartbeatFeatureName(name) { + t.Errorf("malformed feature %q echoed back", name) + } + } + if empty := negotiateHeartbeatProtocol(HeartbeatProtocol{Version: 1}); empty.Accepted == nil || empty.Ignored == nil { + t.Errorf("no features: accepted and ignored must be empty lists, got %+v", empty) + } +} + +func itoa3(i int) string { + return string([]byte{byte('0' + i/100%10), byte('0' + i/10%10), byte('0' + i%10)}) +} + +func TestHeartbeatProtocolAbsentFieldUnchanged(t *testing.T) { + t.Setenv(heartbeatProtocolEnv, "true") + raw := postProtocolHeartbeat(t, newActivityHub(), "{"+protocolHeartbeatBase+"}") + if _, ok := raw["protocol"]; ok { + t.Fatalf("heartbeat without protocol got a protocol answer: %s", raw["protocol"]) + } +} + +func TestHeartbeatProtocolFlagOffIgnoresOffer(t *testing.T) { + t.Setenv(heartbeatProtocolEnv, "") + raw := postProtocolHeartbeat(t, newActivityHub(), + "{"+protocolHeartbeatBase+`,"protocol":{"version":1,"features":["activity_digest"]}}`) + if _, ok := raw["protocol"]; ok { + t.Fatalf("flag off: protocol answered: %s", raw["protocol"]) + } +} + +func TestHeartbeatProtocolHandlerAnswers(t *testing.T) { + t.Setenv(heartbeatProtocolEnv, "on") + raw := postProtocolHeartbeat(t, newActivityHub(), + "{"+protocolHeartbeatBase+`,"protocol":{"version":1,"features":["host_aliases","not_yet"]}}`) + ack := decodeProtocolAck(t, raw) + if want := []string{"host_aliases"}; !reflect.DeepEqual(ack.Accepted, want) { + t.Errorf("accepted = %v, want %v", ack.Accepted, want) + } + if want := []string{"not_yet"}; !reflect.DeepEqual(ack.Ignored, want) { + t.Errorf("ignored = %v, want %v", ack.Ignored, want) + } + var ok bool + if err := json.Unmarshal(raw["ok"], &ok); err != nil || !ok { + t.Errorf("ok = %s, want true", raw["ok"]) + } +} + +func TestHeartbeatProtocolHandlerUnknownVersionStillAccepted(t *testing.T) { + t.Setenv(heartbeatProtocolEnv, "1") + raw := postProtocolHeartbeat(t, newActivityHub(), + "{"+protocolHeartbeatBase+`,"protocol":{"version":0,"features":["activity_digest"]}}`) + ack := decodeProtocolAck(t, raw) + if ack.UnsupportedVersion == nil || *ack.UnsupportedVersion != 0 { + t.Fatalf("unsupported_version = %v, want 0", ack.UnsupportedVersion) + } + if len(ack.Accepted) != 0 || !reflect.DeepEqual(ack.Ignored, []string{"activity_digest"}) { + t.Errorf("got accepted=%v ignored=%v", ack.Accepted, ack.Ignored) + } +} diff --git a/src/pkg/hub/heartbeat_selfservice_fence.go b/src/pkg/hub/heartbeat_selfservice_fence.go index 428feed0d4..0a8e274f85 100644 --- a/src/pkg/hub/heartbeat_selfservice_fence.go +++ b/src/pkg/hub/heartbeat_selfservice_fence.go @@ -63,6 +63,7 @@ var heartbeatResponseFieldFence = map[string]heartbeatFieldClass{ "HubBanner": heartbeatFieldAllowed, // admin message, display only "ActivityETag": heartbeatFieldAllowed, "ActivityEventsAck": heartbeatFieldAllowed, + "Protocol": heartbeatFieldAllowed, // feature negotiation answer (#19237) // Response signature binding. "SigHiveID": heartbeatFieldAllowed, "SigSeq": heartbeatFieldAllowed, diff --git a/src/pkg/hub/server.go b/src/pkg/hub/server.go index efe2b886d8..9e125c9318 100644 --- a/src/pkg/hub/server.go +++ b/src/pkg/hub/server.go @@ -2895,6 +2895,7 @@ func (s *HubServer) handleHeartbeat(w http.ResponseWriter, r *http.Request) { resp.SelfExperimentFlag = s.selfExperimentFlagForHeartbeat(payload.HiveID, payload.SelfExperimentsOptIn) resp.ActivityETag = activityAck resp.ActivityEventsAck = s.activity.eventsAck(payload.HiveID) + resp.Protocol = heartbeatProtocolAckFor(payload.Protocol) if entry.IsPublic != payload.IsPublic { resp.IsPublic = &entry.IsPublic