Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/added-shared-ci-rerun-setting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `shared_ci_rerun.enabled` is now a Settings toggle (Features → Quality loops & release health → Shared-CI recovery) and an admin-MCP `governor.feature_settings` field (`sharedCiRerunEnabled`), so a hive whose App has no Actions write (an optional permission) can turn the shared-CI rerun attempts and their notes off without editing its config file.
5 changes: 5 additions & 0 deletions src/docs/admin-mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,11 @@ refuses any other role.
`writebackBackfill` (`writeback.unsolicited.backfill`). Its preview names
each one that lets the hive write to more items: backfill on, the opt-in
label requirement off, or any level change.
- `governor.feature_settings` also takes `sharedCiRerunEnabled`
(`shared_ci_rerun.enabled`, Settings → Features → Quality loops & release
health → Shared-CI recovery). Turning it off stops the shared-CI rerun
attempts and their notes, for example on a hive whose App has no Actions
write; turning it on is named in the preview's widening disclosure.
- `writeback.kind_policy` changes the write-back gate's per-kind overrides
(`writeback.kinds.<kind>`: `min_level`, `require_label`,
`unlabeled_min_level` and `own_only`), through
Expand Down
6 changes: 5 additions & 1 deletion src/docs/github-app-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ a source-code defect: Hive records `unauthorized:rerun-shared-ci`, posts one
head-scoped actionable note using the existing unauthorized mechanism, and
retries no more than once per repository per permission cooldown (one hour).
An unchanged PR remains eligible after the cooldown; a successful rerun or
observing no failed runs clears the recovery block.
observing no failed runs clears the recovery block. A hive that does not grant
the permission can turn the sweep off with the **Re-run PRs after a shared-CI
incident** toggle (Settings → Features → Quality loops & release health →
Shared-CI recovery) or the admin MCP `governor.feature_settings` field
`sharedCiRerunEnabled`, which stops the attempts and their notes.

The transient-CI re-run (a red hive or trusted-bot PR whose failing runs all
carry `hive-ci-transient`, see ADR-0010) uses the same `rerun-failed-jobs`
Expand Down
2 changes: 1 addition & 1 deletion src/docs/operator-reference/sweeps-and-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ someone re-runs it. The shared-CI rerun sweep

| Key | Default | Meaning |
|---|---|---|
| `shared_ci_rerun.enabled` | `true` (unset) | Set `false` to stop re-running PRs when a `[shared-ci]` incident closes or its check passes on the base again. |
| `shared_ci_rerun.enabled` | `true` (unset) | Set `false` to stop re-running PRs when a `[shared-ci]` incident closes or its check passes on the base again. Settings → Features → Quality loops & release health → **Shared-CI recovery**, or the admin MCP `governor.feature_settings` field `sharedCiRerunEnabled`. |

## Shared-CI tracking issues (`shared_ci_issues`)

Expand Down
18 changes: 18 additions & 0 deletions src/pkg/adminmcp/adminmcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,24 @@ func TestFeatureSettingsWorkflowApproval(t *testing.T) {
}
}

// shared_ci_rerun.enabled is writable through governor.feature_settings;
// turning the sweep on is disclosed, turning it off is not.
func TestFeatureSettingsSharedCIRerun(t *testing.T) {
preview, err := featureSettingsOp{}.Preview(context.Background(), map[string]any{"sharedCiRerunEnabled": true})
if err != nil {
t.Fatal(err)
}
if body := preview.Request.Body.(map[string]any); body["sharedCiRerunEnabled"] != true {
t.Fatalf("body = %#v", body)
}
if !strings.Contains(preview.WideningDisclosure, "sharedCiRerunEnabled") {
t.Fatalf("disclosure %q does not name sharedCiRerunEnabled", preview.WideningDisclosure)
}
if p, err := (featureSettingsOp{}).Preview(context.Background(), map[string]any{"sharedCiRerunEnabled": false}); err != nil || strings.Contains(p.WideningDisclosure, "sharedCiRerunEnabled") {
t.Fatalf("turning the rerun sweep off is no widening: %q, %v", p.WideningDisclosure, err)
}
}

// Write-back containment's unsolicited knobs (Settings → Features →
// Write-back containment) are writable here too, and the preview names
// each change that lets the hive write to more items (#18846 follow-up).
Expand Down
8 changes: 7 additions & 1 deletion src/pkg/adminmcp/tools_fleet_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -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. This includes workflow-run approval (governor.ci: ciAutoApproveWorkflows, ciAutoApproveWorkflowActors) and write-back containment's unsolicited knobs (writeback.unsolicited: writebackMinLevel, writebackRequireLabels, writebackBackfill); the per-kind overrides have their own operation, writeback.kind_policy."
return "Update governor feature settings through PUT /api/config/governor/features. This includes workflow-run approval (governor.ci: ciAutoApproveWorkflows, ciAutoApproveWorkflowActors), the shared-CI rerun sweep (shared_ci_rerun.enabled: sharedCiRerunEnabled) and write-back containment's unsolicited knobs (writeback.unsolicited: writebackMinLevel, writebackRequireLabels, writebackBackfill); the per-kind overrides have their own operation, writeback.kind_policy."
}
func (featureSettingsOp) InputSchema() map[string]any {
props := map[string]any{}
Expand All @@ -168,6 +168,7 @@ func (featureSettingsOp) InputSchema() map[string]any {
// 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["sharedCiRerunEnabled"] = map[string]any{"type": "boolean", "description": "shared_ci_rerun.enabled: re-run the failed jobs of PRs a [shared-ci] incident held red once it is over (default true; needs Actions write on the App, which is optional)."}
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()}
Expand Down Expand Up @@ -226,6 +227,11 @@ func featureDisclosure(args map[string]any) string {
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")
}
// The shared-CI rerun sweep re-runs failed jobs and comments on the PRs
// it re-ran (or, without Actions write, asks a maintainer to).
if v, ok := args["sharedCiRerunEnabled"].(bool); ok && v {
warnings = append(warnings, "sharedCiRerunEnabled lets the hive re-run failed jobs on PRs a shared-CI incident held red and leave a note on each")
}
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")
Expand Down
16 changes: 14 additions & 2 deletions src/pkg/dashboard/api_governor_features_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,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.*, the
// governor claim-mirroring and rotation headroom-source keys, and
// governor.ci's workflow-approval keys. Every field is a pointer so an
// governor claim-mirroring and rotation headroom-source keys,
// governor.ci's workflow-approval keys, and shared_ci_rerun.enabled. 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 {
Expand Down Expand Up @@ -86,6 +87,12 @@ type featuresOpsBody struct {
// explicit empty list. The approval sweep reads both every cycle.
CIAutoApproveWorkflows *bool `json:"ciAutoApproveWorkflows"`
CIAutoApproveWorkflowActors *string `json:"ciAutoApproveWorkflowActors"`
// shared_ci_rerun.enabled: whether the shared-CI rerun sweep re-runs the
// failed jobs of PRs a [shared-ci] incident held red once it is over. A
// hive whose App has no Actions write (an optional permission,
// docs/github-app-setup.md) may turn it off to stop the attempts and
// their notes. The sweep reads it every pass.
SharedCIRerunEnabled *bool `json:"sharedCiRerunEnabled"`
}

// envVarNamePattern is the shape of a POSIX environment variable name.
Expand Down Expand Up @@ -389,6 +396,10 @@ func (b featuresOpsBody) prepare(cur *config.Config) (func(*config.Config), erro
c.Governor.CI.AutoApproveWorkflowActors = &v
})
}
if b.SharedCIRerunEnabled != nil {
v := *b.SharedCIRerunEnabled
steps = append(steps, func(c *config.Config) { c.SharedCIRerun.Enabled = &v })
}

return func(c *config.Config) {
for _, step := range steps {
Expand Down Expand Up @@ -425,6 +436,7 @@ func featuresOpsResponse(cfg *config.Config) map[string]interface{} {
"ciAutoApproveWorkflows": cfg.Governor.CI.AutoApproveWorkflowsEnabled(),
"ciAutoApproveWorkflowActors": ciAutoApproveActorsResponse(cfg.Governor.CI),
"ciAutoApproveActorsDefault": strings.Join(config.DefaultAutoApproveWorkflowActors, ", "),
"sharedCiRerunEnabled": cfg.SharedCIRerun.IsEnabled(),

"issuesCloseOnMerge": cfg.Issues.CloseOnMergeEnabled(),
"issuesCloseOnMergeInterval": settingsDurationString(cfg.Issues.CloseOnMergeInterval),
Expand Down
40 changes: 40 additions & 0 deletions src/pkg/dashboard/governor_settings_parity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,43 @@ func TestWorkflowApprovalSettingsRender(t *testing.T) {
}
}
}

// shared_ci_rerun.enabled round-trips through the Features PUT and renders on
// Settings → Features → Quality with its YAML-key hint. A hive whose App has
// no Actions write (optional) turns it off to stop the rerun attempts.
func TestGovernorFeaturesSharedCIRerunRoundTrip(t *testing.T) {
s := covApiServer(t)
if !s.deps.Config.SharedCIRerun.IsEnabled() {
t.Fatal("shared_ci_rerun must default on")
}
if rec := doPut(s, opsFeaturesPath, map[string]any{"sharedCiRerunEnabled": false}); rec.Code != http.StatusOK {
t.Fatalf("features PUT: %d — %s", rec.Code, rec.Body.String())
}
if s.deps.Config.SharedCIRerun.IsEnabled() {
t.Fatal("shared_ci_rerun.enabled not turned off")
}
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)
}
if got.Features["sharedCiRerunEnabled"] != false {
t.Fatalf("features response sharedCiRerunEnabled = %v", got.Features["sharedCiRerunEnabled"])
}
if rec := doPut(s, opsFeaturesPath, map[string]any{"ciAutoApproveWorkflows": true}); rec.Code != http.StatusOK {
t.Fatalf("unrelated PUT: %d", rec.Code)
}
if s.deps.Config.SharedCIRerun.IsEnabled() {
t.Fatal("a PUT that did not carry the flag changed it")
}

features := extractJSFunction(t, indexHTML(t), "renderGovFeatures")
if !strings.Contains(features, "yamlHint('shared_ci_rerun.enabled')") || !strings.Contains(features, `data-section="features" data-key="sharedCiRerunEnabled"`) {
t.Error("shared_ci_rerun.enabled has no Features control with its YAML-key hint")
}
}
1 change: 0 additions & 1 deletion src/pkg/dashboard/settings_parity_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,6 @@ self_experiments.scheduler.interval_s # TODO #11854
self_experiments.scheduler.mode # TODO #11854
shared_ci_issues.enabled # shared-CI tracking issue sweep; yaml-only
shared_ci_issues.min_prs # shared-CI tracking issue sweep; yaml-only
shared_ci_rerun.enabled # TODO #11854
swarm.themes.<key>.call_to_arms # TODO #11854
swarm.themes.<key>.event_name # TODO #11854
swarm.themes.<key>.leaderboard_title # TODO #11854
Expand Down
8 changes: 8 additions & 0 deletions src/pkg/dashboard/static-src/js/config-features.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/pkg/dashboard/static-src/js/config-state.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67229,6 +67229,7 @@ <h3 style="color:var(--amber);text-align:center">Configure LiteLLM</h3>
{ tab: 'Features', section: 'Autonomy & ACMM', label: 'Design-first planning', key: 'planning.design_approved_label', text: 'planning design approved label architect revisions concurrent designs plan from label planning.design_approved_label planning.max_concurrent_designs planning.max_design_revisions planning.plan_from_label' },
{ tab: 'Features', section: 'Autonomy & ACMM', label: 'Write-back containment', key: 'writeback.unsolicited.min_level', text: 'write-back writeback containment unsolicited comments labels sentinel hold-gate stage labels opt-in label backfill per repo mode suppressed acmm level duplicate dedupe burst rate cap hourly writeback.unsolicited.min_level writeback.unsolicited.require_labels writeback.unsolicited.backfill writeback.per_repo writeback.kinds unlabeled_min_level own_only without label hive-authored only writeback.dedupe.enabled writeback.dedupe.same_item_ttl writeback.dedupe.burst_items writeback.dedupe.burst_window writeback.dedupe.hourly_cap' },
{ tab: 'Features', section: 'Work intake & issue lifecycle', label: 'Superseded PR grace period', key: 'supersession_sweep.grace_period', text: 'supersession superseded grace period close contributor pr supersession_sweep.grace_period' },
{ tab: 'Features', section: 'Quality loops & release health', label: 'Shared-CI recovery', key: 'shared_ci_rerun.enabled', text: 'shared ci rerun re-run failed jobs incident recovery tracking issue outage actions write shared_ci_rerun.enabled' },
{ tab: 'Features', section: 'Quality loops & release health', label: 'Compliance posture windows', key: 'compliance.posture_checks.window_days', text: 'compliance posture look-back window history retention compliance.posture_checks.window_days compliance.posture_checks.history_days' },
{ tab: 'Features', section: 'Agents & tooling', label: 'Swarm banner wording', key: 'swarm.event_name', text: 'swarm event name call to arms leaderboard title banner swarm.event_name swarm.call_to_arms swarm.leaderboard_title' },
{ tab: 'Features', section: 'Agents & tooling', label: 'Tool approval inbox path', key: 'tool_approval.inbox_path', text: 'tool approval inbox pending approvals path tool_approval.inbox_path' },
Expand Down Expand Up @@ -83131,6 +83132,14 @@ <h3 class="features-section-title">${esc(s.title)}</h3>
</div>
<div class="config-help">Applies on the next posture pass.</div>
</div>

<div class="settings-subsection">
<div class="settings-subsection-title">Shared-CI recovery ${settingHelpMark('settings', 'features', 'Shared-CI recovery', `When one check fails across many PRs at once, the hive files a [shared-ci] tracking issue. Once that incident is over (the issue is closed, or its check has passed on the PR's base branch again) the rerun sweep re-runs the failed jobs of each PR the incident held red, once per PR per incident, and leaves a short note on the PR.`)}</div>
<div class="config-toggle" data-setting-key="shared_ci_rerun.enabled">
<div class="config-toggle-switch ${f.sharedCiRerunEnabled !== false ? 'on' : ''}" data-action="toggleConfigSwitch" data-section="features" data-key="sharedCiRerunEnabled"></div>
<span class="config-toggle-label">Re-run PRs after a shared-CI incident ${yamlHint('shared_ci_rerun.enabled')} ${settingHelpMark('settings', 'features', 'Re-run PRs after a shared-CI incident', `On by default. Re-running failed jobs needs Actions: Read and write on the App, which is optional. Without it GitHub refuses each re-run (403) and the PR gets a note asking a maintainer to re-run it; turn this off to stop those attempts and notes. Applies from the next sweep.`)}</span>
</div>
</div>
`)}

${featuresSectionHtml('integrations', `
Expand Down
Loading