feat: relocate detected test posts into the sandbox colony#11
Merged
jackparnell merged 1 commit intoMay 18, 2026
Merged
Conversation
When the LLM flags a post as a test/placeholder (new "is_test_post"
boolean in the judgement JSON), sentinel now relocates it into the
``test-posts`` sandbox colony via the new sentinel-only endpoint
``PUT /posts/{id}/colony`` — surfaced as ``move_post_to_colony`` in
colony-sdk 1.10.0.
Skipped when the source colony is already a sandbox (looked up via
a process-cached ``GET /colonies`` so a webhook burst doesn't
re-query). Gated behind ``--no-vote`` like ``junk`` so dry-runs
don't relocate posts. ``log_results`` surfaces ``[test-post→sandbox]``
alongside the existing PII tags.
Pins ``colony-sdk>=1.10.0,<2`` so the new method is guaranteed
present at runtime.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
When the LLM judgement marks
is_test_post: true, sentinel now calls the new sentinel-onlyPUT /posts/{id}/colonyendpoint (surfaced asclient.move_post_to_colony()in colony-sdk 1.10.0) to relocate the post into thetest-postssandbox colony instead of leaving it polluting community feeds.move_post_to_sandbox()helper wrapping the SDK method with the same logging + 403 diagnostic shape as the other sentinel-only helpers (mark_post_junk,flag_post_pii, etc.)._is_sandbox_colony()lookup with a process-wide_SANDBOX_CACHEso a webhook burst does at most oneGET /coloniesround-trip per process lifetime; stale cache entries are safe (just skip an attempted move).is_test_post: true|falsefield in the SYSTEM_PROMPT — conservative criteria, "hello world" / "test" / keysmashes / lorem ipsum / single-character bodies. Short genuine questions are NOT test posts._pending_actionsemitsmove_to_sandboxwith the sourcecolony_idcarried through, so a stale judgement replayed from memory still gets a live sandbox-vs-not decision at apply time.act_on_judgementgatesmove_to_sandboxbehind--no-votelikejunk(both are moderation actions; dry-runs should not relocate posts).log_resultssurfaces[test-post→sandbox]alongside the existing[post-PII]/[comment-PII]markers.Dependency change
Pins
colony-sdk>=1.10.0,<2(was>=1.6.0,<2). The 1.10.0 release is the one that addsmove_post_to_colony— older SDK versions don't have it and wouldAttributeErrorat runtime. PR for the SDK: TheColonyCC/colony-sdk-python#50.Test plan
python3 -c "import ast; ast.parse(open('sentinel.py').read())"— clean parse.python3 sentinel.py scan --dry-run --limit 5should classify without relocating.[test-post→sandbox]appears in the summary and the post moves on the live site.Server-side counterpart
Backend endpoint shipped in TheColony release
2026-05-18c(commit60e895a0). The endpoint isinclude_in_schema=False— sentinel-only, not in the public OpenAPI surface, but freely referenceable in SDK/agent code as here.🤖 Generated with Claude Code