AI: TypeSafe judges ad and tracker hosts; smart capture asks about DNS-only hosts - #5
Merged
Merged
Conversation
…S-only hosts TypeSafe's System One API (Jev) answers the domain judge's two questions per host as typed probabilities: is it ad or tracking infrastructure (noul) and how likely is a block to break something (choice). It runs with no chat model configured and falls back to the chat model when it fails. Settings > Assistant > TypeSafe domain judge holds the switch and the key (masked in the API, kept across backup restore). Smart capture's heuristics only measure HTTP signals, so a host seen only in DNS scored zero and was never escalated; on a DNS-only node nothing was ever judged. Such hosts are now judged once, the verdict stands alone rather than blended with that zero, and it can only queue for review, never block. Unjudged candidates are ordered ahead of review rows, a quiet interval no longer erases a host's earlier HTTP evidence, and classify() unwraps provider errors so a bad key stops a batch. Co-Authored-By: Claude Opus 5 <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.
What
TypeSafe domain judge. Smart capture and the domain tester's "Ask the assistant" can ask TypeSafe's Jev model (System One API) two typed questions per host: is it ad or tracking infrastructure (
noul), and how likely is a DNS block to break something (choice: low / medium / high). It works with no chat model configured. When a chat model is configured, it takes over if TypeSafe fails. Chat, briefs and reviews are unchanged.internal/ai/typesafe.go: client, questions, verdict mapping. Retries 429/5xx with backoff; a bad key stops the whole batch after one request.ai.typesafe.{enabled,api_key}: masked in the API, kept on backup restore, and settable from Settings > Assistant > TypeSafe domain judge.Smart capture on DNS-only nodes. The heuristics measure referrers, response sizes and paths, so a host seen only as DNS lookups scored 0 and never reached the model. On the reference Pi node, 11,794 of 11,839 candidates were at 0.0 and nothing had ever been judged.
candidate.auto_block_score. A verdict on the name alone can only send a host to review, never block it.PendingCandidatesputs unjudged rows ahead of review rows, so a review backlog cannot starve the 500-row window.withStoredHTTP).classify()useserrors.As, so wrapped provider errors are recognised.Behaviour change for nodes without TypeSafe
With
smart_capture.use_aion, DNS-only candidates now reach the chat model too: one fast-model call per pass (40 hosts) while the backlog lasts. The judge prompt now says that athird_party_ratioof 0 with no HTTP evidence means "not measured", not "first-party".Testing
go vet ./...andgo test -race ./...pass locally.internal/ai/typesafe_test.go(httptest) covers verdict mapping, a DNS-only state carrying no zeros, the heuristic score staying out of the state, and a bad key aborting after one request.internal/adblock/smart_test.gocovers DNS-only escalation, the capped final score, review verdicts kept across passes, and HTTP history surviving a quiet pass. DisablingwithStoredHTTPmakes it fail.v1.32.1-typesafe. The first pass loggedjudge: 40/40 TypeSafe verdicts(2 to review, 38 dismissed, 0 blocked).🤖 Generated with Claude Code