Skip to content

fix: make AI chat work on free Vercel plans - #476

Merged
ysamcode merged 1 commit into
mainfrom
develop
Jul 28, 2026
Merged

fix: make AI chat work on free Vercel plans#476
ysamcode merged 1 commit into
mainfrom
develop

Conversation

@ysamcode

Copy link
Copy Markdown
Collaborator

Summary

Deploying YCode on a Vercel hobby (free) plan failed because the AI chat route exported maxDuration = 800, which exceeds the hobby-plan limit of 300 seconds and fails build validation. The route-level export also always overrode vercel.json, so paid deployments couldn't configure their own limit either.

Changes

  • Remove the maxDuration = 800 export from the AI chat route and set it in vercel.json instead (300s — the hobby-plan maximum), so deployments can override it in their own vercel.json
  • Derive the agent loop's run budget (MAX_RUN_MS) from a new optional AI_CHAT_MAX_DURATION env var (defaults to 300s, minus a 60s buffer), so the agent still stops gracefully before Vercel hard-kills the function
  • Document AI_CHAT_MAX_DURATION in .env.example, including the requirement to keep it in sync with vercel.json on paid plans

Test plan

  • Deploy to a Vercel hobby plan — build validation should pass
  • Run a long AI chat session and confirm it ends gracefully with a resumable "ran out of time" error instead of a silent cut
  • On a paid deployment, raise maxDuration in vercel.json and set AI_CHAT_MAX_DURATION to match — confirm longer runs are allowed

Made with Cursor

The chat route exported maxDuration = 800, which fails Vercel build
validation on free plans (max 300). A route-level export also always
overrides vercel.json, so paid deployments couldn't raise it either.
Move the duration to vercel.json (300 default) and derive the agent
loop's run budget from AI_CHAT_MAX_DURATION so paid deployments can
keep longer runs.
@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 5e517b3 into main 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