Repository navigation
✨ feat(adminmcp): change agent cadences and write-back kinds through preview and confirm - #17555
Conversation
…eview and confirm
Two dashboard settings had no admin MCP operation, so an operator running
the hive from an assistant could not change them: an agent's per-mode
cadences and the write-back gate's per-kind overrides.
agent.cadences wraps PUT /api/config/agent/{name}/cadences. It takes a
duration or pause per governor mode, sends only the modes that change,
refuses a mode the hive does not configure (the endpoint would skip it),
says each mode becomes operator-owned, and discloses a shorter cadence as
more spend.
writeback.kind_policy wraps PUT /api/config/governor/features. That
endpoint replaces the whole writebackKinds map, so the op reads the current
overrides and sends them all with the change merged in; null removes one
field or one kind's override, unknown kinds and fields are refused. The
preview discloses a kind that would write at a lower level, without the
opt-in label, or on items the hive did not author.
Both record a state fingerprint so write_confirm refuses a stale preview.
No existing endpoint or operation changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Signed-off-by: Danathar <Danathar@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 both ops against the endpoints they wrap at 8b3acdd; this looks correct to me.
What I verified in the tree (not from the description):
- Features whole-map replace is handled.
api_governor_features_platform.go:265-287only touchesc.Writeback.Kindswhenb.WritebackKinds != nil, and every other field in that body struct is a pointer, so a body carrying onlywritebackKindsleaves the rest of Features untouched. Sending the full merged map (tools_cadence_writeback_ops.go:712-716) is the right shape; an empty{}maps toc.Writeback.Kinds = nilon the server side, matching the "last override removed" case. - Cadence body shape matches the handler.
api_agent_config.go:995-1023accepts{mode: seconds}, maps<=0topause, skips unknown modes silently and claimscadence_owners. The op refuses an unconfigured mode before the PUT (tools_cadence_writeback_ops.go:265-267), which is the right call given the handler's silent skip.agentCadenceSecondsLabelmirrorsformatCadenceDuration, soCadence.Validate()runs on the same string the server will store. - Reach calculation matches the gate.
writebackKindReach(:548-564) agrees withGate.Allowedatwriteback/gate.go:491-509: no label →MinLevel; label required →MinLevelwith label,UnlabeledMinLevelwithout when>0, never otherwise;own_only→ never.Config.Policy(writeback/config.go:185-213) is what both sides use. settings_read section agentreturnscadencesas seconds /0/ schedule string andmodelskeyed per configured mode (api_agent_config.go:99-116, 211-212), which is whatreadAgentCadenceCelland the configured-mode check consume.numberArgrejects negatives and returnsint, so thev.(int)assertions inapplyWritebackKindChangecannot panic.
One optional note, not a defect: writebackKindState fingerprints only Kinds; requireLabels/optInLabels are unexported, so a writebackRequireLabels flip between preview and confirm would not trip ErrConfirmationStale. The write itself would still be correct (it only sends writebackKinds), only the widening text shown at preview could be stale. Fine to leave as is.
CI was still running when I read this; I did not wait on it.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Read the two new ops against the endpoints they wrap at What I verified in the tree (not from the description):
Not a defect, one note for whoever merges: the body cites stage 080-awaiting-merge-admission → 072-returned-to-contributor: fork-not-editable Evidence bundle `#17555beb7a83` sha256:b9be5d6f42f947f05a11ea1b369345cce95e184930c95dc7195e80466a582213 — download from the dashboard or `hivectl review evidence #17555`. |
|
@Danathar this PR is back in your court ( Review asks:
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. Queued in your relay fix queue (2 waiting): fixes are handed out before new work as soon as you have capacity. |
…abeled items at L6 With min_level 6 and unlabeled_min_level 6 the labelled and unlabelled reach are the same, and writebackKindPolicyLabel words that as 'L6, any item'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
There was a problem hiding this comment.
Read the two new ops against the v6 tree (merge-base e86dd26) and the endpoints they wrap. Looks correct to me; nothing blocking.
What I verified:
- Cadences endpoint contract.
pkg/dashboard/api_agent_config.go:978-1026takesmap[mode]seconds, treats<= 0aspause,continues on a mode not inGovernor.Modes, and callsClaimCadenceOwnershipper mode. The op's "refuse a mode this hive lacks" check (tools_cadence_writeback_ops.go:261) is the right guard for that silent skip, andreadAgentCadenceStatederives configured modes frommodels, which the GET builds with one key per mode (api_agent_config.go:112-115). Cadence value shapes (int seconds /0/Cadencestring or object,api_agent_config.go:99-110) matchreadAgentCadenceCell. - Features endpoint is partial-update, full-map replace.
api_governor_features_platform.go:265-289applies only non-nil fields, but whenwritebackKindsis present it rebuildsc.Writeback.Kindsfrom scratch (and sets itnilfor an empty map). So sending only{"writebackKinds": <merged map>}is the correct way to change one kind without disturbing other feature settings, and an empty map correctly clears the last override. - Type safety of the
v.(int)casts inapplyWritebackKindChange:numberArg(tools_github_cap_ops.go:276) returns a non-negativeint, so the0..MaxACMMLevelbound is fully enforced before the cast. - Effective-policy preview uses
writeback.Config.Policy(pkg/writeback/config.go:185) with the currentwritebackRequireLabels, which is what the gate itself resolves; the governor read exposeswritebackKinds/writebackRequireLabels/writebackOptInLabels(api_governor_features_platform.go:417-423). - Label formatting (
agentCadenceSecondsLabel) mirrorsformatCadenceDuration(status_builder.go:2072), so the fingerprinted "before" label and the stored value agree.
The dashboard test goes through the real handlers with owner vs read-write roles and checks the untouched modes keep both cadence and ownership, which is the regression I'd have worried about.
Refs (not Closes) for #17543/#17544/#17547 reads right: those issues describe separate changes; this PR only adds the knobs they need.
Checks were still running when I read this; CI remains the verdict on the tests.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Keep both admin-mcp design notes: sentinel.settings' repo_sensitive_paths and hivecommons#17555's agent.cadences / writeback.kind_policy bullet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
…rride field (#17559) * 🐛 fix(dashboard): the write-back kind table edits and keeps every override field Settings → Features' write-back per-kind matrix edited only min_level and require_label, but PUT /api/config/governor/features replaces the whole writeback.kinds map and markDirtyWritebackKinds rebuilt it from those two cells. Any edit there dropped every kind's unlabeled_min_level and own_only (and an own-only kind's min_level, whose cell is disabled), undoing what hive.yaml or the admin MCP writeback.kind_policy operation had set. - The table gains "Without label" (unlabeled_min_level: default, 0 (off), L1-L6) and "Hive-authored only" (own_only: default/yes/no) columns, each with a settingHelpMark; the matrix's one yamlHint names all four fields. - Each row carries the override it was rendered from (data-wb-override); the save handler starts from it and only a live, enabled control changes its field, so nothing the operator did not touch is dropped. - writeback.kind_policy's preview no longer warns that a dashboard save drops those fields; its test now asserts the warning is gone. - The two fields leave the settings parity allowlist, since the Settings UI now references them. No endpoint change: the GET already returns every override field. Refs #17555 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com> * 🐛 test(dashboard): parse the write-back level input quote-aware The input's data-setting-key value contains "<key>", so the fixture's [^>]* tag match ended at that '>' and never saw value="3" or disabled on the own-only row; a browser parses the quoted attribute fine. The handler was right; the fixture misread the row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com> --------- Signed-off-by: Danathar <Danathar@users.noreply.github.com> Co-authored-by: Danathar <Danathar@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ge (#17560) The admin MCP could change these settings, but the dashboard could not show or change them: - Settings → Features → Auto-merge → Per-repository merge policy gets "Merge with no CI" (auto_merge.no_ci_ok) and, only while it is set, the deprecated auto_merge.allow_unprotected_base list, marked as having no effect so an owner can clear it. Both stage the full selection only when changed; an untouched save still omits them, so the server keeps them. A bare repository name from hive.yaml now selects that repository. - Settings → Features → Let hive decide gets a per-repository on / off / hive-wide table (decisions.delegate.repos) and an Effect timeout (decisions.delegate.effect_timeout). The PUT replaces the repos map whole, so a table edit sends every saved override plus the edits. The timeout is checked like the server checks it before sending. - Agent → Operating Mode lists NO_GITHUB (a legacy alias for ADVISORY) for an agent that has it, instead of showing "use level default". - Fix the adminmcp comment that said decisions.delegate had no dashboard write endpoint. No endpoint or server behaviour changes. static/index.html regenerated by the manifest concatenation (cmp-identical). Refs #17555 #17556 Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com> Co-authored-by: Danathar <Danathar@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Summary: An owner who runs the hive from an assistant through admin MCP can now change two settings that only the dashboard could change before: an agent's cadence in each governor mode, and the write-back gate's per-kind overrides. Both go through preview and confirm and use the same endpoints the dashboard saves with. Nothing that exists today changes: these are two new operations.
What went wrong
On the knuckle hive (projectbluefin, build e86dd26) the operator needed two changes and neither was reachable through admin MCP:
governor.modes.{surge,busy,quiet,idle}.scanner: 4h, operator-owned). On 2026-11-10 that left the scanner idle for about 7 hours with actionable work queued. The L6 default is 1h. There is no cadence operation, andgovernor.feature_settingstakes a fixed field list.base_refreshkind, which by default reaches only PRs carrying thehive-reviewopt-in label.writeback.kinds.base_refresh.unlabeled_min_level: 6lets it reach contributor PRs at L6, but the write-back kinds are not ingovernor.feature_settingseither.What changes
agent.cadenceswrapsPUT /api/config/agent/{name}/cadences. Arguments:agentandmodes(surge,busy,quiet,idle, each a duration such as1h, orpause). It sends only the modes that change. A mode the hive does not configure is refused, because the endpoint would silently skip it. The preview says each mode it sets becomes operator-owned (governor.cadence_owners, which the endpoint claims), so a later level change or pack apply no longer resets it. A shorter cadence is named as widening: "scanner runs more often in surge: more spend".writeback.kind_policywrapsPUT /api/config/governor/features. Arguments:kinds, mapping a kind to{min_level, require_label, unlabeled_min_level, own_only}.nulldrops one field, and a kind set tonullloses its override. Unknown kinds (checked against the writeback kind registry) and unknown fields are refused, and levels must be 0 to 6, as the endpoint checks.writebackKindsmap it is sent (api_governor_features_platform.go,c.Writeback.Kinds = kinds). So the op reads the current overrides and sends all of them with the change merged in. knuckle's existingstage_label: {require_label: false}survives abase_refreshchange.writeback.Config.Policy) before and after. It names any kind that would write at a lower level, without the opt-in label, or on items the hive did not author.write_confirmrefuses withErrConfirmationStaleif the cadences or overrides changed after the preview (the ✨ feat(adminmcp): change merge settings through preview and confirm #17486 hook). Neither op merges, approves, labels or kicks anything. Owner-only is the endpoints' own check.The optional third item, per-repository
repo_policiesoverrides forsentinel_sensitive_pathsandworkflow_fence_scope(#17547), is not included. No dashboard endpoint writesproject.repo_policiesfor those fields (they are set in hive.yaml and only read back), so it would need a new endpoint. That follow-up is on hold.One thing found along the way and left alone: the dashboard's write-back kind table edits only
min_levelandrequire_label, and saving an edit there rebuilds every kind's override from the table, which dropsunlabeled_min_levelandown_only. Thewriteback.kind_policypreview warns about this when it writes either field. Fixing the table is a separate change.Files
src/pkg/adminmcp/tools_cadence_writeback_ops.go: the two operations (new)src/pkg/adminmcp/tools_agent_ops.go: registers them (one line)src/pkg/adminmcp/tools_cadence_writeback_ops_test.go,src/pkg/dashboard/admin_mcp_cadence_writeback_test.go: testssrc/docs/admin-mcp.md(op table and a Writes section),src/docs/design/admin-mcp.md,src/docs/operator-reference/sweeps-and-operations.md,src/docs/api-reference.md,src/docs/api-reference/configuration.mdchangelog.d/added-adminmcp-cadences-writeback-kinds.mdTests
None were run locally; per AGENTS.md, CI is the verdict (
gofmt -lis clean). On the v6 tip every new test fails, because neither operation is registered andwrite_previewanswers "unknown write operation".TestAdminMCPCadenceAndWritebackKindOpsAreOwnerOnlyAndMerge(dashboard, end to end through the real endpoints): a read-write member's confirm gets "owner access required" and changes nothing. The owner's confirm sets surge to 1h and makes it operator-owned, while busy, quiet and idle keep 4h and their ownership.stage_label's override survives thebase_refreshchange.TestAgentCadencesOpRejectsUnknownFields,TestWritebackKindPolicyOpRejectsUnknownFields: refuse unknown fields, modes and kinds, bad durations and levels, modes the hive lacks, and no-op changes.TestAgentCadencesOpKeepsUntouchedModes,TestWritebackKindPolicyOpKeepsUntouchedKinds: only the changed modes are sent, and every other override is sent unchanged. This includes knuckle's exact settings, null removing one field or one kind, and an empty map when the last override goes.TestAgentCadencesOpFlagsWidening,TestWritebackKindPolicyOpFlagsWidening: a shorter or new cadence and a lower, unlabeled or no-longer-own-only kind are named as widening. Longer, paused or stricter changes are not.TestAgentCadencesOpRefusesStalePreview,TestWritebackKindPolicyOpRefusesStalePreview: a change made between preview and confirm refuses the confirm and writes nothing.TestAgentCadencesOpRefusesNonOwner,TestWritebackKindPolicyOpRefusesNonOwner: a refused read mints no confirmation, and a 403 from the endpoint writes nothing.Refs #17544, #17543, #17547
🤖 Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1