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>
This commit is contained in:
Jamie BruntonandClaude Opus 5 committed 2026-08-11 09:14:47 +01:00
1 parent c43e534cf1
commit 89eb4583f8
25 files changed
+1425 -11

No files matched your search

+5
View File
@@ -35,6 +35,7 @@ import type { ResponseCheckerService } from './response-checker.js';
import type { RedditPost } from '../reddit/api.js';
import type { ConversationAutomationService } from './conversation-automation.js';
import type { RecipientAccountStatusService } from './recipient-account-status.js';
import type { AccountEstablishmentService } from './account-establishment.js';
import type { ProcessedPost, ProcessResult } from './processor.js';
/** Credentials passed to a factory. They must never be exposed by list/snapshot APIs. */
@@ -83,6 +84,7 @@ export interface RedditAccountRuntimeResources {
mediaService: MediaService;
mediaSyncService: MediaSyncService;
recipientAccountStatusService: RecipientAccountStatusService;
establishmentService: AccountEstablishmentService;
mediaExchange?: MediaLibraryExchangeService;
rateLimiter: RateLimiter;
}
@@ -197,6 +199,9 @@ export class RedditAccountRuntime {
if (this.state !== 'running') return false;
if (!this.resources.accountAuth.isFullyAuthenticated()
&& !(await this.resources.accountAuth.ensureFullyAuthenticated())) return false;
// An account Reddit has refused invitations from would burn the candidate,
// so it takes no new posts until its re-test window opens.
if (!this.resources.establishmentService.isSendable()) return false;
if (await this.resources.conversationAutomation.hasActionableReplies()) return false;
if (this.resources.chatService.getInvitationCooldown()) return false;
return this.resources.rateLimiter.getTimers().nextMessageAvailableAt === null;