forge_notify: skip-reasons drop-list filter, configurable via agent.nix

This commit is contained in:
damocles 2026-05-22 22:27:40 +02:00 committed by Mara
parent b0f6bd8ece
commit a94b504883
3 changed files with 72 additions and 4 deletions

View file

@ -173,6 +173,31 @@
'';
};
options.hyperhive.forge.skipNotifyReasons = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
example = [
"subscribed"
"participating"
];
description = ''
Forgejo notification `reason` values to suppress in the forge
notification poller. Notifications with these reasons are marked
read and silently dropped; all others including notifications
with a null or unrecognised reason are delivered.
Drop-list is safer than an allow-list: directed signals
(`review_requested`, `assigned`, `mention`) are never silently
missed even if Forgejo returns an unexpected reason string.
Empty list (the default) delivers all notifications. Set to
`[ "subscribed" "participating" ]` for agents like the manager
that want only direct mentions and reviews, not the full repo
firehose. Rendered to the `HIVE_FORGE_NOTIFY_SKIP_REASONS`
environment variable consumed by the harness poller at runtime.
'';
};
options.hyperhive.dashboardLinks = lib.mkOption {
type = lib.types.listOf (lib.types.submodule {
options = {
@ -332,6 +357,8 @@
HIVE_COMPACT_WATERMARK_TOKENS = "0";
} // lib.optionalAttrs config.hyperhive.forge.keepSubscriptions {
HIVE_FORGE_KEEP_SUBSCRIPTIONS = "1";
} // lib.optionalAttrs (config.hyperhive.forge.skipNotifyReasons != [ ]) {
HIVE_FORGE_NOTIFY_SKIP_REASONS = lib.concatStringsSep "," config.hyperhive.forge.skipNotifyReasons;
};
boot.isNspawnContainer = true;

View file

@ -2,9 +2,15 @@
{
imports = [ ./harness-base.nix ];
# Manager auto-unsubscribes from repo watches (uses mention-only filtering
# via HIVE_FORGE_NOTIFY_REASONS). Sub-agents default to keepSubscriptions=true.
# Manager auto-unsubscribes from repo watches and skips the subscription/
# participation firehose — only direct mentions, reviews, and assignments
# land in the inbox. Sub-agents default to keepSubscriptions=true and
# skipNotifyReasons=[].
hyperhive.forge.keepSubscriptions = false;
hyperhive.forge.skipNotifyReasons = [
"subscribed"
"participating"
];
# HIVE_PORT/HIVE_LABEL/gitconfig are also injected by the generated
# `applied/hm1nd/flake.nix` (see `lifecycle::setup_applied`); the values