Skip to content

fix(next-js): set local dev drain grace period#5355

Merged
NathanFlurry merged 1 commit into
mainfrom
codex/rivetkit-quickstart-preview
Jul 7, 2026
Merged

fix(next-js): set local dev drain grace period#5355
NathanFlurry merged 1 commit into
mainfrom
codex/rivetkit-quickstart-preview

Conversation

@NathanFlurry

@NathanFlurry NathanFlurry commented Jun 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Sets drainGracePeriod: 30 in the Next.js local dev auto-config alongside the existing requestLifespan: 300.
  • Prevents the engine from rejecting the runner config because its default drain grace is 1800s, which is longer than Next's 300s request lifespan.

Validation

  • pnpm --filter @rivetkit/framework-base build
  • pnpm --filter @rivetkit/react build
  • pnpm --filter @rivetkit/next-js check-types
  • pnpm --filter @rivetkit/next-js build

@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5355 June 30, 2026 08:18 Destroyed
@NathanFlurry NathanFlurry changed the title [codex] fix RivetKit quickstart preview startup fix RivetKit quickstart preview startup Jun 30, 2026
@claude

claude Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

PR Review: set dev drain grace period for Next.js auto-config

The PR scope changed significantly since my last review (previously touched serverless/configure.ts with a generic resolveServerlessDrainGracePeriod clamp; that code no longer exists on this branch). Reviewing the current diff: a single line in rivetkit-typescript/packages/next-js/src/mod.ts adding drainGracePeriod: 30 next to the existing requestLifespan: 300 in the dev-mode configurePool block.

Root cause check confirms the fix is correct. In engine/packages/pegboard/src/ops/runner_config/upsert.rs:85-88, the engine rejects drain_grace_period >= request_lifespan, and if drain_grace_period is omitted it defaults to 1800s server-side (engine/packages/api-types/src/namespaces/runner_configs.rs:103). Since Next.js dev mode hardcodes requestLifespan: 300, omitting drainGracePeriod would always fail that upsert. Setting it to 30 (well under 300, and well under the actor_stop_threshold cap checked at upsert.rs:96) fixes it correctly.

Scope is appropriately narrow. I checked other rivetkit-typescript/packages/*/src callers of requestLifespan and next-js/src/mod.ts is the only place that hardcodes it outside of configure.ts's own default (60 * 60, which is far larger than any reasonable drainGracePeriod). So this one-line fix fully resolves the bug without leaving other frameworks exposed to the same failure mode.

Minor / non-blocking:

  • No magic-number comment on 30. A short comment (e.g. "must be less than requestLifespan per engine validation") would help a future reader who bumps requestLifespan avoid silently re-breaking this, since the two values are coupled but not derived from each other.
  • No test coverage for this package (there's no existing test infra under next-js/src), consistent with the tiny, config-literal nature of the change.

Overall a clean, minimal, correctly-scoped fix.

@railway-app

railway-app Bot commented Jun 30, 2026

Copy link
Copy Markdown

🚅 Deployed to the rivet-pr-5355 environment in rivet-frontend

Service Status Web Updated (UTC)
website ✅ Success (View Logs) Web Jul 7, 2026 at 9:10 pm
frontend-cloud 😴 Sleeping (View Logs) Web Jul 7, 2026 at 8:41 pm
frontend-inspector 😴 Sleeping (View Logs) Web Jul 7, 2026 at 4:45 am
kitchen-sink 😴 Sleeping (View Logs) Web Jul 7, 2026 at 2:59 am
mcp-hub ✅ Success (View Logs) Web Jun 30, 2026 at 9:16 am
ladle ✅ Success (View Logs) Web Jun 30, 2026 at 8:20 am

@NathanFlurry NathanFlurry force-pushed the codex/rivetkit-quickstart-preview branch from f323916 to 9cd4861 Compare June 30, 2026 09:15
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5355 June 30, 2026 09:15 Destroyed
@NathanFlurry NathanFlurry force-pushed the codex/rivetkit-quickstart-preview branch from 9cd4861 to d4284e1 Compare June 30, 2026 09:26
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5355 June 30, 2026 09:26 Destroyed
@NathanFlurry NathanFlurry force-pushed the codex/rivetkit-quickstart-preview branch from d4284e1 to 4f7b627 Compare July 7, 2026 22:13
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5355 July 7, 2026 22:13 Destroyed
@NathanFlurry NathanFlurry changed the title fix RivetKit quickstart preview startup fix(rivetkit): clamp serverless drain grace default Jul 7, 2026
@NathanFlurry NathanFlurry force-pushed the codex/rivetkit-quickstart-preview branch from 4f7b627 to a123681 Compare July 7, 2026 22:19
@NathanFlurry NathanFlurry changed the title fix(rivetkit): clamp serverless drain grace default fix(next-js): set dev drain grace default Jul 7, 2026
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5355 July 7, 2026 22:19 Destroyed
@NathanFlurry NathanFlurry changed the title fix(next-js): set dev drain grace default fix(next-js): set local dev drain grace period Jul 7, 2026
@NathanFlurry NathanFlurry marked this pull request as ready for review July 7, 2026 22:20
@NathanFlurry NathanFlurry merged commit e84a2a3 into main Jul 7, 2026
13 of 18 checks passed
@NathanFlurry NathanFlurry deleted the codex/rivetkit-quickstart-preview branch July 7, 2026 22:20
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