Files
RedditBot/packages/api-contracts/src/attention.ts
T
Jamie BruntonandClaude Opus 5 89eb4583f8 feat: flag accounts Reddit considers unestablished and re-test them
New accounts cannot start chats until Reddit considers them established.
Until now the bot would burn a candidate on every invitation Reddit was
always going to reject, with nothing in the dashboard explaining why the
account looked idle.

Two signals feed the verdict. A periodic profile check reads the
account's own age, karma and email verification from about.json and
compares them against configurable thresholds — that is what flags a
brand new account before it wastes anything. A rejected invitation is
authoritative: Reddit has told us directly, so the account is held out of
sending with a backoff that doubles per rejection, and a delivered
invitation clears the flag outright.

An unestablished account takes no new posts (canAcceptPost), raises an
attention item, reports an `unestablished` sending state, and shows its
age/karma evidence on the Accounts page. An unchecked account is always
allowed through, so a first run is never blocked.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 09:14:47 +01:00

33 lines
892 B
TypeScript

import { z } from 'zod';
import { RedditAccountOwnerSchema } from './session.js';
export const AttentionKindSchema = z.enum([
'human-required',
'boundary',
'failed-delivery',
'account-login-required',
'runtime-failed',
'invitation-cooldown',
'account-unestablished',
]);
export const AttentionItemSchema = z.strictObject({
id: z.string(),
kind: AttentionKindSchema,
severity: z.enum(['warning', 'critical']),
title: z.string(),
detail: z.string(),
occurredAt: z.number(),
owner: RedditAccountOwnerSchema.optional(),
conversationId: z.string().optional(),
username: z.string().optional(),
});
export const AttentionResponseSchema = z.strictObject({
generatedAt: z.number(),
items: z.array(AttentionItemSchema),
});
export type AttentionItem = z.infer<typeof AttentionItemSchema>;
export type AttentionResponse = z.infer<typeof AttentionResponseSchema>;