Repository navigation
fix(api): classify transient database reads and client-caused failures instead of answering 500 - #9639
Conversation
…s instead of answering 500
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge; no new actionable issues remain. SummaryThis PR returns more useful HTTP errors instead of generic 500 responses.
Both earlier threads are addressed: the catalog covers SDK and transport failures, and deferred connections retain their originating operation.
|
There was a problem hiding this comment.
All reported issues were addressed across 18 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
withRouteHandleranswers a GET/HEAD whose query failed transiently (replica recovery conflict, statement/lock/transaction timeout, lost connection, server restart) with503+Retry-Afterin the route family's own envelope, instead of an unhandled 500. Classification reusesgetTransientDatabaseFailure, so socket errors count only when a database query carried them. Supersedes fix(logs): return 503 instead of 500 when a v2 logs read is cancelled #9558, which fixed only the v2 logs routesnot_found/validationstop surfacing as 500MultipartFieldValidationError(400) for every multipart routecategorizeError(newcategorizeMcpServerError), never the substring fallbackaddthat drops several disallowed tools no longer drivesappliednegative and fails response validation with a 500Type of Change
Testing
with-route-handler.test.ts(503 for four transient classes + HEAD; 500 kept for writes, user cancel, permanent query error, non-DB socket reset; no SQL in the body),stream-limits.test.ts(malformed multipart, both read branches),lifecycle.test.ts(malformed chat id → null with no query),operations.test.ts(multi-skip operation counted once). Each failed with its fix revertedcheck:audits, and the full suite run in CIChecklist
test-auditauthoring gate)