fix(discord): /fleety blocked for everyone — was calling the auth-only rate limiter - #260
Merged
Merged
Conversation
…te limiter
Root cause: the /fleety adapter's underRateLimit called public.check_rate_limit, which is
hardened for AUTH flows only — it rejects any identifier that isn't a 64-char SHA-256 hash
(migration 20260606…, line 16) AND any action outside its login/signup/reset whitelist
(line 20). Called with `discord:<id>` + action "fleety", it returned {allowed:false} on EVERY
invocation, so /fleety only ever posted "🚦 You've asked Fleety a lot in the last hour" and
never reached the answer path — for days, for all users.
Fix: point underRateLimit at the GENERIC public.check_edge_rate_limit (the same limiter
fleety-extract + other edge endpoints use). It hashes the identifier itself, accepts any
action, and is a clean sliding-window counter (no stuck-block state). Kept fail-open on error.
Bumped the cap 10 -> 20 per hour (owner had flagged 10 as too tight for real use).
Guards:
- src/test/smoke/fleety-discord-ratelimit.smoke.test.ts (3 cases): asserts the adapter uses
check_edge_rate_limit, NOT check_rate_limit, and still fails open.
- BDD @regression scenario in fleety-2.1-discord.feature.
Follow-on (config, owner): once deployed, /fleety passes the limiter and calls the 2.0 brain
via FLEETY_INTERNAL_SECRET. If that secret is unset, members will now see the generic
"⚠️ error" instead — that's the remaining 2.1 config step, not this bug.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🛡️ Penetration test resultsPen-test suite: sastGenerated 2026-04-29T03:40:44.503Z Totals: ✅ 49 pass · ❌ 0 fail · ⊘ 0 skip ·
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause (definitive)
Discord
/fleetyhas posted "🚦 You've asked Fleety a lot in the last hour" and nothing else, for everyone, for days. It was never a real rate limit.The adapter's
underRateLimitcalledpublic.check_rate_limit— which is hardened for auth flows only:^[a-f0-9]{64}$, migration20260606…line 16), andCalled with
discord:<userid>+ action"fleety", it returns{allowed:false}unconditionally, on every call →/fleetyalways hit the throttle branch and never reached the answer.Fix
Point
underRateLimitat the genericpublic.check_edge_rate_limit(the same limiterfleety-extractand other edge endpoints use): it hashes the identifier itself, accepts any action, and is a clean sliding window (no stuck-block state). Still fails open on error. Cap raised 10 → 20 / hour (10 was flagged as too tight for real use).Proof
vitest run fleety-discord-ratelimit.smoke.test.ts→ 3 passed (usescheck_edge_rate_limit; does NOT usecheck_rate_limit; still fails open)@regressionscenario added tofleety-2.1-discord.featuredeno check discord-interactions/index.ts→ cleanDeploy + the one remaining step
Merging deploys
discord-interactions. Two notes:check_edge_rate_limitmust exist in prod (migration20260809170000). If it doesn't, the RPC errors and the limiter fails open —/fleetystill works, just unthrottled — so this fix unblocks it either way./fleetyreaches the 2.0 brain viaFLEETY_INTERNAL_SECRET. If that secret isn't set, members will now see a generic "FLEETY_INTERNAL_SECRET), not this bug.🤖 Generated with Claude Code