Repository navigation
Local, gitignored lists of users never to upvote / never to downvote - #21
Merged
jackparnell merged 1 commit intoAug 15, 2026
Merged
Conversation
Two optional plain-text files on the sentinel's own filesystem —
never_upvote.txt and never_downvote.txt — name users this instance must
not vote on. Both are gitignored; committed .example templates document
the format. One username per line, # comments, a leading @ stripped,
case-insensitive.
The lists are independent on purpose. "Never downvote" is the common
case (don't let a local model penalise a trusted account unattended);
"never upvote" is the arm's-length case (don't let the sentinel boost an
account you're associated with). Collapsing them into one "never vote"
list would remove the ability to express either alone.
Enforced twice, which is the part that isn't obvious:
* _pending_actions applies the lists LAST, after the score floor and
the ads-colony carve-out, so an exempt vote is never even queued.
* _apply_action re-checks at apply time. A vote that failed with a 502
is persisted to _pending_actions and replayed on a later run — days
later, possibly after the operator listed that author. Checking only
at decision time would cast exactly the vote they asked us never to
cast. The replayed vote now carries its author for this reason, and
a suppression returns True (resolved), not False, which would
re-queue the forbidden vote for five more attempts.
The exemption suppresses the vote and nothing else: a JUNK post by a
listed user is still marked junk, language-tagged, PII-flagged and
marked scanned. --no-vote remains the switch for the whole family.
Files are re-read whenever they change (cached on mtime+size), so an
operator can add a name while a long-running webhook process is up. Both
modes log the ABSOLUTE path consulted at startup — "no exemptions" and
"the list is in the wrong directory" are otherwise indistinguishable,
and the second only surfaces by watching the sentinel vote on someone it
was told not to.
One bounded gap, documented rather than hidden: a vote persisted by a
sentinel older than this change carries no author, so it can't be
re-checked when it replays and is cast. The pending queue drains in 5
attempts, so it spans only the first runs after upgrade.
Tests: 30 new cases in tests/test_vote_exemptions.py covering parsing,
disk loading, hot reload, list independence, the pipeline, the replay
path, and the startup announcement. All 13 mutants of the new guards
(suppression removed, lists swapped, one list used for both directions,
case-folding dropped, @-strip dropped, comment-strip dropped, cache
never invalidated, author not stamped, True flipped to False, ...) were
verified to fail the suite.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pxqw6ZyFv5f4rt5HFwtafs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds two optional plain-text files on the sentinel's own filesystem naming users this instance must not vote on:
never_upvote.txtnever_downvote.txtBoth gitignored; committed
.exampletemplates document the format. One username per line,#comments (whole-line or trailing), a leading@stripped so a pasted mention works, case-insensitive.The lists are independent on purpose
"Never downvote" is the common case — don't let a local model penalise a trusted account unattended. "Never upvote" is the arm's-length case — don't let the sentinel boost an account you're associated with, which reads as vote manipulation. They point in opposite directions, so collapsing them into one "never vote" list would remove the ability to express either alone. Exempting someone from voting entirely means listing them in both files.
Enforced twice
_pending_actionsapplies the lists last — after theUPVOTE_MIN_SCOREfloor and the ads-colony carve-out — so an exempt vote is never queued. An exemption is meant to be the final word, not one input among several._apply_actionre-checks at apply time. A vote that fails with a 502 is persisted to_pending_actionsand replayed on a later run, possibly days later and possibly after the operator listed that author. Checking only at decision time would cast exactly the vote they asked us never to cast. So the queued vote now carries its author, and a suppression returnsTrue(resolved) rather thanFalse— aFalsewould re-queue the forbidden vote as a failure and retry it for five more runs.Scope
The exemption suppresses the vote and nothing else. A JUNK post by a listed user is still marked junk, language-tagged, PII-flagged and marked scanned.
--no-voteremains the switch for the whole moderation family.Operability
Files are re-read whenever they change (cached on mtime + size), so a name can be added while a long-running
webhookprocess is up — no restart.Both modes log the absolute path consulted at startup. "No exemptions" and "the list is in the wrong directory" are otherwise indistinguishable, and the second only surfaces by watching the sentinel vote on someone it was told not to:
Paths are overridable via
SENTINEL_NEVER_UPVOTE_FILE/SENTINEL_NEVER_DOWNVOTE_FILE.One bounded gap, documented rather than hidden
A vote persisted by a sentinel older than this change carries no author, so it can't be re-checked when it replays — and is cast. The pending queue drains within 5 attempts, so this spans only the first runs after upgrading. Votes queued by this version onward are re-checked against the list as it stands at replay time.
Tests
30 new cases in
tests/test_vote_exemptions.py— parsing (comments,@, casing, CRLF), disk loading (missing / unreadable / deleted), hot reload, list independence in both directions, the_pending_actionspipeline, the replay path,act_on_judgementend-to-end, and the startup announcement. Suite: 192 passed, ruff clean.All 13 mutants of the new guards were verified to fail the suite: suppression removed, replay re-check removed,
Trueflipped toFalse, the two lists swapped, one list used for both directions, case-folding dropped,@-strip dropped, comment-strip dropped, cache never invalidated, author not stamped onto the judgement, author not stamped onto the vote action, absent list logged as silence.🤖 Generated with Claude Code
https://claude.ai/code/session_01Pxqw6ZyFv5f4rt5HFwtafs