fix: never let a guessed threshold hold an account out of sending

The profile check was allowed to set state 'unestablished', which made
isSendable() false, which made canAcceptPost() false — so a flagged
account never attempted an invitation and the functional probe could
never run. The one signal with real authority was gated behind the one
that is guessing, and because each check pushed retryAt forward by
another interval, accounts that send perfectly well were held
indefinitely.

Reddit does not publish the thresholds its chat gate applies, so ours are
a guess and are now advisory only. Sending is held solely by a live
rejection, tracked as sendingHeld on the account summary and keyed off by
the attention feed, the sending state and the Accounts page.

Reason strings now say "below the configured floor of N" rather than
"needs N", and the Accounts page distinguishes "Sending on hold" from
"Below thresholds", stating outright that the latter is our own number
and the account is still sending.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Jamie BruntonandClaude Opus 5 committed 2026-08-11 09:49:40 +01:00
1 parent 89eb4583f8
commit 3a40651930
9 files changed
+164 -71

No files matched your search

+26 -7
View File
@@ -39,15 +39,17 @@ const account = {
};
describe('attention route establishment items', () => {
it('raises an unestablished account with its reasons and hold window', async () => {
it('raises an account Reddit has refused, with what Reddit said and the hold window', async () => {
const response = await get(contextWith([{
...account,
establishment: {
state: 'unestablished',
reasons: ['Account is 2 days old (needs 7 days)'],
sendingHeld: true,
reasons: ['Reddit rejected an invitation from this account: account is too new'],
lastProbeFailure: 'Reddit rejected an invitation from this account: account is too new',
retryAt: NOW + 4 * 60 * 60_000,
profileCheckedAt: NOW,
lastProbeAt: null,
lastProbeAt: NOW,
},
}]), '/api/attention');
@@ -58,18 +60,33 @@ describe('attention route establishment items', () => {
id: 'establishment:@t2_new:reddit.com',
kind: 'account-unestablished',
severity: 'warning',
title: 'u/new-account is not established yet',
title: 'u/new-account cannot start chats yet',
occurredAt: NOW,
owner: { accountId: account.accountId, redditUsername: 'new-account' },
});
expect(body.items[0].detail).toContain('Account is 2 days old (needs 7 days)');
expect(body.items[0].detail).toContain('account is too new');
expect(body.items[0].detail).toContain('Outbound sending is on hold');
});
it('stays quiet for established accounts and for accounts never checked', async () => {
it('stays quiet for an account that is only below our own thresholds', async () => {
const response = await get(contextWith([
{ ...account, establishment: { state: 'established', reasons: [], retryAt: null, profileCheckedAt: NOW, lastProbeAt: null } },
{ ...account, establishment: { state: 'established', sendingHeld: false, reasons: [], lastProbeFailure: null, retryAt: null, profileCheckedAt: NOW, lastProbeAt: null } },
{ ...account, accountId: '@t2_other:reddit.com', redditUsername: 'other', establishment: null },
{
...account,
accountId: '@t2_soft:reddit.com',
redditUsername: 'soft',
// Below the configured floor but never refused by Reddit — advisory only.
establishment: {
state: 'unestablished',
sendingHeld: false,
reasons: ['Comment karma is 3 (below the configured floor of 5)'],
lastProbeFailure: null,
retryAt: null,
profileCheckedAt: NOW,
lastProbeAt: null,
},
},
]), '/api/attention');
const body = AttentionResponseSchema.parse(await response.json());
@@ -82,7 +99,9 @@ describe('attention route establishment items', () => {
status: 'login-required',
establishment: {
state: 'unestablished',
sendingHeld: true,
reasons: [],
lastProbeFailure: null,
retryAt: null,
profileCheckedAt: NOW,
lastProbeAt: null,