Skip to content

✨ hub: heartbeat feature negotiation - #19239

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
scanner/fix-19237
Nov 19, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
scanner/fix-19237

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

A spoke has no way to learn which optional heartbeat features a hub honours except by inferring from the hub's version, which breaks as soon as hubs and spokes roll out independently. This is step 5 of the registration protocol rollout (#19056): the spoke may offer protocol: {version, features} and, with HIVE_HUB_HEARTBEAT_PROTOCOL on (default off, read per request), the hub answers protocol: {version, accepted, ignored}.

It is additive and informational: a heartbeat without protocol, or any heartbeat while the flag is off, gets exactly today's response, and an accepted feature is only one the hub already serves (activity_digest, activity_events, host_aliases). A version below 1 is still accepted, with every feature ignored and unsupported_version echoed; a newer version is answered with the hub's version so the spoke can fall back. Feature names are bounded (32 per beat, 64 bytes, restricted charset) and malformed ones are not echoed. The ack is classified as allowed in the self-service credential fence since it carries no secret or instruction.

Tests cover accepted vs ignored features, an absent field leaving the response unchanged, the flag off, unknown and newer versions, and bounds. The spoke-side sender is left for a follow-up so this PR stays hub-only.

Closes #19237

🤖 Generated with Claude Code

-- hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.328

A spoke may send protocol: {version, features} in its heartbeat; with
HIVE_HUB_HEARTBEAT_PROTOCOL on the hub answers with the accepted and
ignored features. Additive and default off: a heartbeat without protocol
is answered exactly as before.

Refs #19056
Closes #19237

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 19, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign danathar for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#19241 ✨ hub: remaining ownership proof methods with per-request scopes CONFLICT src/docs/api-reference/hub-server.md
src/docs/env-vars.md
src/docs/hub-deployment.md (conflict)
#19240 ✨ hub: registration key rotation with a grace window same files src/docs/api-reference/hub-server.md
src/docs/env-vars.md
src/docs/hub-deployment.md
#19206 ✨ ask: hive panel and rollout verification for optional Ask AI help same files src/docs/api-reference/hub-server.md
src/docs/env-vars.md
src/docs/hub-deployment.md
src/pkg/hub/server.go
#19204 ✨ ask: hive backend and hub relay for optional Ask AI help same files src/docs/api-reference/hub-server.md
src/docs/env-vars.md
src/docs/hub-deployment.md
src/pkg/hub/server.go
#19202 ✨ ask: hub panel for optional Ask AI help same files src/docs/api-reference/hub-server.md
src/docs/env-vars.md
src/docs/hub-deployment.md
src/pkg/hub/server.go
#19225 🐛 fix: pin egress dials to validated addresses in server-side fetchers same files src/pkg/hub/server.go

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Mutation testing

gremlins found 2 surviving mutant(s) in changed files: the code ran under tests, but changing it did not fail any test.

File Line Mutation
src/pkg/hub/heartbeat_protocol.go 127 CONDITIONALS_BOUNDARY
src/pkg/hub/heartbeat_protocol.go 130 CONDITIONALS_NEGATION

13 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the mutation/acknowledged label to accept this.

File Line Mutation
src/pkg/hub/heartbeat_protocol.go 133 CONDITIONALS_BOUNDARY
src/pkg/hub/heartbeat_protocol.go 133 CONDITIONALS_BOUNDARY
src/pkg/hub/heartbeat_protocol.go 133 CONDITIONALS_NEGATION
src/pkg/hub/heartbeat_protocol.go 133 CONDITIONALS_NEGATION
src/pkg/hub/heartbeat_protocol.go 134 CONDITIONALS_BOUNDARY
src/pkg/hub/heartbeat_protocol.go 134 CONDITIONALS_BOUNDARY
src/pkg/hub/heartbeat_protocol.go 134 CONDITIONALS_BOUNDARY
src/pkg/hub/heartbeat_protocol.go 134 CONDITIONALS_NEGATION
src/pkg/hub/heartbeat_protocol.go 134 CONDITIONALS_NEGATION
src/pkg/hub/heartbeat_protocol.go 134 CONDITIONALS_NEGATION
src/pkg/hub/heartbeat_protocol.go 134 CONDITIONALS_NEGATION
src/pkg/hub/heartbeat_protocol.go 134 CONDITIONALS_NEGATION
src/pkg/hub/heartbeat_protocol.go 134 CONDITIONALS_NEGATION

Verdict: lived (#17349).

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Decision needed: @clubanderson should confirm that adding Protocol to the heartbeat response fence as heartbeatFieldAllowed is acceptable, since that map is the self-service credential fence.

The negotiation code reads correct to me; the only open item is the fence allowlist entry, which is a trust-surface file a person should sign off.

Read heartbeat_protocol.go and the call site at server.go:2898. heartbeatProtocolAckFor returns nil when the flag is off or no offer is sent, so the response is unchanged in both cases. Feature names are validated (charset, 64 bytes) and capped at 32 echoed, so malformed input is dropped rather than echoed. The ack carries only a version and names from a fixed three-entry map, no secret or instruction, which matches the "allowed" classification at heartbeat_selfservice_fence.go:66. The tests cover accepted/ignored, version below 1, newer version, bounds and malformed names.

-- hive: agent=reviewer backend=claude model=claude-sonnet-5-5 claude=2.1.328

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 19, 2026
@hivecommons-hive hivecommons-hive Bot added stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 19, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 3c5b9d7 into v5 Nov 19, 2026
93 of 94 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-19237 branch November 19, 2026 09:17
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

Evidence bundle `#19239ad16170` sha256:bf1af503b65fafe41f3606492746b28b9f99e3bf53a76258ea39c3e5ccdae3ec — download from the dashboard or `hivectl review evidence #19239`.

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR conflicts-with-open-pr Open PR has a merge conflict with another open PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scanner] hub: heartbeat feature negotiation (protocol version and features)

0 participants