Skip to content

refactor(frontend): support envoys#4651

Open
jog1t wants to merge 1 commit intomainfrom
04-14-refactor_frontend_support_envoys
Open

refactor(frontend): support envoys#4651
jog1t wants to merge 1 commit intomainfrom
04-14-refactor_frontend_support_envoys

Conversation

@jog1t
Copy link
Copy Markdown
Contributor

@jog1t jog1t commented Apr 14, 2026

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@railway-app
Copy link
Copy Markdown

railway-app bot commented Apr 14, 2026

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

Service Status Web Updated (UTC)
frontend-cloud 😴 Sleeping (View Logs) Web Apr 15, 2026 at 11:51 am
website 😴 Sleeping (View Logs) Web Apr 15, 2026 at 8:35 am
frontend-inspector 😴 Sleeping (View Logs) Web Apr 15, 2026 at 2:26 am
mcp-hub ✅ Success (View Logs) Web Apr 14, 2026 at 5:46 pm
kitchen-sink ❌ Build Failed (View Logs) Web Apr 14, 2026 at 5:46 pm
ladle ❌ Build Failed (View Logs) Web Apr 14, 2026 at 5:46 pm

Copy link
Copy Markdown
Contributor Author

jog1t commented Apr 14, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@jog1t jog1t marked this pull request as ready for review April 14, 2026 17:49
@claude
Copy link
Copy Markdown

claude bot commented Apr 14, 2026

PR Review: refactor(frontend): support envoys (#4651)

Summary

This draft PR refactors the frontend to support the new envoy runner protocol. The core changes are:

  1. Protocol detection: protocolVersion field in RunnerConfigResponse discriminates between legacy (runner pool) and new (envoy) configs.
  2. Deprecated fields: maxRunners, minRunners, slotsPerRunner, runnersMargin replaced by drainGracePeriod and maxConcurrentActors.
  3. Sleep/Reschedule actions: New ActorSleepButton and ActorRescheduleButton UI components, gated by canSleepActors / canRescheduleActors feature flags.
  4. Crash policy removed from UI: All actors now hardcoded to destroy crash policy.
  5. SDK updates: TypeScript, Go, and Rust SDK types updated with new fields.

Code Quality

1. Unnecessary as any casts

In connect-manual-serverless-frame.tsx, existing is typed as Record<string, Rivet.RunnerConfig> but protocolVersion only exists on Rivet.RunnerConfigResponse. The type should be changed to RunnerConfigResponse. In edit-runner-config.tsx, maxConcurrentActors is already defined on Rivet.RunnerConfigServerless so the as any cast is unnecessary.

2. Duplicated branching logic

The isNew branching block appears in at least four places across connect-manual-serverless-frame.tsx and edit-runner-config.tsx. Extract a shared buildServerlessConfigFromValues(values, isNew) helper.

3. defaultServerlessConfig still has deprecated fields

The fallback constant uses maxRunners: 100_000 and slotsPerRunner: 1. New envoy datacenters will pick up these legacy defaults.

4. hasProtocolVersion is all-or-nothing for mixed configs

Returns true if any datacenter has a protocol version, then drives field visibility for all datacenters. Can be misleading in mixed legacy/envoy environments.


Potential Bugs

5. isNew is inverted for fresh onboarding

During initial onboarding existing[dc] is undefined, so isNew is always false. This means onboarding always generates legacy-style configs. The fallback should default to isNew = true when there is no existing config.

6. Explicit maxRunners: 0, slotsPerRunner: 0 in new-config path

These deprecated fields are sent as explicit 0 rather than omitted. If the backend treats 0 differently from absent/null this could cause unexpected behavior.

7. Silent crashPolicy behavior change

The form previously allowed selecting crash policy (defaulting to Sleep). It is now silently hardcoded to destroy with no comment. Existing workflows relying on the sleep crash policy will change behavior after upgrade. This should be documented in the PR description and in a code comment.

8. drainGracePeriod missing from per-datacenter form defaults

In DatacenterSettingsForm, defaultValues do not explicitly populate drainGracePeriod or maxConcurrentActors, so forms for new envoy DCs may not have useful starting values.


Performance

9. Predicate-based query invalidation

The sleep/reschedule mutations in default-data-provider.tsx use a predicate function that scans all cached queries. A direct key-based invalidateQueries call would be more efficient.


Security

No obvious security issues. The new actorsSleep/actorsReschedule endpoints are standard authenticated API calls. Feature-flagging these to false in non-engine contexts is appropriate.


Test Coverage

No tests added (expected for a draft). Before merge, add unit tests for the buildServerlessConfig branching logic and the isNew detection path. The existing actor-status.tsx tests covering sleeping status are good.


Summary

The protocolVersion detection mechanism is a clean approach to backward compatibility. Key items to address before marking ready:

  • Inverted isNew logic for fresh onboarding (new installs always get legacy format)
  • Unnecessary as any casts that hide type issues
  • Duplicated branching logic across four sites
  • Undocumented crashPolicy behavior change from sleep to destroy

@github-actions
Copy link
Copy Markdown
Contributor

Preview packages published to npm

Install with:

npm install rivetkit@pr-4651

All packages published as 0.0.0-pr.4651.b85b389 with tag pr-4651.

Engine binary is shipped via @rivetkit/engine-cli on linux-x64-musl, linux-arm64-musl, darwin-x64, and darwin-arm64. Windows users should use the release installer or set RIVET_ENGINE_BINARY.

Docker images:

docker pull rivetdev/engine:slim-b85b389
docker pull rivetdev/engine:full-b85b389
Individual packages
npm install rivetkit@pr-4651
npm install @rivetkit/react@pr-4651
npm install @rivetkit/rivetkit-native@pr-4651
npm install @rivetkit/sqlite-wasm@pr-4651
npm install @rivetkit/workflow-engine@pr-4651

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