-
Notifications
You must be signed in to change notification settings - Fork 54
fix(chat): add diagnostic logging for Vercel timeout investigation #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
) * fix(chat): add diagnostic logging for Vercel timeout investigation - Add diagnostic timeout that fires 10s before Vercel hard timeout to capture what phase the request is stuck in - Add immediate flush after preemptive timeout trigger log to ensure it's captured before process termination - Add phase tracking throughout request lifecycle: - streaming, onFinish_started, onFinish_stopSubscriber, onFinish_waiting_title, onFinish_updateChat, onFinish_awaitUsage, onFinish_saveMessages - This helps diagnose why only 48/190 timeouts show preemptive triggers Co-authored-by: Cursor <cursoragent@cursor.com> * fix(chat): keep diagnostic timeout alive during onFinish cleanup Add clearPreemptiveOnly() to only clear the preemptive timeout at the start of onFinish, preserving the diagnostic timeout so it can still fire if onFinish blocks near Vercel's hard limit. * fix(chat): apply same diagnostic timeout fix to retry/fallback path Use clearPreemptiveOnly() in the retry onFinish callback to keep the diagnostic timeout alive during fallback cleanup as well. --------- Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThese changes enhance the preemptive timeout system with a diagnostic timeout that logs 10 seconds before the Vercel hard timeout, and add granular phase tracking throughout the stream handling lifecycle. A new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/api/chat-handler.ts (1)
972-981:⚠️ Potential issue | 🟡 MinorClear diagnostic timeout on the early-return path.
Right now this return can leave the diagnostic timer running, which may emit late logs after a clean completion. Consider clearing afterdeductAccumulatedUsage()and before returning.Suggested fix
if ( isAborted && !isPreemptiveAbort && newFileIds.length === 0 && !hasIncompleteToolCalls && !hasUsageToRecord ) { await deductAccumulatedUsage(); + preemptiveTimeout?.clear(); return; }
Summary
clearPreemptiveOnly()to keep diagnostic timeout alive during onFinish cleanupExtracted from #208 to keep the summarization PR focused.
Test plan
Summary by CodeRabbit
Bug Fixes
Performance & Stability