Repository navigation
Conversation
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: hivecommons#15092
Hive-Plan: hivecommons#15092 proposed solution
Hive-Spec: hivecommons#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>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
Read the tree at 65a353c, not just the diff. The design is sound; one check failure is caused by this diff and blocks it.
Blocking — TestStyleRatchet (test rest 3/4, coverage): pkg/dashboard/webstatic/style_ratchet_test.go:88 reports hub static pages has 942 style= attributes, above the baseline of 941. The extra one is the new menu item at src/pkg/hub/assets/dashboard.html:8717 (... style="' + mi + '">). The neighbouring items use the same mi string, so the ratchet is about the count, not the content: either give the dropdown items a class and drop the inline style= on this one (or on one existing item in the same menu), or convert one existing inline style elsewhere to tokens, per the test's message. The baseline must not be raised.
Verified correct (no action needed):
- One-shot delivery holds:
pendingBreakerForHeartbeat(spoke_breaker.go:67-89) load→clear→save is the same idiom aspendingAgentRestartResetsForHeartbeat(saas.go:552-574), andhandleHeartbeatdoes not re-save thesaasHiveit loaded atserver.go:2941after line 3344, so the cleared record is not resurrected.resp.Breakeris set beforesignHeartbeatResponse(server.go:3344-3346), so it rides inside the signed response. - The spoke applies it only via the existing fleet-breaker path:
main.gocallback callsagentMgr.EngageBreaker()/ReleaseBreaker(ctx)(crux/api/client/client.go:514, 520), and the UI's state read (a.pausedTrigger === 'fleet-breaker') matchescrux/pause.go:12BreakerTrigger = "fleet-breaker", which the hub already serialises aspausedTrigger(hub/heartbeat.go:21). - Authorisation: owner-or-hub-admin at
spoke_breaker.go:31. Note this is wider thanhandleRestartSpoke(admin-only,spoke_restart.go:155) but matches the spoke's own/api/breaker/*owner gate and the action is reversible; I think that is the right call, flagging it only so a maintainer sees it was deliberate. - The confirmation uses
hiveConfirm(dashboard.html:3131), not a native dialog.
Could not run tests here (go test is blocked on agent hosts); the above is from reading the tree and the CI log.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
@Karibhou this PR is back in your court ( Failing checks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Your relay session received this as a |
|
@Karibhou the hive has adopted this PR ( |
|
CI: 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
…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>
|
@Karibhou the hive has adopted this PR ( |
Summary
Adds a ⏸ Pause hive / ▶ Resume hive item to the per-hive dropdown in the hub's hive list (next to Contribute, API Docs, Permissions, Activity Timeline…), so an operator can pause a spoke without opening its dashboard.
No new pause mechanism: it drives the spoke's existing fleet breaker — the same
EngageBreaker/ReleaseBreakerpath as the spoke's own top-bar "running ⏸" button (/api/breaker/{engage,release}).How it works
POST /api/saas/hives/{id}/breakerwith{"engaged": true|false}. Owner-or-hub-admin (mirrors the spoke endpoints' owner gate). Queues the instruction durably on theSaaSHiverecord (pending_breaker,pending_breaker_by), logs an audit line and an Activity Timeline entry. A newer click replaces an undelivered older one.HeartbeatResponse.Breaker("engage"/"release") and the record is cleared (one-shot, likeResetAgentRestarts). Heartbeat is the only channel that reaches every spoke, including clusters the hub cannot touch. One-shot rather than desired-state so a later release done on the spoke itself is never re-engaged by the hub.spoke.BreakerCallbackwired inbootHeartbeatWith: engages/releases the breaker and writes the samebreaker-engage/breaker-releasedashboard audit entries; unknown values are logged and ignored. The run loop's regular persist makes the state durable.pausedTrigger === 'fleet-breaker'(already in heartbeats). Confirmation dialog explains it applies on the next heartbeat (≤ ~2 min).Tests
pkg/hub/spoke_breaker_test.go: 404 / 403 non-owner / 400 bad bodies / owner queues engage, last click wins; one-shot delivery, unknown hive, invalid stored action never delivered.cmd/hive/boot_heartbeat_deps_test.go: callback is registered (14 callbacks) and drives the real breaker engage → ignore bogus → release.Other
src/docs/api-reference.mdrow for the new route; citations re-anchored withcheck-api-reference-citations.sh --fix(route insertion shiftedsaas.golines).gofmtnormalized theHeartbeatResponsestruct alignment inpkg/hub/heartbeat.go(was already misaligned onv5).changelog.d/added-15092-hub-pause-hive.md.Note: the issue lists v6 as target; this PR targets
v5as assigned (purely additive change).Closes #15092
🤖 Generated with Claude Code
https://claude.ai/code/session_01HRH6kkwbjSjorhcbXnoxg3
— hive: backend=claude model=claude-opus-5-5