From 4f6acfc97b09621e905eb3bbdd335ed13ee9a2df Mon Sep 17 00:00:00 2001
From: Danathar <6772335+Danathar@users.noreply.github.com>
Date: Wed, 18 Nov 2026 06:44:22 -0500
Subject: [PATCH] feat(dashboard): Settings control and MCP write for
governor.ci workflow approval
governor.ci.auto_approve_workflows and auto_approve_workflow_actors were
yaml-only (settings_parity_allowlist.txt), so a hosted hive could not, for
example, trust github-actions[bot] for its repositories' own workflow-opened
PRs without a config-file change.
- Features PUT/GET: ciAutoApproveWorkflows and ciAutoApproveWorkflowActors
(comma-separated; blank = default, "none" = explicit empty list).
- Settings -> Features -> Auto-merge -> Workflow approval: a toggle and a
text field with YAML hints and help, plus a search entry.
- Admin MCP governor.feature_settings accepts both and discloses turning
approval on and changing the trusted actors.
- Both keys leave the parity allowlist.
Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
---
...dded-workflow-approval-settings-control.md | 1 +
.../operator-reference/runtime-and-quota.md | 5 ++
src/pkg/adminmcp/adminmcp_test.go | 22 ++++++
src/pkg/adminmcp/tools_fleet_ops.go | 13 +++-
.../dashboard/api_governor_features_ops.go | 48 +++++++++++-
.../governor_settings_parity_test.go | 74 +++++++++++++++++++
.../dashboard/settings_parity_allowlist.txt | 2 -
.../static-src/js/config-features.js | 12 +++
.../dashboard/static-src/js/config-state.js | 1 +
src/pkg/dashboard/static/index.html | 13 ++++
10 files changed, 186 insertions(+), 5 deletions(-)
create mode 100644 changelog.d/added-workflow-approval-settings-control.md
diff --git a/changelog.d/added-workflow-approval-settings-control.md b/changelog.d/added-workflow-approval-settings-control.md
new file mode 100644
index 0000000000..e93d5c1e97
--- /dev/null
+++ b/changelog.d/added-workflow-approval-settings-control.md
@@ -0,0 +1 @@
+- `governor.ci.auto_approve_workflows` and `governor.ci.auto_approve_workflow_actors` now have a Settings control (Features → Auto-merge → Workflow approval) and an admin-MCP write (`governor.feature_settings`: `ciAutoApproveWorkflows`, `ciAutoApproveWorkflowActors`), so a hosted hive can trust another bot such as `github-actions[bot]` without editing hive.yaml.
diff --git a/src/docs/operator-reference/runtime-and-quota.md b/src/docs/operator-reference/runtime-and-quota.md
index 90a033161b..d5d3c8f309 100644
--- a/src/docs/operator-reference/runtime-and-quota.md
+++ b/src/docs/operator-reference/runtime-and-quota.md
@@ -676,6 +676,11 @@ v5 and v6 spokes) tracking one repo all stay on webhook mode.
gated run on the head regardless of who pushed it — including commits a
fork collaborator pushed to the author's branch — so keep the actor list
to bot logins unless that is acceptable for a human login you add.
+ Both keys are on Settings → Features → Auto-merge → **Workflow approval**
+ (the actor list as comma-separated logins; blank restores the default,
+ `none` stores `[]`), and the admin MCP `governor.feature_settings`
+ operation writes them as `ciAutoApproveWorkflows` and
+ `ciAutoApproveWorkflowActors`; the sweep reads them every cycle.
Trusting the App as triggering actor
covers heads the App pushed itself (its own PRs, rebases, review-fix
commits), and only when the run's head repository is the PR's base
diff --git a/src/pkg/adminmcp/adminmcp_test.go b/src/pkg/adminmcp/adminmcp_test.go
index 70ca24d706..5783609604 100644
--- a/src/pkg/adminmcp/adminmcp_test.go
+++ b/src/pkg/adminmcp/adminmcp_test.go
@@ -1067,3 +1067,25 @@ func mustJSON(t *testing.T, v any) string {
}
return string(b)
}
+
+// governor.ci's workflow-approval keys are writable through
+// governor.feature_settings, and the preview discloses turning approval on
+// and changing who is trusted.
+func TestFeatureSettingsWorkflowApproval(t *testing.T) {
+ preview, err := featureSettingsOp{}.Preview(context.Background(), map[string]any{"ciAutoApproveWorkflows": true, "ciAutoApproveWorkflowActors": "dependabot[bot], github-actions[bot]"})
+ if err != nil {
+ t.Fatal(err)
+ }
+ body := preview.Request.Body.(map[string]any)
+ if body["ciAutoApproveWorkflows"] != true || body["ciAutoApproveWorkflowActors"] != "dependabot[bot], github-actions[bot]" {
+ t.Fatalf("body = %#v", body)
+ }
+ for _, want := range []string{"ciAutoApproveWorkflows", "ciAutoApproveWorkflowActors"} {
+ if !strings.Contains(preview.WideningDisclosure, want) {
+ t.Fatalf("disclosure %q does not name %s", preview.WideningDisclosure, want)
+ }
+ }
+ if p, err := (featureSettingsOp{}).Preview(context.Background(), map[string]any{"ciAutoApproveWorkflows": false, "ciAutoApproveWorkflowActors": "none"}); err != nil || strings.Contains(p.WideningDisclosure, "ciAutoApprove") {
+ t.Fatalf("turning approval off and trusting no one is no widening: %q, %v", p.WideningDisclosure, err)
+ }
+}
diff --git a/src/pkg/adminmcp/tools_fleet_ops.go b/src/pkg/adminmcp/tools_fleet_ops.go
index 2ef4fb7a02..bbcb644a41 100644
--- a/src/pkg/adminmcp/tools_fleet_ops.go
+++ b/src/pkg/adminmcp/tools_fleet_ops.go
@@ -150,7 +150,7 @@ func (planRejectOp) Preview(_ context.Context, args map[string]any) (WritePrevie
func (featureSettingsOp) Name() string { return WriteOpFeatureSettings }
func (featureSettingsOp) Description() string {
- return "Update governor feature settings through PUT /api/config/governor/features."
+ return "Update governor feature settings through PUT /api/config/governor/features. This includes workflow-run approval (governor.ci: ciAutoApproveWorkflows, ciAutoApproveWorkflowActors)."
}
func (featureSettingsOp) InputSchema() map[string]any {
props := map[string]any{}
@@ -165,6 +165,9 @@ func (featureSettingsOp) InputSchema() map[string]any {
}
props["triageSpecLabels"] = map[string]any{"type": "array", "items": stringSchema()}
props["triageFixLabels"] = map[string]any{"type": "array", "items": stringSchema()}
+ // governor.ci (Settings → Features → Auto-merge → Workflow approval).
+ props["ciAutoApproveWorkflows"] = map[string]any{"type": "boolean", "description": "governor.ci.auto_approve_workflows: approve the workflow runs GitHub holds behind \"Approve and run\" on trusted PR heads (default true)."}
+ props["ciAutoApproveWorkflowActors"] = map[string]any{"type": "string", "description": "governor.ci.auto_approve_workflow_actors as a comma-separated list of GitHub logins trusted besides the hive's App and dashboard-approved heads; blank restores the default (dependabot[bot], renovate[bot]), \"none\" trusts neither."}
props["otelHeaders"] = map[string]any{"type": "object", "additionalProperties": stringSchema()}
props["rotationProviders"] = map[string]any{"type": "object"}
props["rotationAgents"] = map[string]any{"type": "object", "additionalProperties": stringSchema()}
@@ -215,6 +218,14 @@ func capabilityWidens(mode string) bool {
func featureDisclosure(args map[string]any) string {
var warnings []string
+ // Approving held workflow runs lets a PR head's workflow files run on
+ // the repository's runners without a person's click.
+ if v, ok := args["ciAutoApproveWorkflows"].(bool); ok && v {
+ warnings = append(warnings, "ciAutoApproveWorkflows lets the hive approve held workflow runs on trusted PR heads, so their workflow files run on the repository's runners without a maintainer's click")
+ }
+ if v, ok := args["ciAutoApproveWorkflowActors"].(string); ok && !strings.EqualFold(strings.TrimSpace(v), "none") {
+ warnings = append(warnings, "ciAutoApproveWorkflowActors sets whose PRs get held workflow runs approved; a trusted author covers every run on the head, whoever pushed it")
+ }
for _, key := range []string{"ioscanEnabled", "checkpointSpecEnabled", "checkpointPlanEnabled", "checkpointImplementEnabled", "claimsEnabled"} {
if v, ok := args[key].(bool); ok && !v {
warnings = append(warnings, key+" disables a protection or coordination gate")
diff --git a/src/pkg/dashboard/api_governor_features_ops.go b/src/pkg/dashboard/api_governor_features_ops.go
index 255f31c0fb..35956b8ab6 100644
--- a/src/pkg/dashboard/api_governor_features_ops.go
+++ b/src/pkg/dashboard/api_governor_features_ops.go
@@ -16,8 +16,9 @@ import (
// featuresOpsBody is the part of the Features PUT that covers the operational
// hive.yaml blocks issues.*, jev.*, duplicate_sweep.*, policies.*, the
-// turn.pr_follow_up / turn.reentrant knobs, good_first_issue.*, and the
-// governor claim-mirroring and rotation headroom-source keys. Every field is a pointer so an
+// turn.pr_follow_up / turn.reentrant knobs, good_first_issue.*, the
+// governor claim-mirroring and rotation headroom-source keys, and
+// governor.ci's workflow-approval keys. Every field is a pointer so an
// absent key leaves the config untouched. Durations travel as Go duration
// strings ("10m", "24h"); an empty string means the built-in default.
type featuresOpsBody struct {
@@ -77,6 +78,14 @@ type featuresOpsBody struct {
// governor.rotation.headroom_source: builtin (default) or ccleft. The
// rotation manager builds its probers at boot, so this needs a restart.
RotationHeadroomSource *string `json:"rotationHeadroomSource"`
+ // governor.ci (hivecommons/hive#16603): whether the hive approves the
+ // workflow runs GitHub holds behind "Approve and run" on trusted PR
+ // heads, and which authors / triggering actors it trusts besides its
+ // App and owner admissions, as a comma-separated list. Blank restores
+ // the default (dependabot[bot], renovate[bot]); "none" stores an
+ // explicit empty list. The approval sweep reads both every cycle.
+ CIAutoApproveWorkflows *bool `json:"ciAutoApproveWorkflows"`
+ CIAutoApproveWorkflowActors *string `json:"ciAutoApproveWorkflowActors"`
}
// envVarNamePattern is the shape of a POSIX environment variable name.
@@ -361,6 +370,25 @@ func (b featuresOpsBody) prepare(cur *config.Config) (func(*config.Config), erro
}
steps = append(steps, func(c *config.Config) { c.Governor.Rotation.HeadroomSource = v })
}
+ if b.CIAutoApproveWorkflows != nil {
+ v := *b.CIAutoApproveWorkflows
+ steps = append(steps, func(c *config.Config) { c.Governor.CI.AutoApproveWorkflows = &v })
+ }
+ if b.CIAutoApproveWorkflowActors != nil {
+ v := parseNeverClaimLabelsInput(*b.CIAutoApproveWorkflowActors)
+ for _, actor := range v {
+ if strings.ContainsAny(actor, " \t") {
+ return nil, fmt.Errorf("governor ci auto_approve_workflow_actors: %q is not a GitHub login", actor)
+ }
+ }
+ steps = append(steps, func(c *config.Config) {
+ if v == nil {
+ c.Governor.CI.AutoApproveWorkflowActors = nil
+ return
+ }
+ c.Governor.CI.AutoApproveWorkflowActors = &v
+ })
+ }
return func(c *config.Config) {
for _, step := range steps {
@@ -394,6 +422,9 @@ func featuresOpsResponse(cfg *config.Config) map[string]interface{} {
"claimsNeverClaimDefault": strings.Join(claims.DefaultNeverClaimLabels, ", "),
"rotationHeadroomSource": cfg.Governor.Rotation.EffectiveHeadroomSource(),
"rotationHeadroomSourceValues": []string{config.RotationHeadroomSourceBuiltin, config.RotationHeadroomSourceCCLeft},
+ "ciAutoApproveWorkflows": cfg.Governor.CI.AutoApproveWorkflowsEnabled(),
+ "ciAutoApproveWorkflowActors": ciAutoApproveActorsResponse(cfg.Governor.CI),
+ "ciAutoApproveActorsDefault": strings.Join(config.DefaultAutoApproveWorkflowActors, ", "),
"issuesCloseOnMerge": cfg.Issues.CloseOnMergeEnabled(),
"issuesCloseOnMergeInterval": settingsDurationString(cfg.Issues.CloseOnMergeInterval),
@@ -495,3 +526,16 @@ func parseNeverClaimLabelsInput(raw string) []string {
}
return out
}
+
+// ciAutoApproveActorsResponse is governor.ci.auto_approve_workflow_actors in
+// the Settings dialog's spelling: blank when unset (the default applies),
+// "none" for an explicit empty list, otherwise the comma-separated logins.
+func ciAutoApproveActorsResponse(ci config.GovernorCIConfig) string {
+ if ci.AutoApproveWorkflowActors == nil {
+ return ""
+ }
+ if len(*ci.AutoApproveWorkflowActors) == 0 {
+ return neverClaimLabelsOff
+ }
+ return strings.Join(*ci.AutoApproveWorkflowActors, ", ")
+}
diff --git a/src/pkg/dashboard/governor_settings_parity_test.go b/src/pkg/dashboard/governor_settings_parity_test.go
index e42dffb441..f33fa4eb25 100644
--- a/src/pkg/dashboard/governor_settings_parity_test.go
+++ b/src/pkg/dashboard/governor_settings_parity_test.go
@@ -316,3 +316,77 @@ func TestParityBatch7SettingsRenderEveryKey(t *testing.T) {
}
}
}
+
+// governor.ci's workflow-approval keys (hivecommons/hive#16603) round-trip
+// through the Features PUT: the flag, the actor list as typed, "none" for an
+// explicit empty list and blank for the default.
+func TestGovernorFeaturesWorkflowApprovalRoundTrip(t *testing.T) {
+ s := covApiServer(t)
+ if rec := doPut(s, opsFeaturesPath, map[string]any{"ciAutoApproveWorkflowActors": "dependabot[bot], some one"}); rec.Code != http.StatusBadRequest {
+ t.Fatalf("an actor with a space: expected 400, got %d", rec.Code)
+ }
+ if s.deps.Config.Governor.CI.AutoApproveWorkflowActors != nil {
+ t.Fatal("a rejected PUT changed the actor list")
+ }
+ if rec := doPut(s, opsFeaturesPath, map[string]any{
+ "ciAutoApproveWorkflows": false,
+ "ciAutoApproveWorkflowActors": " renovate[bot], github-actions[bot] ,",
+ }); rec.Code != http.StatusOK {
+ t.Fatalf("features PUT: %d — %s", rec.Code, rec.Body.String())
+ }
+ ci := s.deps.Config.Governor.CI
+ if ci.AutoApproveWorkflowsEnabled() {
+ t.Fatal("auto_approve_workflows not turned off")
+ }
+ if got := strings.Join(ci.WorkflowApprovalActors(), ","); got != "renovate[bot],github-actions[bot]" {
+ t.Fatalf("auto_approve_workflow_actors = %q", got)
+ }
+
+ rec := doGet(s, "/api/config/governor")
+ if rec.Code != http.StatusOK {
+ t.Fatalf("governor GET: %d", rec.Code)
+ }
+ var got struct {
+ Features map[string]any `json:"features"`
+ }
+ if err := json.Unmarshal(rec.Body.Bytes(), &got); err != nil {
+ t.Fatal(err)
+ }
+ f := got.Features
+ if f["ciAutoApproveWorkflows"] != false || f["ciAutoApproveWorkflowActors"] != "renovate[bot], github-actions[bot]" || f["ciAutoApproveActorsDefault"] != "dependabot[bot], renovate[bot]" {
+ t.Fatalf("features response: %v / %v / %v", f["ciAutoApproveWorkflows"], f["ciAutoApproveWorkflowActors"], f["ciAutoApproveActorsDefault"])
+ }
+
+ if rec := doPut(s, opsFeaturesPath, map[string]any{"ciAutoApproveWorkflowActors": "none"}); rec.Code != http.StatusOK {
+ t.Fatalf("none PUT: %d — %s", rec.Code, rec.Body.String())
+ }
+ if a := s.deps.Config.Governor.CI.AutoApproveWorkflowActors; a == nil || len(*a) != 0 || len(s.deps.Config.Governor.CI.WorkflowApprovalActors()) != 0 {
+ t.Fatalf("\"none\" must store an explicit empty list, got %#v", a)
+ }
+ if rec := doPut(s, opsFeaturesPath, map[string]any{"ciAutoApproveWorkflowActors": " "}); rec.Code != http.StatusOK {
+ t.Fatalf("blank PUT: %d — %s", rec.Code, rec.Body.String())
+ }
+ if ci = s.deps.Config.Governor.CI; ci.AutoApproveWorkflowActors != nil || ci.WorkflowApprovalActors()[0] != "dependabot[bot]" {
+ t.Fatalf("blank must restore the default actors, got %#v", ci.AutoApproveWorkflowActors)
+ }
+ if ci.AutoApproveWorkflowsEnabled() {
+ t.Fatal("a PUT that did not carry the flag changed it")
+ }
+}
+
+// Both governor.ci keys render on Settings → Features with their YAML-key
+// hint next to a control bound to the Features save path.
+func TestWorkflowApprovalSettingsRender(t *testing.T) {
+ features := extractJSFunction(t, indexHTML(t), "renderGovFeatures")
+ for _, c := range []struct{ yaml, control string }{
+ {"governor.ci.auto_approve_workflows", `data-section="features" data-key="ciAutoApproveWorkflows"`},
+ {"governor.ci.auto_approve_workflow_actors", `data-arg1="ciAutoApproveWorkflowActors" data-arg-types="s,s,s"`},
+ } {
+ if !strings.Contains(features, "yamlHint('"+c.yaml+"')") {
+ t.Errorf("%s has no YAML-key hint", c.yaml)
+ }
+ if !strings.Contains(features, c.control) {
+ t.Errorf("%s has no Features control (%s)", c.yaml, c.control)
+ }
+ }
+}
diff --git a/src/pkg/dashboard/settings_parity_allowlist.txt b/src/pkg/dashboard/settings_parity_allowlist.txt
index de2353a26e..13a4b54c0c 100644
--- a/src/pkg/dashboard/settings_parity_allowlist.txt
+++ b/src/pkg/dashboard/settings_parity_allowlist.txt
@@ -258,8 +258,6 @@ governor.budget.coins..budget # TODO #11854
governor.budget.coins..label # TODO #11854
governor.budget.coins..tokens_per_coin # TODO #11854
governor.budget.coins..usd_per_coin # TODO #11854
-governor.ci.auto_approve_workflow_actors[] # trusted workflow-approval actors (#16603); yaml-only
-governor.ci.auto_approve_workflows # gated workflow auto-approval flag (#16603); yaml-only
governor.ci_failure_kick_cooldown_s # webhook CI-failure kick cooldown (#15291); yaml-only
governor.ci_failure_webhook_kick # webhook CI-failure kick flag (#15291); yaml-only
governor.dependency_bot_rebase_after_s # stranded dependency-bot PR window (bot_rebase_request); yaml-only
diff --git a/src/pkg/dashboard/static-src/js/config-features.js b/src/pkg/dashboard/static-src/js/config-features.js
index b020e90900..d913452f95 100644
--- a/src/pkg/dashboard/static-src/js/config-features.js
+++ b/src/pkg/dashboard/static-src/js/config-features.js
@@ -785,6 +785,18 @@
Integration-aware multi-agent orchestration is planned, not a selectable implementation.
+
+
Workflow approval ${settingHelpMark('settings', 'features', 'Workflow approval', `GitHub holds workflow runs for Dependabot, first-time and fork contributors behind "Approve and run workflows" (action_required); such runs report no checks, so CI never finishes. When on, the hive approves those runs itself, once per PR head, for heads it trusts: its own App's (same-repo heads only), a head a person approved on the dashboard, or a PR whose author or triggering actor is in the list below. Approval starts CI only: review, hold and merge gates still apply. Runs it does not trust stay for a person, and the PR shows "workflow runs held for a maintainer's approval". Needs Actions: Read and write on the App.`)}
+
+
+ Approve held workflow runs on trusted heads ${yamlHint('governor.ci.auto_approve_workflows')} ${settingHelpMark('settings', 'features', 'Approve held workflow runs', `On by default. Off leaves every held run for a maintainer to approve on GitHub. Operators on self-hosted runners who want an explicit opt-in turn it off. Applies from the next eval cycle.`)}
+
+
+
+
+
Blank uses the default (${esc(f.ciAutoApproveActorsDefault || 'dependabot[bot], renovate[bot]')}); "none" trusts only the App and dashboard-approved heads. Applies from the next eval cycle.
Integration-aware multi-agent orchestration is planned, not a selectable implementation.
+
+
Workflow approval ${settingHelpMark('settings', 'features', 'Workflow approval', `GitHub holds workflow runs for Dependabot, first-time and fork contributors behind "Approve and run workflows" (action_required); such runs report no checks, so CI never finishes. When on, the hive approves those runs itself, once per PR head, for heads it trusts: its own App's (same-repo heads only), a head a person approved on the dashboard, or a PR whose author or triggering actor is in the list below. Approval starts CI only: review, hold and merge gates still apply. Runs it does not trust stay for a person, and the PR shows "workflow runs held for a maintainer's approval". Needs Actions: Read and write on the App.`)}
+
+
+ Approve held workflow runs on trusted heads ${yamlHint('governor.ci.auto_approve_workflows')} ${settingHelpMark('settings', 'features', 'Approve held workflow runs', `On by default. Off leaves every held run for a maintainer to approve on GitHub. Operators on self-hosted runners who want an explicit opt-in turn it off. Applies from the next eval cycle.`)}
+
+
+
+
+
Blank uses the default (${esc(f.ciAutoApproveActorsDefault || 'dependabot[bot], renovate[bot]')}); "none" trusts only the App and dashboard-approved heads. Applies from the next eval cycle.