improvement(redis): strip idempotency body and cap mothership stream zsets#4625
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Also caps mothership stream event history by trimming the Redis ZSET to Reviewed by Cursor Bugbot for commit 78b3d96. Configure here. |
Greptile SummaryTwo targeted Redis memory fixes following a 2026-05-15 OOM incident: the mothership stream buffer now enforces its
Confidence Score: 4/5Safe to merge for the buffer cap change; the idempotency body-stripping is intentionally lossy for webhook and polling paths where callers don't read the return value, but that assumption isn't enforced by the type system. The pollingIdempotency change is the one place worth a second look: duplicate polling calls that arrive while the first is in-progress or after it completes will receive undefined as T from executeWithIdempotency. TypeScript's cast suppresses the type error, so any polling handler that reads the resolved value will silently receive undefined on the duplicate path without a compile-time signal. apps/sim/lib/core/idempotency/service.ts — specifically any callers of pollingIdempotency.executeWithIdempotency that read the resolved value Important Files Changed
Reviews (2): Last reviewed commit: "test(buffer): pin exact ZREMRANGEBYRANK ..." | Re-trigger Greptile |
Pinning -5_001 (= -(DEFAULT_EVENT_LIMIT) - 1) so the off-by-one boundary is directly validated; expect.any(Number) would have passed a wrong formula like -eventLimit. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Re Greptile's outside-diff note on Audited all callers and this is safe:
The contract is also documented on the |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 78b3d96. Configure here.
Summary
Two targeted fixes that reduce Redis memory pressure following the 2026-05-15 OOM incident:
apps/sim/lib/core/idempotency/service.ts): webhook + polling idempotency now store only a{ success, status }marker instead of the full response body. As a webhook receiver, the provider's retry only needs a 2xx — not our cached response. TTLs unchanged (webhook 7d to cover Gmail/Pub-Sub retry window, polling 3d).apps/sim/lib/copilot/request/session/buffer.ts):appendEventsnow callsZREMRANGEBYRANKto enforceeventLimit(default 5,000) on every append. Previously the limit was dead code — streams grew unbounded until the 1h TTL fired.Both are additive and backward-compatible. New
storeResultBodyconfig flag defaults totrueso callers (Stripe-style idempotency) that need the cached body are unaffected.Test plan
bun run lintcleanzremrangebyrankis called on every append