Skip to content

✨ feat(hub): surface "Pause hive" in the hub spoke dropdown menu - #15163

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
hive/adopt-15105
Oct 28, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
hive/adopt-15105

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Supersedes #15105 (adopted in place, re-homed because a hive commit on the contributor branch cannot carry a squash-safe sign-off; original commits by @Karibhou preserved).

Closes #15092

This branch is #15105's head 15cd4482b930 as pushed by @Karibhou (fork Karibhou/hive), unchanged. Last lane reason on the original: reviewer-verdict:changes_requested.

Hive fix agent: rebase this branch on v5, fix the failing checks / review asks, and push to THIS branch. Keep the original author's commits and their Signed-off-by; add your own sign-off on your commits. Do not open another PR.

Sign-off attribution: the original PR would squash the App's signed fixes as the contributor. This App-authored superseder keeps every original commit and sign-off unchanged and attributes the squash to the App instead. DCO and all merge gates still apply here.

Karibhou and others added 2 commits October 28, 2026 22:40
Add a "⏸ Pause hive" / "▶ Resume hive" item to the per-hive menu in the
hub's hive list (owner or hub admin). It drives the spoke's existing fleet
breaker — the same EngageBreaker/ReleaseBreaker path as the spoke's own
top-bar "running ⏸" button — so no new pause mechanism is introduced.

- hub: POST /api/saas/hives/{id}/breaker {"engaged": bool} queues the
  instruction durably on the SaaSHive record (owner-or-admin gate,
  audit log + activity timeline entry)
- hub: the next heartbeat response carries it once in
  HeartbeatResponse.Breaker and clears it (one-shot, like
  ResetAgentRestarts)
- spoke: new BreakerCallback applies engage/release via the agent
  runtime and writes the dashboard audit entry
- dashboard: menu label follows breaker state, derived from agents
  whose pausedTrigger is "fleet-breaker"
- tests for the handler's authz/validation/queueing, one-shot delivery,
  and the boot callback driving the real breaker
- api-reference row for the new route (citations re-anchored)

Hive-Run: #15092
Hive-Plan: #15092 proposed solution
Hive-Spec: #15092#proposed-solution
Co-authored-by: kanrenibm <91967876+kanrenibm@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HRH6kkwbjSjorhcbXnoxg3
Signed-off-by: Karibhou <157208370+Karibhou@users.noreply.github.com>
…items

Review fix for the TestStyleRatchet failure: the new Pause/Resume menu
item pushed hub static pages to 942 inline style= attributes (baseline
941). Replace the ad-hoc `mi` inline-style string with a `.hive-menu-item`
class built from design tokens (--sp-3/--sp-5, --text, --fs-sm) and apply
it to every item in the spoke dropdown, including the new one. That drops
the surface to 930 style= attributes with no change to the raw color,
font-size, padding or border-radius counters, so the baseline is lowered
to 930 rather than raised.

Hive-Fix-Attempt: 2/6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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 Oct 28, 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 nicholasjackson 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 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
#15157 ✨ Conflict-aware merge train in the automerge lanes same files src/cmd/hive/main.go
#15122 🐛 Write-back containment: per-kind gate for every unsolicited GitHub write, with backfill guard same files src/cmd/hive/main.go
src/docs/api-reference.md
#15168 🐛 fix(governor): bound how long review-fix kicks may defer an agent's backlog kick same files src/cmd/hive/main.go
#14807 ✨ dashboard: stream Job pod logs in the terminal pane for sandbox.runtime: job agents same files src/docs/api-reference.md
#15085 ✨ Activity Monitor: Adopt now and Reroute to another clanker for PRs waiting on a contributor's clanker same files src/cmd/hive/main.go
#15150 🐛 Activity Monitor: persist the merged count in a server ledger, pin the Merged chip, banner and bee flight on merge same files src/docs/api-reference.md
#15134 🐛 Delegated decision on a capability gap: model the blocker, stop the un-park/re-park loop, name the missing App permission same files src/docs/api-reference.md
#15105 ✨ feat(hub): surface "Pause hive" in the hub spoke dropdown menu same files changelog.d/added-15092-hub-pause-hive.md
src/cmd/hive/boot_heartbeat_deps_test.go
src/cmd/hive/main.go
src/docs/api-reference.md
src/pkg/dashboard/webstatic/style_ratchet_test.go
src/pkg/hub/assets/dashboard.html
src/pkg/hub/heartbeat.go
src/pkg/hub/saas.go
src/pkg/hub/saas_provision.go
src/pkg/hub/server.go
src/pkg/hub/spoke/heartbeat.go
src/pkg/hub/spoke_breaker.go
src/pkg/hub/spoke_breaker_test.go
#15149 ✨ feat(automerge): pick one merge-train front per group of file-overlapping approved PRs same files src/cmd/hive/main.go

@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.

Read the tree at 15cd4482 (hub, spoke, cmd/hive), not just the diff. The change does what the body says and looks correct to me.

What I verified

  • src/pkg/hub/spoke_breaker.go:23-45 — handleSpokeBreaker is behind requireAuth (saas.go:429) plus userIsHiveOwner || isHubAdmin, matching the owner gate on the spoke's own /api/breaker/* (src/pkg/dashboard/api_breaker.go:30). Body is MaxBytesReader(1024) and Engaged *bool rejects a missing key.
  • spoke_breaker.go:66-89 — pendingBreakerForHeartbeat is the same load → clear → save → return one-shot as pendingAgentRestartResetsForHeartbeat (saas.go:552-573), and handleHeartbeat calls it right after that function (server.go:3344). Failing to clear withholds rather than redelivers — the right default.
  • src/pkg/hub/spoke/heartbeat.go:1474 and src/cmd/hive/main.go:5704-5716 — the spoke calls agentMgr.EngageBreaker() / ReleaseBreaker(b.ctx), the same methods handleBreakerEngage/Release call, and writes the same breaker-engage/breaker-release audit actions. Unknown values are logged and ignored.
  • src/pkg/hub/assets/dashboard.html — breakerOn keys off pausedTrigger === 'fleet-breaker', which is crux.BreakerTrigger (src/crux/pause.go:12) and is already carried on hub agent rows (src/pkg/hub/heartbeat.go:21). Confirm/toast are the in-app hiveConfirm/hiveToast, no native dialogs.
  • Tests cover authz + queue + one-shot delivery (spoke_breaker_test.go) and the spoke callback (boot_heartbeat_deps_test.go:255). Changelog fragment name and api-reference.md row are present; both commits are signed off.

One low-severity note, not a blocker

The dashboard path calls s.refreshAndPersist() right after engaging (api_breaker.go:40), so an engaged breaker survives a crash. The heartbeat callback at main.go:5706-5713 does not, and relies on the run loop's next deps.persist(b) tick (main.go:6331). A crash in that window comes back with agents running. This matches the sibling AgentRestartResetCallback in the same block, so it is consistent with the file — but if you want parity with the ⏸ button, a persist hook after the engage/release would close it. Suggestion only.

Note for maintainers: #15105 is this exact head (15cd4482) on the contributor fork; this PR is the hive's adopt-in-place of it, so one review covers both.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@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.

Read the diff against the tree at 15cd448 (cloned, go build ./cmd/hive/ ./pkg/hub/... passes). The change does what it says and reuses existing machinery correctly; I found no defects. Notes for whoever merges:

Verified

  • Hub gate: pkg/hub/spoke_breaker.go:31-34 — userIsHiveOwner || isHubAdmin. The spoke's own /api/breaker/{engage,release} is requireOwnerRole (pkg/dashboard/api_breaker.go:30), so the hub side is the same gate plus hub admin, as the body states. Body is capped at 1 KiB and engaged is a *bool, so a missing key is a 400 rather than a silent release.
  • One-shot delivery: pendingBreakerForHeartbeat (spoke_breaker.go:68-89) is the same load → clear → save → return shape as pendingAgentRestartResetsForHeartbeat (pkg/hub/saas.go:552-574); the unlocked read-modify-write on meta.json is the pre-existing pattern for every queued-on-heartbeat field, not something this PR introduces. Read in handleHeartbeat after verifyHeartbeatBearer (server.go:1893), so only the authenticated spoke consumes it.
  • Spoke side: BreakerCallback type-switch and dispatch in pkg/hub/spoke/heartbeat.go mirror AgentRestartResetCallback; cmd/hive/main.go:5704-5717 calls agentMgr.EngageBreaker() / ReleaseBreaker(ctx) — identical calls to the dashboard handlers — and writes the same breaker-engage/breaker-release audit actions.
  • UI: AgentSummary carries paused + pausedTrigger (pkg/hub/heartbeat.go:19-20), and crux.BreakerTrigger == "fleet-breaker" (crux/pause.go:12), so the Pause/Resume label flips on real state. hiveConfirm escapes the message when rawHTML is unset (dashboard.html:3140), so the hive name is safe in the dialog. No native dialogs.
  • Docs: api-reference.md row added and citations re-anchored; changelog fragment follows added-<issue>-<slug>.md.

One behavioural note, not a defect — when two instances report as the same hive (the case Restart Spoke exists for), the one-shot is consumed by whichever instance beats first; the other never hears it. That is the same contract as ResetAgentRestarts, and the breaker is idempotent so a second click fixes it, but it differs from RestartSpoke, which uses a time window so every instance acts. Worth a line in the hub-side comment if that case matters to operators.

Looks correct to me. CI was still running (build linux/arm64, tide) when I read it.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 03d71b2 into v5 Oct 28, 2026
148 of 155 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the hive/adopt-15105 branch October 28, 2026 23:44
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#1516315cd448` sha256:2dc4f891cc3474ff697911f0071f1337599792f5a6862c2f33a58e97dfcda369 — download from the dashboard or `hivectl review evidence #15163`.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@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/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 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 copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. hacktoberfest hacktoberfest-accepted size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ feature: (hub): surface "Pause hive" action in the hub spoke dropdown menu

2 participants