Repository navigation
Conversation
abarghoud
force-pushed
the
feat/typesafe-jev-error-classification
branch
4 times, most recently
from
September 18, 2026 21:11
9152467 to
d4ea573
Compare
Add two Jev judgments behind deterministic guards, so the API keeps its previous behaviour when TYPESAFE_API_KEY is unset. - ErrorMeaningClassifierService: choice() judgments for Telegram send failures and Tesla API failures. The keyword matcher runs first and Jev is consulted only for wording it does not recognise, so known errors stay instant on the notification path. Verdicts are memoised per error object, so the two predicates TelegramService applies to a failure cost at most one judgment. - Supporter moderation: noul() probabilities for profanity, spam and politics with block and review thresholds. It runs at webhook ingestion only. The blocklist judge is the default everywhere, so a caller that forgets to pass one cannot reach the network, and the public uncached GET /supporters never issues a judgment. Judgments are bounded: 2s and no retry on the alert path, 10s and one retry at ingestion. The classifier runs inside the catch block of the Telegram send, outside the withTimeout that caps the send, so the SDK defaults would otherwise let one judgment hold a notification worker for ~30s. Five workers feed a queue that drops alerts once full. A judgment is an optimisation over the keyword matcher, so expiring it costs accuracy, never delivery. The client is provided through a DI token rather than a constructor default, which Nest cannot resolve; a test compiles the container to keep it that way. Every judgment emits [TYPESAFE_JUDGMENT] with its outcome, confidence, duration, model and token counts, and failures emit [TYPESAFE_JUDGMENT_FAILED], both reaching the OCI logging pipeline. Supporter moderation judges personal data, so its log carries the decision and the probabilities but never the text.
abarghoud
force-pushed
the
feat/typesafe-jev-error-classification
branch
from
September 18, 2026 21:19
d4ea573 to
2d5c3b5
Compare
JordiMa
previously approved these changes
Sep 26, 2026
JordiMa
left a comment
Collaborator
There was a problem hiding this comment.
Okay, let's send it out for testing! And see how it goes
…error-classification # Conflicts: # package.json
This branch was successfully deployed
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 this does
SentryGuard needs to know why a notification or a Tesla request failed, so it can react correctly: stop writing to someone who blocked the bot, retry what is worth retrying, and leave the rest alone.
Until now that decision came from a fixed list of keywords, so any wording it had not seen before was simply treated as "unknown". This adds an AI judgment (TypeSafe / Jev) as a second opinion, consulted only for wording the existing keyword list does not recognise.
The same mechanism moderates the names and messages shown on the supporters wall.
What changes in practice
Safety
Notes
TYPESAFE_API_KEYmust be set for this to be active in production; it is optional everywhere else.Results on sample failures
Each pair below describes the same situation. The keyword list only recognises the first wording of each pair.
Forbidden: bot was blocked by the userThe user has blocked the bot and messages cannot be deliveredBad Request: chat not foundFailed to fetch conversation: the chat is no longer availablesocket hang up while sending updateThe user has revoked access for this applicationSupporters wall
Alexandre,Marine Dupont,Jean Dupon(d)D1ckens family fundConn@rd,C0nnard,FUCK YOU,HitlerMarine Le Pen,Trump 2028!,Votez pour nous aux européennesBuy my crypto course, guaranteed returnscontact me at alice@example.comThese come from replaying hand-picked wordings and real production error samples, not from a production measurement. The judgment logs will give the real distribution once deployed.