Skip to content

✨ feat(config): one repository can override Sentinel's sensitive paths and the workflow fence scope - #17547

Merged
hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:feat/repo-policy-sentinel-fence-overrides
Nov 10, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:feat/repo-policy-sentinel-fence-overrides

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

Summary

Two merge-safety settings, Sentinel's sensitive-path list and the contributor lane's workflow fence scope, can only be set for the whole hive today. An operator who wants to relax them for their own repositories would also relax them for repositories that belong to other maintainers. This PR adds two opt-in per-repository keys under project.repo_policies. A repository without them behaves exactly as before. Settings, settings_read and the admin MCP Sentinel preview show which repositories have their own value.

Why

On the projectbluefin hive the operator wants Sentinel to stop flagging lockfiles, requirements*.txt and Justfile, and wants workflow_fence_scope: human_merge_paths. Both keys apply to every repository today, including utah and utah-packages, whose maintainer has not agreed to that. There is currently no way to change them for only some repositories. The live hive runs 0b22971 (the current v6 tip) with workflow_fence_scope: all and the shipped Sentinel defaults, and it has no per-repository override.

What changes

  • New keys: project.repo_policies[].sentinel_sensitive_paths and project.repo_policies[].workflow_fence_scope (all or human_merge_paths). A repository's own value replaces the hive-wide one, whether it is stricter or looser. A later hive-wide change does not affect a repository that has its own value.
  • Same meaning as the hive-wide key: an explicit sentinel_sensitive_paths: [] matches nothing. A human_merge_paths override still keeps the full fence when the repository has no human_merge_paths entry.
  • Where it applies: Sentinel resolves the list for each pull request's own repository. The contributor lane resolves the scope the same way. The lane, the stage notes, the merge asks and /hive approve all read the same per-repository scope.
  • Fails closed: a blank glob or an unknown scope is rejected when the config loads. If an invalid value reaches the running config anyway, it is ignored and the hive-wide value applies. Clearing a different override on a repository no longer deletes these two (repoPolicyHasNoOverrides).
  • Where you can see it: Settings → Security → Suspicious Activity and Settings → Features → Auto Merge list the overrides read-only. They are also in GET /api/config/governor (security.sentinel.repoSensitivePaths) and in GET /api/config/auto-merge (contributor_lane.workflow_fence_scope_repos), which settings_read returns. The admin MCP sentinel.settings preview names the repositories that keep their own list, along with the hive-wide globs those lists leave out, in its effects and in the widening disclosure. The override lists are part of the preview fingerprint, so a confirm is refused if an override changed after the preview.
  • Not included in this PR: a dashboard or MCP control for writing the overrides. They are set in hive.yaml, the same way as max_open_held_prs and red_main_threshold.

Files

  • src/pkg/config/repo_policy_sentinel_fence.go (new): the resolvers, validators and override lists. repo_policy.go and validate.go get the fields, the prune check and the load-time validation.
  • src/pkg/github/sentinel_sweep.go, src/cmd/hive/main_sweeps.go: Sentinel uses the list for each repository.
  • src/pkg/github/automerge/automerge_workflow_fence_scope.go, automerge_contributor_lane.go, src/cmd/hive/merge_eligibility.go: the fence uses the scope for each repository.
  • src/pkg/dashboard/api_governor_security.go, api_config_automerge.go, the static UI (source and built index.html): read-only display.
  • src/pkg/adminmcp/tools_config_surface_ops.go, tools_settings.go: the MCP preview, disclosure and fingerprint.
  • Docs: operator-reference/README.md, operator-reference/sweeps-and-operations.md, hive-merge.md, admin-mcp.md. Changelog fragment added-repo-policy-sentinel-fence-overrides.md.

Tests

None of these were run locally (AGENTS.md); CI is the verdict.

  • TestRepoSentinelSensitivePathsResolvesPerRepo, TestRepoWorkflowFenceScopeResolvesPerRepo: an override present, absent, explicit empty and invalid. A hive-wide change does not reach an overridden repository.
  • TestValidateRepoSentinelFenceOverrides, TestRepoPolicySentinelFenceOverridesCountAsOverrides: validation, and the trap where an override is pruned on save.
  • TestContributorLaneWorkflowFenceScopeRepoOverride: the real lane loosened and tightened by an override. Another repository's override does not apply. A human_merge_paths override without human_merge_paths keeps the full fence.
  • TestSweepSentinelPerRepoSensitivePaths: a real Sentinel sweep where a requirements.txt change is flagged or not, depending on the repository's own list.
  • TestRepoPolicySentinelFenceOverridesShownInSettings: both GET responses list the overrides, and a hive-wide Sentinel save leaves a repository's own list alone.
  • TestSentinelSettingsOpNamesReposWithTheirOwnList, TestSentinelSettingsOpRepoOverrideChangeMakesPreviewStale: the MCP disclosure names the repositories, and a changed override makes the confirm stale.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

…s and the workflow fence scope

Add two opt-in project.repo_policies keys:

- sentinel_sensitive_paths replaces sentinel.sensitive_paths for that
  repository's pull requests (nil inherits; an explicit [] matches
  nothing, as the hive-wide key does).
- workflow_fence_scope ("all" | "human_merge_paths") replaces
  auto_merge.contributor_lane.workflow_fence_scope for that repository.

