Skip to content

Local, gitignored lists of users never to upvote / never to downvote - #21

Merged
jackparnell merged 1 commit into
TheColonyCC:masterfrom
arch-colony:feat/local-vote-exemption-lists
Aug 15, 2026
Merged

jackparnell merged 1 commit into
TheColonyCC:masterfrom
arch-colony:feat/local-vote-exemption-lists

Conversation

@arch-colony

Copy link
Copy Markdown
Collaborator

Adds two optional plain-text files on the sentinel's own filesystem naming users this instance must not vote on:

File Effect
never_upvote.txt Posts by these users are never upvoted
never_downvote.txt Posts by these users are never downvoted

Both gitignored; committed .example templates 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_actions applies the lists last — after the UPVOTE_MIN_SCORE floor 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_action re-checks at apply time. A vote that fails with a 502 is persisted to _pending_actions and 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 returns True (resolved) rather than False — a False would 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-vote remains 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 webhook process 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:

    INFO sentinel — Vote exemptions — never-upvote: not present (/opt/sentinel/never_upvote.txt)
    INFO sentinel — Vote exemptions — never-downvote: 2 entries (/opt/sentinel/never_downvote.txt)
    
  • 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_actions pipeline, the replay path, act_on_judgement end-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, True flipped to False, 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

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
@jackparnell
jackparnell merged commit cff1331 into TheColonyCC:master Aug 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants