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/fixed-dashboard-mcp-parity-controls.md
Original file line number Diff line number Diff line change
@@ -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).
2 changes: 2 additions & 0 deletions src/docs/agent-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/docs/dashboard-sections/activity-monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<owner/repo>.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.<owner/repo>.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).

Expand Down
12 changes: 11 additions & 1 deletion src/docs/hive-merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/pkg/adminmcp/tools_config_surface_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
140 changes: 140 additions & 0 deletions src/pkg/dashboard/dashboard_mcp_parity_controls_test.go
Original file line number Diff line number Diff line change
@@ -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, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
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('<tr class="dd-repo-row"').slice(1);
assert.equal(rows.length, 3, html);
const row = repo => rows.find(r => r.includes('data-repo="' + repo + '"')) || '';
assert(row('o/a').includes('<option value="off" selected>'), row('o/a'));
assert(row('o/b').includes('<option value="" selected>'), row('o/b'));
assert(row('legacy').includes('<option value="on" selected>'), row('legacy'));
assert(html.includes('[decisions.delegate.effect_timeout]'), html);
assert(html.includes('placeholder="30m0s"'), html);

// An untouched save (another field changed) sends no repos key: the server keeps the map.
assert.deepEqual(decisionsDelegateSaveBody({ enabled: false }, saved), { enabled: false });

// One row edit sends every saved override plus the edit, never the edited row alone.
markDirtyDecisionsDelegateRepo('o/b', 'on');
const body = decisionsDelegateSaveBody(_configState.dirty['decisions-delegate'], saved);
assert.deepEqual(body.repos, { 'o/a': { enabled: false }, legacy: { enabled: true }, 'o/b': { enabled: true } });

// A row set back to hive-wide drops out; a bare saved key is replaced, not duplicated.
markDirtyDecisionsDelegateRepo('o/a', '');
markDirtyDecisionsDelegateRepo('legacy', 'off');
const body2 = decisionsDelegateSaveBody(_configState.dirty['decisions-delegate'], saved);
assert.deepEqual(body2.repos, { legacy: { enabled: false }, 'o/b': { enabled: true } });

// effect_timeout is validated like the server: a duration above zero, or empty.
assert.equal(decisionsDelegateSaveBody({ effect_timeout: ' 45m ' }, saved).effect_timeout, '45m');
assert.equal(decisionsDelegateSaveBody({ effect_timeout: '' }, saved).effect_timeout, '');
assert.throws(() => decisionsDelegateSaveBody({ effect_timeout: 'soon' }, saved), /above zero/);
assert.throws(() => decisionsDelegateSaveBody({ effect_timeout: '0s' }, saved), /above zero/);
`)
}

func TestDashboardParityOperatingModeShowsNoGitHub(t *testing.T) {
html := indexHTML(t)
block := indexSliceBetween(t, html, "<label>Operating Mode", "})()")
start := strings.Index(block, "(() => {")
if start < 0 {
t.Fatal("Operating Mode select is no longer built by an inline function")
}
selectFn := block[start:] + "})()"
emojis := indexSliceBetween(t, html, "const MODE_EMOJIS", "\n")
runNodeScript(t, `
const assert = require('node:assert/strict');
`+emojis+"\n"+jsFunc(t, html, "modeEmoji")+`
global.window = { _lastStatus: { agents: [] } };
const agentName = 'scanner';
function render(mode) { const g = { mode }; return `+selectFn+`; }

const legacy = render('NO_GITHUB');
assert(legacy.includes('<option value="NO_GITHUB" selected>'), legacy);
assert(!legacy.includes('<option value="" selected>'), legacy);
assert.equal(modeEmoji('NO_GITHUB'), modeEmoji('ADVISORY'));

// The legacy alias is not offered to an agent that does not have it.
assert(!render('ADVISORY').includes('NO_GITHUB'));
`)
}
2 changes: 0 additions & 2 deletions src/pkg/dashboard/settings_parity_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ agents.session_recycle.max_age # TODO #11854
agents.session_recycle.max_rss_mb # TODO #11854
agents.session_recycle.min_idle # TODO #11854
auto_merge.credit_issue_authors # merge-time Co-authored-by credit (#14581); yaml-only
auto_merge.allow_unprotected_base[] # TODO #11854
auto_merge.human_merge_title_prefixes[] # breaking-titled PRs wait for a human; yaml-only
auto_merge.human_merge_labels[] # needs-owner-merge PRs wait for a human; yaml-only
auto_merge.merge_forward_trusted_human[] # TODO #11854
Expand All @@ -168,7 +167,6 @@ auto_merge.native_merge_queue.probe_ttl # merge-queue probe cache TTL (#15198);
auto_merge.native_merge_queue.repos[] # native merge queue per-repo allow-list (#15198); yaml-only
auto_merge.native_merge_queue.skip_current_base_gate # explicit current-base bypass on queue bases (#15198); yaml-only
auto_merge.hive_superseding.auto_merge # hive-authored superseding PRs auto-merge without an operator decision; yaml-only
auto_merge.no_ci_ok[] # TODO #11854
auto_merge.queue_on_approve_and_unhold[] # per-repo L5 opt-in; yaml-only (#13629)
auto_merge.repos.<key>.required_checks[] # TODO #11854
auto_merge.required_checks[] # TODO #11854
Expand Down
9 changes: 6 additions & 3 deletions src/pkg/dashboard/static-src/js/config-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,15 @@
</div>
</div>
<div class="config-field">
<label>Operating Mode ${settingHelpMark('agent-configuration', 'anatomy-of-an-agent', 'Operating Mode', `Controls what GitHub actions this agent can take. ADVISORY: beads only. ISSUES_ONLY: open issues, no PRs. ISSUES_AND_PRS: issues + PRs. ISSUES_PRS_MERGE: full auto-merge. Leave blank to use the ACMM level default.`)}</label>
<label>Operating Mode ${settingHelpMark('agent-configuration', 'anatomy-of-an-agent', 'Operating Mode', `Controls what GitHub actions this agent can take. ADVISORY: beads only. ISSUES_ONLY: open issues, no PRs. ISSUES_AND_PRS: issues + PRs. ISSUES_PRS_MERGE: full auto-merge. NO_GITHUB: the legacy name for ADVISORY, which the API and the admin MCP still accept; listed only for an agent that has it. Leave blank to use the ACMM level default.`)}</label>
${(() => {
const allModes = ['ADVISORY','ISSUES_ONLY','ISSUES_AND_PRS','ISSUES_PRS_MERGE'];
const current = g.mode || '';
// NO_GITHUB is a legacy alias for ADVISORY. It is offered only when
// the agent already has it, so the select shows the real mode
// instead of falling back to the level default.
const allModes = ['ADVISORY','ISSUES_ONLY','ISSUES_AND_PRS','ISSUES_PRS_MERGE'].concat(current === 'NO_GITHUB' ? ['NO_GITHUB'] : []);
const statusAgent = ((window._lastStatus || {}).agents || []).find(sa => sa.name === agentName);
const dflt = statusAgent ? statusAgent.defaultMode : '';
const current = g.mode || '';
return '<select id="cfg-agent-mode" data-change-action="markDirty" data-arg0="general" data-arg1="mode" data-arg-types="s,s,v">'
+ '<option value=""' + (!current ? ' selected' : '') + '>β€” use level default' + (dflt ? ' (' + modeEmoji(dflt) + ' ' + dflt + ')' : '') + '</option>'
+ allModes.map(m => '<option value="' + m + '"' + (current === m ? ' selected' : '') + '>' + modeEmoji(m) + ' ' + m + (m === dflt ? ' (default)' : '') + '</option>').join('')
Expand Down
Loading
Loading