From 2cc1650c320623068e8b05576610019cfc886ecc Mon Sep 17 00:00:00 2001 From: Danathar Date: Tue, 10 Nov 2026 10:34:32 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(dashboard):=20controls=20for?= =?UTF-8?q?=20settings=20only=20the=20admin=20MCP=20could=20change?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar --- .../fixed-dashboard-mcp-parity-controls.md | 1 + src/docs/agent-configuration.md | 2 + .../dashboard-sections/activity-monitor.md | 2 +- src/docs/hive-merge.md | 12 +- src/pkg/adminmcp/tools_config_surface_ops.go | 5 +- .../dashboard_mcp_parity_controls_test.go | 140 +++++++++++++++++ .../dashboard/settings_parity_allowlist.txt | 2 - .../dashboard/static-src/js/config-agent.js | 9 +- .../static-src/js/config-features.js | 59 ++++++-- .../dashboard/static-src/js/config-helpers.js | 65 ++++++++ src/pkg/dashboard/static-src/js/debug-logs.js | 2 +- .../static-src/js/linear-repos-save.js | 8 +- src/pkg/dashboard/static/index.html | 143 +++++++++++++++--- 13 files changed, 396 insertions(+), 54 deletions(-) create mode 100644 changelog.d/fixed-dashboard-mcp-parity-controls.md create mode 100644 src/pkg/dashboard/dashboard_mcp_parity_controls_test.go diff --git a/changelog.d/fixed-dashboard-mcp-parity-controls.md b/changelog.d/fixed-dashboard-mcp-parity-controls.md new file mode 100644 index 0000000000..c6d8af8abb --- /dev/null +++ b/changelog.d/fixed-dashboard-mcp-parity-controls.md @@ -0,0 +1 @@ +- 🐛 **Owners could not see or change some settings from the dashboard that the admin MCP could already change.** Settings → Features → Auto-merge → **Per-repository merge policy** now has **Merge with no CI** (`auto_merge.no_ci_ok`: a listed repository's pull requests can merge with no CI checks at all) and, while it is set, the deprecated `auto_merge.allow_unprotected_base` list marked as having no effect. Settings → Features → **Let hive decide** now has a per-repository on / off / hive-wide table (`decisions.delegate.repos`) and an **Effect timeout** (`decisions.delegate.effect_timeout`); a table edit saves every repository's override, so overrides set in hive.yaml or through the admin MCP are kept. An agent whose mode is `NO_GITHUB` (a legacy alias for ADVISORY) now shows that mode in Agent → Operating Mode instead of "use level default". No endpoint changed. See [hive-merge.md](src/docs/hive-merge.md) and [Let hive decide](src/docs/dashboard-sections/activity-monitor.md#let-hive-decide). diff --git a/src/docs/agent-configuration.md b/src/docs/agent-configuration.md index 4d097ec910..e9e7fb593a 100644 --- a/src/docs/agent-configuration.md +++ b/src/docs/agent-configuration.md @@ -285,6 +285,8 @@ spec omits `launch_cmd`, Hive still builds the backend command normally. enabled: true # default true; set false to keep it configured but off mode: ISSUES_AND_PRS # GitHub interaction tier: ADVISORY | ISSUES_ONLY | # ISSUES_AND_PRS | ISSUES_PRS_MERGE + # (NO_GITHUB is a legacy alias for ADVISORY; the + # dashboard lists it only for an agent that has it) converse: true # let this agent comment on issues/PRs and leave PR # reviews, INDEPENDENTLY of mode. Off by default. # See "Conversation is not a tier" below. diff --git a/src/docs/dashboard-sections/activity-monitor.md b/src/docs/dashboard-sections/activity-monitor.md index c7889c20cf..17f77ffa7a 100644 --- a/src/docs/dashboard-sections/activity-monitor.md +++ b/src/docs/dashboard-sections/activity-monitor.md @@ -789,7 +789,7 @@ The same renderer serves issue decisions and every PR verdict (adopt, approve, c #### Setting -`decisions.delegate.enabled` (default **true** — the same default as the other "let the hive do it" switches); `decisions.delegate.repos..enabled` (or the bare repository name) overrides per repository. `decisions.delegate.llm.enabled` (default **false**) adds the LLM step described below. `decisions.delegate.effect_timeout` (default **30m**, a Go duration) is how long a recorded decision may go without its expected effect before a repeat click reports it as stuck. When the delegate is off the menu entry stays visible but the endpoint answers 403 naming the setting. An owner can change the hive-wide switch, the LLM step and its model under Settings → Features → *Let hive decide*, all of the block through `PUT /api/config/decisions/delegate`, and the same through the admin MCP operation `decisions.delegate_settings`; the change applies without a restart. The per-repository switch also gates the reviewer-question sweep (`governor.review.auto_decide_questions`), which runs this decision by itself on the hive's own pull requests. +`decisions.delegate.enabled` (default **true** — the same default as the other "let the hive do it" switches); `decisions.delegate.repos..enabled` (or the bare repository name) overrides per repository. `decisions.delegate.llm.enabled` (default **false**) adds the LLM step described below. `decisions.delegate.effect_timeout` (default **30m**, a Go duration) is how long a recorded decision may go without its expected effect before a repeat click reports it as stuck. When the delegate is off the menu entry stays visible but the endpoint answers 403 naming the setting. An owner can change all of the block under Settings → Features → *Let hive decide*: the hive-wide switch, the LLM step and its model, the effect timeout (empty uses the default; a value must be a duration above zero) and a per-repository table where each repository follows the hive-wide switch or is set on or off. Saving a table edit sends every repository's override, the saved ones included, because `PUT /api/config/decisions/delegate` replaces the map it is sent. The admin MCP operation `decisions.delegate_settings` changes the same settings; the change applies without a restart. The per-repository switch also gates the reviewer-question sweep (`governor.review.auto_decide_questions`), which runs this decision by itself on the hive's own pull requests. See [operator-reference.md](../operator-reference.md). diff --git a/src/docs/hive-merge.md b/src/docs/hive-merge.md index b4bb55f8fa..50b426a0a2 100644 --- a/src/docs/hive-merge.md +++ b/src/docs/hive-merge.md @@ -507,7 +507,17 @@ The same section's **Per-repository merge policy** block edits hive's `project.repos`. Saving writes each key in full as `owner/repo` (the form the sweep matches); an empty selection clears it, and a repo outside `project.repos` or a malformed glob is refused with a 400. The sweep reads all -three live, so a change applies on the next pass without a restart. An +three live, so a change applies on the next pass without a restart. + +The block also edits **Merge with no CI** (`auto_merge.no_ci_ok`): a listed +repository's pull requests can merge with no CI checks at all, because the +merge-request relay counts "no statuses, no check runs and no workflow runs" +as green there. Red or pending CI still blocks. While the deprecated +`auto_merge.allow_unprotected_base` list is set, it is shown too, marked as +having no effect, so an owner can clear it. Saving sends a list only when its +selection changed, and then in full; a bare repository name from `hive.yaml` +shows as that repository selected. The admin MCP changes the same keys with +`auto_merge.update`. An update-branch of an approved PR keeps its swarm approve when the base's changes miss every PR file: the review planner re-stamps the verdict onto the merge head instead of holding it at `review-gate:no-review-bundle`, and CI still diff --git a/src/pkg/adminmcp/tools_config_surface_ops.go b/src/pkg/adminmcp/tools_config_surface_ops.go index f6d8488e76..bb1405cc42 100644 --- a/src/pkg/adminmcp/tools_config_surface_ops.go +++ b/src/pkg/adminmcp/tools_config_surface_ops.go @@ -27,8 +27,9 @@ import ( // ErrConfirmationStale when it no longer matches, so a confirm never // overwrites a change somebody made in between. // -// decisions.delegate ("Let hive decide": enabled, per-repo, llm) has no -// dashboard write endpoint, so it has no operation here. +// decisions.delegate ("Let hive decide": enabled, per-repo, llm, +// effect_timeout) is written through PUT /api/config/decisions/delegate by +// its own operation, decisions.delegate_settings (tools_decisions_ops.go). const ( WriteOpProjectIssueFilter = "project.issue_filter" WriteOpSentinelSettings = "sentinel.settings" diff --git a/src/pkg/dashboard/dashboard_mcp_parity_controls_test.go b/src/pkg/dashboard/dashboard_mcp_parity_controls_test.go new file mode 100644 index 0000000000..3155182461 --- /dev/null +++ b/src/pkg/dashboard/dashboard_mcp_parity_controls_test.go @@ -0,0 +1,140 @@ +package dashboard + +import ( + "strings" + "testing" +) + +// Dashboard controls for settings the admin MCP could already change +// (refs #17555, #17556): auto_merge.no_ci_ok and allow_unprotected_base, +// decisions.delegate repos and effect_timeout, and an agent whose mode is +// NO_GITHUB. Each test runs the shipped JavaScript in node. + +// parityMarkDirtyStub is markDirty plus the state it writes, so a test can +// read what a save would send. +const parityMarkDirtyStub = ` +const assert = require('node:assert/strict'); +const _configState = { dirty: {}, data: {} }; +` + +func TestDashboardParityAutoMergeNoCIAndUnprotectedBaseStageFullLists(t *testing.T) { + html := indexHTML(t) + features := extractJSFunction(t, html, "renderGovFeatures") + for _, want := range []string{ + `id="am-no-ci-ok"`, + "amRepoPolicyOptions(am.no_ci_ok)", + `id="am-allow-unprotected-base"`, + "amRepoPolicyOptions(am.allow_unprotected_base)", + "yamlHint('auto_merge.no_ci_ok')", + "no CI checks at all", + } { + if !strings.Contains(features, want) { + t.Fatalf("Settings → Features → Auto-merge has no %q", want) + } + } + runNodeScript(t, parityMarkDirtyStub+jsFunc(t, html, "markDirty")+"\n"+jsFunc(t, html, "markDirtyAutoMergeRepoPolicy")+` +const selects = { + 'am-squash-only': ['o/a'], + 'am-no-ci-ok': ['o/docs', 'o/site'], + 'am-allow-unprotected-base': [], +}; +const document = { + getElementById: id => selects[id] ? { selectedOptions: selects[id].map(value => ({ value })) } : null, + querySelectorAll: () => [], +}; +global.document = document; + +// Editing another list leaves both keys out of the PUT, so the server keeps them. +markDirtyAutoMergeRepoPolicy.call({ id: 'am-squash-only', classList: { contains: () => false } }); +assert.deepEqual(Object.keys(_configState.dirty['auto-merge']), ['squash_only']); + +// Editing the no-CI list stages the whole selection. +markDirtyAutoMergeRepoPolicy.call({ id: 'am-no-ci-ok', classList: { contains: () => false } }); +assert.deepEqual(_configState.dirty['auto-merge'].no_ci_ok, ['o/docs', 'o/site']); + +// Deselecting every repository clears the deprecated list. +markDirtyAutoMergeRepoPolicy.call({ id: 'am-allow-unprotected-base', classList: { contains: () => false } }); +assert.deepEqual(_configState.dirty['auto-merge'].allow_unprotected_base, []); +`) +} + +func TestDashboardParityDelegateSaveSendsFullReposMapAndEffectTimeout(t *testing.T) { + html := indexHTML(t) + helpers := "" + for _, name := range []string{ + "markDirty", + "markDirtyDecisionsDelegateRepo", + "decisionsDelegateSameRepo", + "decisionsDelegateReposBody", + "decisionsDelegateEffectTimeoutValid", + "decisionsDelegateSaveBody", + "renderGovDecisionsDelegateSection", + } { + helpers += jsFunc(t, html, name) + "\n" + } + runNodeScript(t, parityMarkDirtyStub+` +const esc = s => String(s == null ? '' : s).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); +const yamlHint = k => '[' + k + ']'; +const settingHelpMark = () => '?'; +`+helpers+` +const saved = { 'o/a': { enabled: false }, legacy: { enabled: true } }; +const dd = { enabled: true, repos: saved, project_repos: ['o/a', 'o/b'], effect_timeout: '', effect_timeout_effective: '30m0s', llm: {} }; + +// Rows: every project repository plus the saved override outside project.repos. +const html = renderGovDecisionsDelegateSection(dd); +const rows = html.split(' rows.find(r => r.includes('data-repo="' + repo + '"')) || ''; +assert(row('o/a').includes('