Skip to content

fix(api): release video quota on failed Runway starts - #129

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-4023
Draft

fix(api): release video quota on failed Runway starts#129
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-4023

Conversation

@cursor

@cursor cursor Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

video-generate reserved a per-identity hourly quota slot before Runway had accepted a generation task. If Runway returned a pre-task failure (for example configured model unavailable, non-2xx start error, or a 2xx response without a task id), the route returned an error without releasing the slot. Five such failures could exhaust the caller's hourly video quota even though no generation was started, blocking successful retries until the UTC hour reset.

Root cause

The route only released the slot for daily-limit and insufficient-credit failures. The Runway start path had no distinction between failures before a task existed and failures after a real task id existed.

Fix

Track whether a Runway task id has been created, and release the hourly slot on pre-task start failures only. Poll failures after a task id exists still count against the cap because Runway may have consumed vendor capacity.

Validation

  • cd api && npm run build && node tests/hardening-caps-audit.test.mjs
  • Build ran prisma generate && tsc successfully.
  • Hardening suite passed, including new assertions for releaseVideoHourlySlot and the video route's no-task-created release branches.
Open in Web View Automation 

Co-authored-by: Deesmo <Deesmo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant