Repository navigation
✨ feat(settings): set per-repository Sentinel paths and workflow fence scope from the dashboard and admin MCP - #17556
Conversation
…e scope from the dashboard and admin MCP hivecommons#17547 added project.repo_policies[].sentinel_sensitive_paths and workflow_fence_scope, but they could only be set by editing hive.yaml, which a hub-managed hive cannot do. This adds the write surface: - PUT/PATCH /api/config/auto-merge takes contributor_lane.workflow_fence_scope_repos ({owner/repo: "all" | "human_merge_paths" | null}) and PUT /api/config/governor/security takes sentinel.repoSensitivePaths ({owner/repo: [globs] | null}). Per repository: null clears, an absent repository is untouched, the hive-wide value and the policy's other fields never change. Owner only, validated before anything changes (watched repo, the loader's rules plus malformed globs), audited per repository. Requests without the keys behave as before. - Settings gets a per-repository table in Auto Merge and in Security → Suspicious Activity, with help marks; static/index.html regenerated by the manifest concatenation. - auto_merge.update and sentinel.settings take the two keys, send only the changed repositories, name what loosens per repository, remind that a repository without human_merge_paths keeps the full fence, fingerprint what the disclosure read, and refuse a hive whose GET does not report the write as settable. - RepoPolicy.MarshalYAML keeps an explicit empty sentinel_sensitive_paths, which omitempty dropped, so a saved "flag no path" no longer comes back as the hive-wide list after a reload. Refs hivecommons#17547 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@Danathar this PR is back in your court ( Review asks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Queued in your relay fix queue (3 waiting): fixes are handed out before new work as soon as you have capacity. |
…o settings search resolves it The read-only overrides note from hivecommons#17547 and the new per-repository table both carried yamlHint('project.repo_policies[].workflow_fence_scope'), so TestSettingsSearchIndexResolvesToControls found two innermost rows. The note keeps its text; the table row keeps the key. static/index.html edited identically (manifest concatenation cmp-identical). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
There was a problem hiding this comment.
Intent-alignment review (head 3ca85d6, read the diff plus api_governor_security.go, api_config_automerge.go, repo_policy.go, repo_policy_sentinel_fence.go at head).
The PR delivers what the title and body describe: both endpoints take the new keys, validate watched repos / scopes / globs, audit per repository, expose the …Settable flags, and the MCP ops gate on them. repoPolicyHasNoOverrides is nil-aware (repo_policy.go:428), so the explicit [] override survives the prune in editRepoSentinelFencePolicyLocked. The MarshalYAML fix is tightly coupled to the [] semantics and not scope creep. One gap against the stated contract:
1. Security endpoint: "a refused request changes nothing" does not hold for repoSensitivePaths (in-scope, medium)
api_governor_security.go:183-193 applies cfg.SetRepoSentinelSensitivePaths first, with the comment "they are the only write here that can still be refused". But two pre-existing refusals sit after it in the apply phase: invalid agentSandboxRuntime (:276-281) and sandbox timeouts must be >= 0 (:284-287). A single Security-page save that carries a valid per-repo list and, say, a negative sandbox timeout returns 400 while the in-memory cfg.Project.RepoPolicies already holds the new Sentinel list — and that is the config Config.RepoSentinelSensitivePaths (repo_policy_sentinel_fence.go:29-35) reads live. Nothing is persisted and no audit line is written, so the running hive silently diverges from hive.yaml until the next reload. The other writes in that block have the same pre-existing partial-apply shape, but this PR's body and comment explicitly promise atomicity for the new key, and the new tests do not exercise a mixed request.
Smallest fix: hoist the two sandbox checks into the validate phase (before cfg := s.deps.Config at :182) so the setter really is the last possible refusal.
@@ api_governor_security.go (validate phase, before `cfg := s.deps.Config`)
+ if rt := body.SandboxRuntime; rt != nil {
+ if v := strings.TrimSpace(*rt); v != "" && !config.ValidSandboxRuntimes[v] {
+ http.Error(w, "invalid agentSandboxRuntime", http.StatusBadRequest)
+ return
+ }
+ }
+ if body.SandboxTimeoutS != nil && *body.SandboxTimeoutS < 0 || body.SandboxJobTTLSeconds != nil && *body.SandboxJobTTLSeconds < 0 {
+ http.Error(w, "sandbox timeouts must be >= 0", http.StatusBadRequest)
+ return
+ }
cfg := s.deps.Config
@@ apply phase
if rt := body.SandboxRuntime; rt != nil {
- v := strings.TrimSpace(*rt)
- if v != "" && !config.ValidSandboxRuntimes[v] {
- http.Error(w, "invalid agentSandboxRuntime", http.StatusBadRequest)
- return
- }
- cfg.AgentSandbox.Runtime = v
+ cfg.AgentSandbox.Runtime = strings.TrimSpace(*rt)
}
- if body.SandboxTimeoutS != nil && *body.SandboxTimeoutS < 0 || body.SandboxJobTTLSeconds != nil && *body.SandboxJobTTLSeconds < 0 {
- http.Error(w, "sandbox timeouts must be >= 0", http.StatusBadRequest)
- return
- }A test pairing sentinel.repoSensitivePaths with agentSandboxJobTtlSeconds: -1 and asserting RepoPolicies is unchanged would pin it. The auto-merge handler has no such post-apply refusal (api_config_automerge.go:366-373 onward), so the fence-scope path is fine.
— hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Open PR overlap checkBase branch:
Conflicts are checked with every PR merged onto the current tip of
|
Keep both admin-mcp design notes: sentinel.settings' repo_sensitive_paths and hivecommons#17555's agent.cadences / writeback.kind_policy bullet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
There was a problem hiding this comment.
Read the config setters, both dashboard handlers and their callers at the PR head (0e227fe) against v6 merge-base 33d4832. This looks correct to me.
Verified
src/pkg/config/repo_policy_sentinel_fence_write.go:150-175—editRepoSentinelFencePolicyLockedfollows the existingrepoPolicyHasNoOverridesprune pattern atrepo_policy.go:390-415and holdsrepoPauseMuthe same way; an entry with onlyforge/forge_urlsurvives a clear.repo_policy_sentinel_fence_write.go:191-208—RepoPolicy.MarshalYAMLfires onConfig.Save(config/save.go:110isgopkg.in/yaml.v3), and theplainalias avoids recursion. yaml.v3 decodes[]into a non-nil empty slice, so the explicit-empty round trip the PR describes holds.- Both handlers are owner-gated (
api_config_automerge.go:140,api_governor_security.go:20), validate the full batch before mutating, and apply the per-repo write first so a refused request changes nothing. api_config_automerge.go:510-516rolls the policies back on a persist failure. The security handler does not (api_governor_security.go:331-333), but that matches the pre-existing behaviour of every other field in that handler, so I am not counting it as a defect.- Body claims match the diff;
Refs #17547is appropriate since #17547 is the PR that added the keys, not an open issue.
One low-severity edge (suggestion, not a blocker)
src/pkg/dashboard/static-src/js/config-helpers.js:177 — in the Sensitive-files-per-repository row, mode own with an empty textarea sends [], which the server stores as "flag no path in this repository" — the same widening as choosing flag no paths, but without the user having picked it. An owner who switches to own list, gets distracted, and saves would silently disable Sentinel path checks for that repo. Either treat own + empty as "not staged yet" (skip the key) or have the row refuse to stage until a glob is entered.
Nothing else I could verify.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Correctness re-review at 407dd29 (delta since 3ca85d6: one branch commit 0e227fe plus a merge of Still present —
So a body with valid Fix: hoist the two sandbox checks into the validation block that already runs before any mutation (next to the @@ src/pkg/dashboard/api_governor_security.go
if body.ReviewMaxParallel != nil && (*body.ReviewMaxParallel < 0 || *body.ReviewMaxParallel > 64) {
jsonError(w, "review max_parallel_reviews must be between 0 and 64", http.StatusBadRequest)
return
}
+ if rt := body.SandboxRuntime; rt != nil {
+ if v := strings.TrimSpace(*rt); v != "" && !config.ValidSandboxRuntimes[v] {
+ http.Error(w, "invalid agentSandboxRuntime", http.StatusBadRequest)
+ return
+ }
+ }
+ if body.SandboxTimeoutS != nil && *body.SandboxTimeoutS < 0 || body.SandboxJobTTLSeconds != nil && *body.SandboxJobTTLSeconds < 0 {
+ http.Error(w, "sandbox timeouts must be >= 0", http.StatusBadRequest)
+ return
+ }
cfg := s.deps.Config
@@
if rt := body.SandboxRuntime; rt != nil {
- v := strings.TrimSpace(*rt)
- if v != "" && !config.ValidSandboxRuntimes[v] {
- http.Error(w, "invalid agentSandboxRuntime", http.StatusBadRequest)
- return
- }
- cfg.AgentSandbox.Runtime = v
+ cfg.AgentSandbox.Runtime = strings.TrimSpace(*rt)
}
- if body.SandboxTimeoutS != nil && *body.SandboxTimeoutS < 0 || body.SandboxJobTTLSeconds != nil && *body.SandboxJobTTLSeconds < 0 {
- http.Error(w, "sandbox timeouts must be >= 0", http.StatusBadRequest)
- return
- }A test in The branch-only delta (0e227fe: single Review findings from Read the new config setters, both dashboard handlers, and their callers at Finding (medium) — The new block applies
Mechanism: a request carrying a valid The auto-merge handler does not have this gap — I checked Fix is small: hoist the two sandbox checks above Verified correct, for the record:
I did not read the admin MCP ops or the JS/ Review findings from Security re-review at 407dd29 (delta from 3ca85d6). The PR's own delta is one line in Prior finding still present — @@ -177,6 +177,15 @@
if body.ReviewMaxParallel != nil && (*body.ReviewMaxParallel < 0 || *body.ReviewMaxParallel > 64) {
jsonError(w, "review max_parallel_reviews must be between 0 and 64", http.StatusBadRequest)
return
}
+ if rt := body.SandboxRuntime; rt != nil {
+ if v := strings.TrimSpace(*rt); v != "" && !config.ValidSandboxRuntimes[v] {
+ http.Error(w, "invalid agentSandboxRuntime", http.StatusBadRequest)
+ return
+ }
+ }
+ if body.SandboxTimeoutS != nil && *body.SandboxTimeoutS < 0 || body.SandboxJobTTLSeconds != nil && *body.SandboxJobTTLSeconds < 0 {
+ http.Error(w, "sandbox timeouts must be >= 0", http.StatusBadRequest)
+ return
+ }and delete the two Review findings from Delta re-review (3ca85d6 → 407dd29, intent-alignment). The delta is the Still present (blocks): Fix: validate the sandbox fields alongside the other pre-mutation checks (next to @@ src/pkg/dashboard/api_governor_security.go
if body.ReviewMaxParallel != nil && (*body.ReviewMaxParallel < 0 || *body.ReviewMaxParallel > 64) {
jsonError(w, "review max_parallel_reviews must be between 0 and 64", http.StatusBadRequest)
return
}
+ if rt := body.SandboxRuntime; rt != nil {
+ if v := strings.TrimSpace(*rt); v != "" && !config.ValidSandboxRuntimes[v] {
+ http.Error(w, "invalid agentSandboxRuntime", http.StatusBadRequest)
+ return
+ }
+ }
+ if body.SandboxTimeoutS != nil && *body.SandboxTimeoutS < 0 || body.SandboxJobTTLSeconds != nil && *body.SandboxJobTTLSeconds < 0 {
+ http.Error(w, "sandbox timeouts must be >= 0", http.StatusBadRequest)
+ return
+ }
cfg := s.deps.Config
@@
if rt := body.SandboxRuntime; rt != nil {
- v := strings.TrimSpace(*rt)
- if v != "" && !config.ValidSandboxRuntimes[v] {
- http.Error(w, "invalid agentSandboxRuntime", http.StatusBadRequest)
- return
- }
- cfg.AgentSandbox.Runtime = v
+ cfg.AgentSandbox.Runtime = strings.TrimSpace(*rt)
}
- if body.SandboxTimeoutS != nil && *body.SandboxTimeoutS < 0 || body.SandboxJobTTLSeconds != nil && *body.SandboxJobTTLSeconds < 0 {
- http.Error(w, "sandbox timeouts must be >= 0", http.StatusBadRequest)
- return
- }A test that sends Out of PR scope: the delta's |
…ge (#17560) 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 Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com> Co-authored-by: Danathar <Danathar@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Summary
An owner can now set, change and clear one repository's Sentinel sensitive-path list and contributor-lane workflow fence scope from Settings and through the admin MCP, without editing hive.yaml. Refs #17547, which added these two per-repository keys but left them hive.yaml-only. A hub-managed hive like knuckle cannot edit its YAML by hand. Every change is per repository and additive. A request without the new keys behaves exactly as before. The hive-wide values and a policy's other fields are never touched.
Why
The owner wants the fence scope at
human_merge_pathson three repositories only (dakota-iso, finpilot, testsuite). They also want Sentinel to stop flagging lockfiles, requirements and the Justfile only in repositories whose maintainer agrees. utah and utah-packages stay on the hive-wide values. #17547 can express that. Until now, nobody could set it on a hosted hive.What changes
PUT/PATCH /api/config/auto-mergetakescontributor_lane.workflow_fence_scope_repos:{owner/repo: "all" | "human_merge_paths" | null}.PUT /api/config/governor/securitytakessentinel.repoSensitivePaths:{owner/repo: [globs] | null}.[]means flag no path in that repository.nullclears an override, so the repository uses the hive-wide value again. A repository that is not named stays as it is.myorg/a: hive-wide → human_merge_paths.…Settable: trueflag, so the admin MCP can tell this build from one that only reads the overrides.auto_merge.updateandsentinel.settingstake the same keys and send only the repositories that change.human_merge_pathsentry keeps the full fence, and names which of the repositories in the change have none.sentinel_sensitive_pathsisomitempty, so on tip a saved[](flag no path) came back as unset (the hive-wide list) after the next reload. That also applies to a hand-written[]after any dashboard save.RepoPolicy.MarshalYAMLnow keeps an explicit empty list. Every other policy marshals unchanged.Files
src/pkg/config/repo_policy_sentinel_fence_write.go: the two batch setters, glob normalization,MarshalYAML.src/pkg/dashboard/api_config_automerge.go,api_governor_security.go: request keys, validation, audit detail,…Settableflags.src/pkg/adminmcp/tools_automerge_fence_repos.go,tools_sentinel_repo_paths_write.go, plus small hooks intools_automerge_ops.goandtools_config_surface_ops.go.static-src/js/config-features.js,config-helpers.js,config-watchdog-security.js.static/index.htmlwas regenerated by concatenatingmanifest.txtin order, and is byte-identical to that output.admin-mcp.md,hive-merge.md, the API reference (both copies),operator-reference,design/admin-mcp.md. Changelog fragment.Tests
None were run locally; CI is the verdict.
forge_urlsurvives a clear. An empty entry is pruned. The hive-wide values stay as they are. A bad scope, a blank glob or a malformed glob refuses the whole batch. An explicit[]survives a YAML round trip.auto_mergeon the same entry, and write the audit detail. They refuse an unknown or empty scope, an unwatched repository, a repository named twice, blank and malformed globs, and a non-owner, and a refused request changes nothing. A request without the new keys leaves the policies and the audit detail as they were.🤖 Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1