Coach nudges never guess from a failed chain read, and the site owner is never coached (Marty 2026-10-31): a chain.member() failure cached null for 60 s, rungFor() then classed the member as "payouts on, no purchase" and mailed the rung-2 "See a payout land: your first package" nudge to the owner (memberId 1, 4 purchases, 7 buyers). describe() now reports unknown and stalled requires a known state; nudgeTick skips adminEmail.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-31 07:44:19 -05:00
parent 12788e799f
commit 4c0a68cbdd
2 changed files with 8 additions and 3 deletions
+7 -2
View File
@@ -56,12 +56,16 @@ async function member(id) {
const STALL_DAYS = 3;
async function describe(acct, now = Date.now()) {
const mm = await member(acct.memberId);
// unknown = the member is on chain but the read failed just now (member() swallows RPC errors and caches null for a
// minute); rungFor would call them "payouts on, no purchase" and the coach would mail a buyer the first-package nudge
// (2026-10-31: Marty, 4 purchases and 7 buyers, got "See a payout land"). Callers that mail must skip unknown.
const unknown = !!(acct.memberId && !mm);
const rung = rungFor(acct, mm);
const last = Math.max(acct.created || 0, acct.lastSeen || 0);
const quietDays = Math.floor((now - last) / DAY);
const stalled = rung < 6 && quietDays >= STALL_DAYS;
const stalled = !unknown && rung < 6 && quietDays >= STALL_DAYS;
const R = RUNGS[rung];
return { rung, label: R.label, next: R.next, say: R.say, quietDays, stalled, buyerCount: mm ? mm.buyerCount : 0,
return { rung, label: R.label, next: R.next, say: R.say, quietDays, stalled, unknown, buyerCount: mm ? mm.buyerCount : 0,
counted: !!(mm && mm.countedAsBuyer), joined: acct.created, lastSeen: acct.lastSeen || 0, onchainSponsorId: mm ? mm.sponsorId : null };
}
// coaching view for a sponsor: every direct, ladder rung, stalled flag, what to say
@@ -221,6 +225,7 @@ async function nudgeTick() {
const all = await accounts.listAll(5000);
for (const acct of all) {
if (!acct.email || !acct.created || now - acct.created < STALL_DAYS * DAY) continue;
if (X.adminEmail && String(acct.email).toLowerCase() === String(X.adminEmail).toLowerCase()) continue; // the site owner is never coached (2026-10-31)
if (!acct.lastSeen || acct.joinedVia === 'carried' && !acct.lastSeen) continue; // never signed in here (carried-over shells from InstantAdPay): no coaching mail, ever (2026-10-11: Harvey got a nudge for a site he never joined)
const c = await describe(acct, now);
if (!c.stalled) continue;
+1 -1
View File
@@ -670,7 +670,7 @@ async function boot() {
setTimeout(() => refill.tick().catch(e => console.error('refill', e.message)), 90000);
setInterval(() => refill.tick().catch(e => console.error('refill', e.message)), 20 * 60 * 1000);
// follow-up email sequence: send whatever came due (every 10 min, first pass shortly after boot)
coach.init({ dataDir: DATA_DIR, chain, accounts, mailer, ads, tank, lb: () => leaderboard, siteConfig });
coach.init({ dataDir: DATA_DIR, chain, accounts, mailer, ads, tank, lb: () => leaderboard, siteConfig, adminEmail: ADMIN_EMAIL });
pipeline.init({ dataDir: DATA_DIR, accounts, coach, chain });
registry.init({ dataDir: DATA_DIR });
carry.init({ dataDir: DATA_DIR, accounts, registry, chain, mailer, messages, siteConfig, adminEmail: ADMIN_EMAIL, host: SITE_HOST,