You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
include drainGracePeriod when creating serverless runner configs through the legacy-compatible payload branch
share Vercel's 295-second request lifespan and validate drain grace periods below it
default Vercel drain grace periods to 5 seconds in both standard and quick setup flows
Root cause
New runner configs have no existing protocolVersion, so the frontend selected the legacy-compatible payload branch. That branch omitted drainGracePeriod, causing the API to apply its 1800-second fallback, which is invalid for Vercel's 295-second request lifespan.
Scoped, well-targeted fix. The root cause tracks: the legacy-compatible payload branch in buildServerlessConfig omitted drainGracePeriod, so the API applied its 1800s fallback, which exceeded Vercel's ~295s request lifespan and got rejected by the drain_grace_period >= request_lifespan check in engine/packages/pegboard/src/ops/runner_config/upsert.rs.
Verified correct:
connect-manual-serverless-frame.tsx: adding drainGracePeriod: values.drainGracePeriod to the legacy branch matches the already-present handling in the new-protocol branch — good, this fixes the bug for all serverless providers, not just Vercel.
New VERCEL_REQUEST_LIFESPAN - 1 max bound in connect-vercel-form.tsx lines up with the backend's strict < check (drain_grace_period >= request_lifespan is rejected), so the frontend validation won't let users submit a value the backend would reject.
Default of 5s is well under the default actor_stop_threshold (1800s), so no conflict with the other backend check.
Deduplicating VERCEL_REQUEST_LIFESPAN/VERCEL_DRAIN_GRACE_PERIOD/configurationSchema into connect-vercel-form.tsx and re-exporting from connect-quick-vercel-form.tsx is a nice cleanup — previously the quick-connect flow hardcoded requestLifespan: VERCEL_SERVERLESS_MAX_DURATION - 5 and drainGracePeriod: 0 separately, which is exactly how they could drift out of sync with the full Vercel flow.
No stale references to the removed VERCEL_SERVERLESS_MAX_DURATION export from connect-vercel-frame.tsx remain elsewhere.
Suggestion (test coverage):
The bug was a missing field in one branch of buildServerlessConfig, and the fix is a one-line addition — exactly the kind of regression a quick unit test would catch if it's ever dropped again (e.g. when a third payload branch is added). Given CLAUDE.md's emphasis on regression tests for bug fixes, consider adding a small test that asserts buildServerlessConfig includes drainGracePeriod in the legacy-branch payload, and/or a schema test asserting connect-vercel-form's configurationSchema rejects drainGracePeriod >= VERCEL_REQUEST_LIFESPAN and defaults to 5. The PR description mentions 31 existing tests pass, but none appear to target this file/behavior directly.
Minor/non-blocking:
drainGracePeriod now has its default declared twice — once in the zod schema (.default(VERCEL_DRAIN_GRACE_PERIOD)) and again explicitly in each frame's RHF defaultValues. Not a bug (both reference the same constant), but worth a short comment noting why both are needed (zod default covers parse-time fallback if the field is ever omitted; RHF default seeds the input's displayed value).
Overall this looks correct and safe to merge; the test-coverage point is the only thing I'd push on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
drainGracePeriodwhen creating serverless runner configs through the legacy-compatible payload branchRoot cause
New runner configs have no existing
protocolVersion, so the frontend selected the legacy-compatible payload branch. That branch omitteddrainGracePeriod, causing the API to apply its 1800-second fallback, which is invalid for Vercel's 295-second request lifespan.Verification
pnpm --filter @rivetkit/engine-frontend check-typespnpm --filter @rivetkit/engine-frontend test(31 tests)pnpm --filter @rivetkit/engine-frontend buildgit diff --check