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-writeback-unsolicited-mcp-write.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The admin MCP `governor.feature_settings` operation now writes write-back containment's unsolicited knobs (`writebackMinLevel`, `writebackRequireLabels`, `writebackBackfill`), which until now only the dashboard's Settings → Features toggles could change. The preview discloses each change that lets the hive write to more items.
7 changes: 7 additions & 0 deletions src/docs/admin-mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,13 @@ refuses any other role.
operator-owned (`governor.cadence_owners`), as a dashboard edit does, so a
later ACMM level change (`fleet.autonomy_level`) or pack apply no longer
resets it to the pack default. The preview says so.
- `governor.feature_settings` also takes write-back containment's unsolicited
knobs, the toggles above the per-kind table on Settings → Features:
`writebackMinLevel` (`writeback.unsolicited.min_level`, 0 restores the default),
`writebackRequireLabels` (`writeback.unsolicited.require_labels`) and
`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.
- `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
7 changes: 6 additions & 1 deletion src/docs/design/admin-mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,12 @@ Phase 5 registers the fleet-level write operations under that contract:
released; rejection discloses the re-gating and lease reset.
- `governor.feature_settings` wraps `PUT /api/config/governor/features`, preserves the
endpoint's pointer-field partial update contract, and calls out protective toggles such as
ioscan, claims, checkpoint gates, and autonomy automation before confirmation.
ioscan, claims, checkpoint gates, and autonomy automation before confirmation. It also takes
write-back containment's three unsolicited knobs (`writebackMinLevel`,
`writebackRequireLabels`, `writebackBackfill` for `writeback.unsolicited.*`), and discloses
turning backfill on and turning the opt-in label requirement off, since each lets the hive
write to more items it was not asked to touch, and any change to the level floor (which
raises per-kind floors, never lowers them; 0 restores the default).
- `governor.general_settings` wraps `PUT /api/config/governor/general-advanced` (Settings →
General: the eval interval, the loop pacing knobs, `governor.api_budget_pacing`, the default
explain mode and the attribution trailer). It sends only the fields that differ from the
Expand Down
22 changes: 22 additions & 0 deletions src/pkg/adminmcp/adminmcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1067,3 +1067,25 @@ func mustJSON(t *testing.T, v any) string {
}
return string(b)
}

// 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).
func TestFeatureSettingsWritebackUnsolicited(t *testing.T) {
preview, err := featureSettingsOp{}.Preview(context.Background(), map[string]any{"writebackBackfill": true, "writebackRequireLabels": false, "writebackMinLevel": 3})
if err != nil {
t.Fatal(err)
}
body := preview.Request.Body.(map[string]any)
if body["writebackBackfill"] != true || body["writebackRequireLabels"] != false || body["writebackMinLevel"] != 3 {
t.Fatalf("body = %#v", body)
}
for _, want := range []string{"writebackBackfill", "writebackRequireLabels", "writebackMinLevel"} {
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{"writebackBackfill": false}); err != nil || strings.Contains(p.WideningDisclosure, "writebackBackfill") {
t.Fatalf("turning backfill off is no widening: %q, %v", p.WideningDisclosure, err)
}
}
18 changes: 15 additions & 3 deletions 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."
return "Update governor feature settings through PUT /api/config/governor/features. This includes 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 Down Expand Up @@ -225,6 +225,18 @@ func featureDisclosure(args map[string]any) string {
warnings = append(warnings, key+" enables additional fleet behavior")
}
}
// Write-back containment (writeback.unsolicited, Settings → Features →
// Write-back containment): each of these lets the hive write to more
// PRs and issues it was not asked to touch.
if v, ok := args["writebackBackfill"].(bool); ok && v {
warnings = append(warnings, "writebackBackfill lets the hive write unsolicited to PRs and issues created before it first saw the repository")
}
if v, ok := args["writebackRequireLabels"].(bool); ok && !v {
warnings = append(warnings, "writebackRequireLabels off drops the review opt-in label requirement for unsolicited write-backs on other people's PRs")
}
if _, ok := args["writebackMinLevel"]; ok {
warnings = append(warnings, "writebackMinLevel changes the ACMM floor for unsolicited write-backs (it raises per-kind floors, never lowers them; 0 restores the default)")
}
if len(warnings) == 0 {
return "No obvious authority widening detected from the provided feature fields."
}
Expand Down Expand Up @@ -290,11 +302,11 @@ func featureFieldSet(schema map[string]any) map[string]bool {
}

func boolFeatureFields() []string {
return []string{"ioscanEnabled", "tracingEnabled", "otelEnabled", "retroEnabled", "mintEnabled", "planFromLabel", "formalEnabled", "personaLearningEnabled", "checkpointSpecEnabled", "checkpointPlanEnabled", "checkpointImplementEnabled", "planMatchEnabled", "spektacularEnabled", "spektacularHubExecutor", "runStages", "triageEnabled", "triageClarifyComment", "publicationEnabled", "extFlueEnabled", "extOmpEnabled", "wavefrontEnabled", "claimsEnabled", "autonomyAutoPromote", "autonomyAutoDemote", "rotationEnabled", "otelInsecure"}
return []string{"ioscanEnabled", "tracingEnabled", "otelEnabled", "retroEnabled", "mintEnabled", "planFromLabel", "formalEnabled", "personaLearningEnabled", "checkpointSpecEnabled", "checkpointPlanEnabled", "checkpointImplementEnabled", "planMatchEnabled", "spektacularEnabled", "spektacularHubExecutor", "runStages", "triageEnabled", "triageClarifyComment", "publicationEnabled", "extFlueEnabled", "extOmpEnabled", "wavefrontEnabled", "claimsEnabled", "autonomyAutoPromote", "autonomyAutoDemote", "rotationEnabled", "otelInsecure", "writebackRequireLabels", "writebackBackfill"}
}

func intFeatureFields() []string {
return []string{"runWaitTimeoutSeconds", "spektacularPollS", "spektacularHubExecutorTimeoutS", "spektacularHubExecutorMaxConcurrent", "maxStageRetries", "triageMinBodyChars", "claimsTtlS", "autonomyPromoteAfter", "autonomyMaxLevel", "autonomyCooldownDays", "rotationThresholdPct", "rotationHighVolumeCadenceS"}
return []string{"runWaitTimeoutSeconds", "spektacularPollS", "spektacularHubExecutorTimeoutS", "spektacularHubExecutorMaxConcurrent", "maxStageRetries", "triageMinBodyChars", "claimsTtlS", "autonomyPromoteAfter", "autonomyMaxLevel", "autonomyCooldownDays", "rotationThresholdPct", "rotationHighVolumeCadenceS", "writebackMinLevel"}
}

func stringFeatureFields() []string {
Expand Down
Loading