feat(discord): binding reload without a restart, and a per-user channel allowlist (#1509)

`reload` validates the binding file and sends SIGHUP to the live owner;
the running connector re-reads it and swaps guildName, channels, users
and limits in place. name, seat, guildId, botUserId, tokenFile, engine
and context are fixed for the life of the process; a change there, an
invalid file or a channel outside the guild refuses the reload and keeps
the old binding. Every attempt is one line in reloads.jsonl. The service
unit maps `systemctl --user reload` to the same signal.

A user entry may carry `channels`, an allowlist of listed channel ids;
absent means every listed channel. Outside the list the message is
dropped as channel-not-for-user; threads count as their parent.

Suite 41/41, 101 node tests. QUEUE rows 19 and 20 opened.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
2026-09-13 18:59:31 -05:00
co-authored by Claude Fable 5.1
parent d9745a4510
commit caaef941e6
16 changed files with 326 additions and 21 deletions
@@ -20,6 +20,10 @@ Environment=PATH=@PATH@
# the main process on purpose: systemd honours RestartPreventExitStatus only
# for the main process, so a refusing ExecStartPre would loop.
ExecStart=@REPO@/scripts/discord.sh run %i --supervised
# `systemctl --user reload` re-reads the binding in place (channels, users,
# limits); the connector refuses and keeps the old binding when the file is
# invalid or a fixed key changed. See reloads.jsonl under the journal.
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=15
RestartPreventExitStatus=3