Skip to content

fix(follow-gate): re-check a failed follow before rejecting, and record rejections - #73

Open
valentinpanizza wants to merge 2 commits into
diwenne:mainfrom
valentinpanizza:fix/follow-gate-recheck
Open

valentinpanizza wants to merge 2 commits into
diwenne:mainfrom
valentinpanizza:fix/follow-gate-recheck

Conversation

@valentinpanizza

Copy link
Copy Markdown

What happens

Someone taps the follow-gate button, and the conversation goes quiet. On my
instance people tapped 1.6 times each on average, trying to get a reaction.

Root cause

is_user_follow_business does not report a brand-new follow right away, and the
gate asks people to follow and then tap a button that is sitting in front of
them — so tapping seconds after following is the normal case, not an edge one.

Rejecting on the first false therefore turns away the exact people who did what
was asked, and the message they get back is the same prompt verbatim, telling
them to follow an account they already follow. From their side the bot just
stopped responding.

The branch also returned without writing anything, so a gate turning people away
left no trace at all. Its rejection rate could not be measured — only inferred
from users complaining.

The fix

On the first false the tap is re-queued with a delay instead of rejected. If
the follow has registered by then, the link goes out on its own with nothing more
for the person to do. The job id is deterministic, so repeated taps collapse into
the one pending re-check rather than queueing a re-check each — important, since
repeated tapping is the symptom.

FOLLOW_RECHECK_DELAY_MS (default 60s) tunes the wait. Only a second false
rejects, and that now writes an OperationalEvent so the rate is visible.

Trade-off

The delay is paid only by taps that fail the first check — under this diagnosis,
the people the gate is currently losing. Anyone who already followed still gets
their link immediately.

…rd rejections

Instagram does not report a brand-new follow immediately, and the gate asks
people to follow and then tap a button sitting right in front of them — so
tapping seconds after following is the normal case. Rejecting on the first
false therefore turns away the exact people who did what was asked, and tells
them to follow an account they already follow.

Worse, the message they get back is the same prompt verbatim, so from their
side the bot simply stopped responding. Several users on my instance tapped
repeatedly (1.6 taps per person) trying to get a reaction.

On the first false the tap is now re-queued with a delay instead of being
rejected: if the follow has registered by then the link goes out on its own,
with nothing more for the person to do. The job id is deterministic so
repeated taps collapse into the one pending re-check rather than queueing a
re-check each. FOLLOW_RECHECK_DELAY_MS (default 60s) tunes the wait.

Only a second false rejects, and that now writes an OperationalEvent. The
branch previously returned without recording anything, so a gate turning
people away left no trace at all — its rejection rate could not be measured,
only inferred from users complaining.
@vercel

vercel Bot commented Sep 23, 2026

Copy link
Copy Markdown

@valentinpanizza is attempting to deploy a commit to the diwenne's projects Team on Vercel.

A member of the Team first needs to authorize it.

…ked again

The re-check was queued with a fixed id per automation and user. BullMQ keeps
completed jobs (removeOnComplete: count 1000) and silently drops an add whose
id is still retained, so once someone had been re-checked, every later re-check
for them vanished: their next false tap produced no link and no prompt, and
nothing was logged. Caught testing a second tap on the same account.

Bucket the id by the recheck window instead. A burst of taps still collapses
into a single re-check, which is what the fixed id was for, but a tap in a later
window gets a fresh id that no retained job can block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant