Skip to content

fix: AI chat killed after 60 seconds on Vercel - #477

Merged
ysamcode merged 1 commit into
developfrom
fix/ai-chat-max-duration-order
Jul 28, 2026
Merged

fix: AI chat killed after 60 seconds on Vercel#477
ysamcode merged 1 commit into
developfrom
fix/ai-chat-max-duration-order

Conversation

@ysamcode

Copy link
Copy Markdown
Collaborator

Summary

The 1.28.9 fix that moved the AI chat route's maxDuration into vercel.json doesn't take effect: Vercel resolves functions patterns first-match-wins in definition order, and the 60s catch-all app/(builder)/ycode/api/**/*.ts is listed above the chat route entry. Every agent run gets hard-killed at 60 seconds, so turns end silently truncated ("Thought for 1m" with no result).

Refs: Vercel duration docs (ordering note), vercel/vercel#15315 (getLambdaOptionsFromFunction is first-match-wins).

Changes

  • Move the app/(builder)/ycode/api/ai/chat/route.ts entry above the builder API catch-all in vercel.json so its 300s budget actually applies

Test plan

  • Deploy to Vercel and run an agent prompt that takes over a minute — the turn completes instead of stopping at "Thought for 1m"
  • Confirm other builder API routes still show a 60s max duration in the Vercel functions dashboard

Made with Cursor

Vercel resolves vercel.json function patterns first-match-wins in
definition order, so the 60s catch-all listed above the chat route
entry swallowed it — Vercel hard-killed every agent run at 60s and
turns ended silently truncated ("Thought for 1m" with no result).
List the specific route first so its 300s budget actually applies.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ysamcode ysamcode added the Bug Something isn't working label Jul 28, 2026
@ysamcode ysamcode self-assigned this Jul 28, 2026
@ysamcode
ysamcode merged commit ff9c094 into develop Jul 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant