Skip to content

chore(kitchen-sink): configurable endpoint#4766

Draft
NathanFlurry wants to merge 1 commit intosleep-cleanup/17-stop-reason-and-fallthrough-fixfrom
04-24-chore_kitchen-sink_configurable_endpoint
Draft

chore(kitchen-sink): configurable endpoint#4766
NathanFlurry wants to merge 1 commit intosleep-cleanup/17-stop-reason-and-fallthrough-fixfrom
04-24-chore_kitchen-sink_configurable_endpoint

Conversation

@NathanFlurry
Copy link
Copy Markdown
Member

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

This was referenced Apr 24, 2026
Copy link
Copy Markdown
Member Author

NathanFlurry commented Apr 24, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

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

@claude
Copy link
Copy Markdown

claude Bot commented Apr 24, 2026

PR Review: chore(kitchen-sink): configurable endpoint

Summary: This PR makes the Rivet endpoint configurable via VITE_RIVET_ENDPOINT in the kitchen-sink example and adds an onSleep lifecycle handler to counterWithLifecycle. The majority of the diff is automated reformatting.


Bug: Production Endpoint Regression

Severity: Medium

The old endpoint logic:

const rivetEndpoint = import.meta.env.DEV
    ? "http://localhost:6420"
    : `${window.location.origin}/api/rivet`;

The new logic:

const rivetEndpoint =
    import.meta.env.VITE_RIVET_ENDPOINT ?? "http://localhost:6420";

The original code routed production traffic through the Hono server at /api/rivet (served by src/server.ts), which is the canonical server-side registry handler. The new code removes that production path and falls back to http://localhost:6420 (the raw envoy port) unless VITE_RIVET_ENDPOINT is explicitly set at build time.

Since VITE_RIVET_ENDPOINT is a Vite build-time variable, it must be set before vite build runs. The Dockerfile does not set it, and there is no .env.example documenting it. Any deployment built without VITE_RIVET_ENDPOINT will silently use http://localhost:6420 in production — bypassing the Hono server and connecting to a port that is not publicly exposed.

Recommendation: Restore the production fallback and use VITE_RIVET_ENDPOINT only as an override:

const rivetEndpoint =
    import.meta.env.VITE_RIVET_ENDPOINT ??
    (import.meta.env.DEV
        ? "http://localhost:6420"
        : `${window.location.origin}/api/rivet`);

Or, if the intent is to fully replace the old approach, update the Dockerfile with ARG/ENV VITE_RIVET_ENDPOINT and document the variable in the README.


Minor: onSleep Demo Could Use a Clarifying Comment

File: examples/kitchen-sink/src/actors/counter/lifecycle.ts

onSleep: async (c) => {
    c.state.events.push("onSleep:start");
    await new Promise<void>((resolve) => setTimeout(resolve, 1000));
    c.state.events.push("onSleep:end");
},

The 1-second delay is fine since the default sleepGracePeriod is 15,000 ms. A short inline comment noting that the delay is intentional and demonstrates an async sleep hook would help users learning from this example understand the grace period relationship.


Formatting Churn

Roughly 80% of the diff is formatting-only changes: line-wrapping function signatures, arrow function parentheses, JSX indentation, and promise chain alignment. These are all minor cosmetic improvements with no behavioral impact.


Summary

Category Finding Severity
Bug Production endpoint regression — no fallback to /api/rivet for deployed builds without VITE_RIVET_ENDPOINT Medium
Documentation VITE_RIVET_ENDPOINT not documented in README or Dockerfile Low
Code quality onSleep async demo would benefit from a comment explaining the grace period relationship Low
Formatting Large automated reformatting — no issues found None

The production endpoint regression is the main concern and should be addressed before merging.

@github-actions
Copy link
Copy Markdown
Contributor

Preview packages published to npm

Install with:

npm install rivetkit@pr-4766

All packages published as 0.0.0-pr.4766.3ff566a with tag pr-4766.

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-3ff566a
docker pull rivetdev/engine:full-3ff566a
Individual packages
npm install rivetkit@pr-4766
npm install @rivetkit/react@pr-4766
npm install @rivetkit/rivetkit-napi@pr-4766
npm install @rivetkit/workflow-engine@pr-4766

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