Skip to content

Flag advertisements + ads-colony downvote carve-out#14

Merged
jackparnell merged 1 commit into
TheColonyCC:masterfrom
arch-colony:feat/ad-flag-and-ads-colony
Jun 23, 2026
Merged

Flag advertisements + ads-colony downvote carve-out#14
jackparnell merged 1 commit into
TheColonyCC:masterfrom
arch-colony:feat/ad-flag-and-ads-colony

Conversation

@arch-colony

Copy link
Copy Markdown
Contributor

What

Teaches Sentinel to use The Colony's sentinel-only PUT /api/v1/posts/{id}/ad endpoint (the is_ad flag, three-state: unset / true / false) and stops it from penalising legitimate advertisements that live in the dedicated /c/ads colony.

Motivation: ads currently get caught by the BAD ("mildly spammy") / JUNK ("blatant advertising") buckets and downvoted — even when they're posted in the ads colony, which exists for advertisements.

Changes

  • Prompt — new is_ad output field + an advertising-detection paragraph, and a colony-aware rule: the post's colony is now shown to the model (Colony: <name>), and in the ads colony the model must not rate a post BAD/JUNK or recommend downvote merely for being promotional. It still flags scams / deception / gibberish there.
  • flag_post_ad() helper — PUT /posts/{id}/ad?is_ad=true via the SDK raw hatch, same pattern as junk/pii. Wired through a new ad action in _pending_actions / _apply_action. The is_ad flag is recorded in every colony — it's only the downvote that the ads colony exempts.
  • Deterministic ads-colony carve-out (belt-and-suspenders behind the prompt) in _pending_actions: when a post is flagged is_ad and lives in the ads colony, any downvote is dropped. Upvotes are untouched, and JUNK posts are still marked junk — scams in /c/ads don't get a free pass. Keyed on the colony name carried in the judgement, so it stays a pure, replayable decision.
  • _colony_name_for() — resolves the colony name once in fetch_post_with_comments (cached, mirrors _is_sandbox_colony).

Behaviour matrix (ads colony)

Post Vote
Legit ad in /c/ads no downvote (model → none; carve-out drops any stray downvote)
Great ad in /c/ads upvote still allowed
Scam/gibberish ad in /c/ads still JUNK → marked junk (downvote suppressed, junk kept)
Ad in any other colony scored on merits as before (off-topic there)

Tests

12 new tests in tests/test_actions.py covering the full action matrix + the endpoint call. Full suite green (106 passed), ruff clean.

🤖 Generated with Claude Code

The Colony added a sentinel-only PUT /api/v1/posts/{id}/ad endpoint
(three-state is_ad: unset / true / false). Teach Sentinel to use it and
stop penalising legitimate ads that live in the dedicated /c/ads colony.

- Prompt: new "is_ad" output field + an advertising-detection paragraph,
  plus a colony-aware rule. The post's colony is now shown to the model
  ("Colony: <name>"). In the "ads" colony advertising is welcome — the
  model must not rate a post BAD/JUNK or recommend downvote merely for
  being promotional; it judges ads there only on scam/deception/gibberish.
- New flag_post_ad() helper (PUT /posts/{id}/ad?is_ad=true via the SDK
  raw hatch, same pattern as junk/pii) + an "ad" action wired through
  _pending_actions / _apply_action. The is_ad flag is recorded in EVERY
  colony — it's only the downvote that the ads colony exempts.
- Deterministic carve-out in _pending_actions (belt-and-suspenders behind
  the prompt): when a post is flagged is_ad AND lives in the "ads" colony,
  any downvote is dropped. Upvotes are untouched, and JUNK posts are still
  marked junk (scams in /c/ads don't get a free pass). Keyed on the colony
  NAME carried in the judgement so the decision stays pure and replayable.
- Resolve the colony name once in fetch_post_with_comments via a cached
  _colony_name_for() (mirrors _is_sandbox_colony).
- 12 new tests covering the action matrix + the endpoint call; README
  updated. Full suite green (106 passed), ruff clean.
@jackparnell jackparnell merged commit 798e7b2 into TheColonyCC:master Jun 23, 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