AntFleet

Disagreement · 748568f3-anthropic-3

`/api/opt-in` swallows `flipReceipt` errors and bubbles them as a 5xx, but no try/catch around the flip means transient DB errors surface as unhandled 500s

solo Opus
repo e24ef98c·PR #9·reviewed 1 week ago

Opus finding

`/api/opt-in` swallows `flipReceipt` errors and bubbles them as a 5xx, but no try/catch around the flip means transient DB errors surface as unhandled 500s

mediumbughigh
  • apps/web/app/api/opt-in/route.ts:60-67
There's deliberate try/catch around `recordEvent` (audit best-effort), but `flipReceipt` is awaited unguarded. If the DB throws, the response is an unhandled rejection → Next will respond 500 with a framework error page, contradicting the design goal that this endpoint always returns a styled HTML page (the route ships its own pageShell with `noindex` and 'no-cache' headers, and even maps validation failures to themed pages). The user is left with a stack trace instead of an actionable message pointing to the email fallback. Token logId is also lost in that path.

Recommendation

Wrap the flipReceipt call in try/catch and return `htmlResponse(500, errorPage('Something went wrong', '...email agent@antfleet.dev...'))`, logging with logWarn.

Other reviewer

The other reviewer flagged nothing in this file/line range.

Why this didn't post

This finding didn't meet AntFleet's unanimous agreement threshold. Both frontier models review every PR independently; only findings they both flag with the same severity and category are posted to the PR. This one fell through.

read the methodology →

From the same review

These findings passed the unanimous gate on the same PR review. The disagreement above was filtered out; the findings below were posted.