Either can be stricter or looser than the hive-wide value, and a
hive-wide change does not reach a repository that has its own. Sentinel
resolves the list per PR repository (SentinelSweepOptions
.SensitivePathsForRepo); the contributor lane resolves the scope per PR
repository (ContributorLanePolicy.WorkflowFenceScopeForRepo), so the
lane, stage notes, merge asks and /hive approve all agree. A
human_merge_paths override still keeps the full fence for a repository
with no human_merge_paths entry.

Fail closed: Validate rejects a blank pattern or unknown scope, and the
resolvers treat an invalid override as unset. repoPolicyHasNoOverrides
counts both keys, so clearing another override does not prune them.

Read visibility: Settings → Security and Settings → Features → Auto
Merge list the overrides; GET /api/config/governor returns
security.sentinel.repoSensitivePaths and GET /api/config/auto-merge
returns contributor_lane.workflow_fence_scope_repos (settings_read). The
admin MCP sentinel.settings preview names the repositories with their
own list and what those lists leave out, and fingerprints them so a
changed override makes the confirm stale. Write path: hive.yaml.

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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 10, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kellyaa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

Conflicts are checked with every PR merged onto the current tip of v6, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#17546 ✨ feat(github): file one [shared-ci] tracking issue when a check fails across a repo same files src/docs/operator-reference/sweeps-and-operations.md
#17549 🐛 fix(adoption): name the branch update a person must run when a fork PR is blocked by base workflow changes same files src/docs/hive-merge.md
#17506 🌱 Top up v6 with v5 (durable hosted hive.yaml, shared-CI deferral naming and 118 more) same files src/cmd/hive/merge_eligibility.go
src/docs/hive-merge.md
src/docs/operator-reference/README.md
src/docs/operator-reference/sweeps-and-operations.md
src/pkg/dashboard/static/index.html
src/pkg/github/automerge/automerge_contributor_lane.go

@hivecommons-hive
hivecommons-hive Bot merged commit ce65df8 into hivecommons:v6 Nov 10, 2026
71 of 72 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

Evidence bundle `#1754730dacbf` sha256:b972f2693c58efb9087f7f2385101cda915629558823acdcccafb15526a99542 — download from the dashboard or `hivectl review evidence #17547`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @Danathar holds role owner and GitHub permission maintain on repo; CI green at 30dacbf.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision needed: @clubanderson should decide whether a project.repo_policies entry may make Sentinel and the workflow fence looser than the hive-wide setting (including sentinel_sensitive_paths: [] which disables Sentinel path matching for that repository), or whether per-repo overrides should only be allowed to tighten.

I read the diff against v6 and the wiring is sound; I am routing this to a person because it changes who can relax two merge-safety controls, not because I found a defect.

What I verified

  • Resolution is per PR repository, as the body says: main_sweeps.go:1410 → cfg.RepoSentinelSensitivePaths(repo) feeds SentinelSweepOptions.SensitivePathsForRepo, applied in sentinel_sweep.go:95-96; merge_eligibility.go:117,127 → cfg.RepoWorkflowFenceScope(repo) feeds ContributorLanePolicy.WorkflowFenceScopeForRepo, read by workflowFenceScopedToHumanMergePaths (automerge_workflow_fence_scope.go:56-61) and in the fence cache key (:126-130), so a per-repo scope cannot be served from another repo's cached fence result.
  • RepoPolicyFor (repo_policy.go:97-111) normalises both sides through repoPauseKey(org, …), so owner/repo and bare repo match the same entry.
  • Fail-closed on bad input: Validate rejects blank patterns / unknown scope, and the resolvers re-validate and fall back to the hive-wide value if an invalid entry reaches a live config (repo_policy_sentinel_fence.go:32-48).
  • Unset keys reproduce today's behaviour (rp.SentinelSensitivePaths == nil → c.Sentinel.EffectiveSensitivePaths()).

The decision a person has to make

repo_policy_sentinel_fence.go:32-36 returns an explicit sentinel_sensitive_paths: [] as an empty list, which matches nothing — i.e. one repo_policies entry can switch Sentinel's path alerting off for a repository and set workflow_fence_scope: human_merge_paths there. The PR body states this is intended ("stricter or looser"). That is a policy call on a trust surface: whether the operator-writable repo_policies config should be able to weaken Sentinel/fence below the hive-wide floor per repository, versus override-only-to-tighten. I cannot settle that. If "looser is fine", the code does what it says and I have no further findings; if not, RepoSentinelSensitivePaths/RepoWorkflowFenceScope need a floor check and the docs/dashboard copy should say so.

Not a defect, for completeness: the PR's motivating case (projectbluefin wanting lockfiles / Justfile unflagged on their own repos) is served either way; the question only affects what the override is allowed to do.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

Danathar added a commit to Danathar/hive that referenced this pull request Nov 10, 2026
…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>
hivecommons-hive Bot pushed a commit that referenced this pull request Nov 10, 2026
…e scope from the dashboard and admin MCP (#17556)

* ✨ feat(settings): set per-repository Sentinel paths and workflow fence scope from the dashboard and admin MCP

#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 #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>

* 🐛 fix(dashboard): one control carries the per-repo fence scope key, so settings search resolves it

The read-only overrides note from #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>

---------

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant