Skip to content

fix(kitchen-sink): default mock agent to local endpoint#4942

Merged
NathanFlurry merged 1 commit intomainfrom
05-04-fix_kitchen_sink_mock_agent_defaults
May 5, 2026
Merged

fix(kitchen-sink): default mock agent to local endpoint#4942
NathanFlurry merged 1 commit intomainfrom
05-04-fix_kitchen_sink_mock_agent_defaults

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

Copy link
Copy Markdown
Member Author

NathanFlurry commented May 4, 2026

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

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 4, 2026

PR Review: fix(kitchen-sink): default mock agent to local endpoint

Overview

This PR makes two main changes to the kitchen-sink example:

  1. Endpoint defaulting: The mock agentic loop panel now defaults to http://127.0.0.1:6420 (a local dev server) instead of rivetEndpoint (the app's RivetKit backend). The VITE_RIVET_ENDPOINT env var is also wired into the mock-agentic-loop.ts script as a fallback.
  2. Async handler cleanup: The void (async () => {...})() IIFE pattern in the WebSocket message handler is replaced with a direct async event handler.

Code Quality

Positive changes:

  • The IIFE-to-async-handler refactor in mock-agentic-loop.ts is a clean simplification. Both patterns are functionally equivalent here (the try/catch covers all async operations, so no unhandled rejections), but the new form is easier to read.
  • Splitting import.meta.env.VITE_RIVET_ENDPOINT into viteRivetEndpoint avoids repeating the env access and makes the intent clearer.
  • The close handler now uses await recordDebugEvent(...) instead of void recordDebugEvent(...), which is more semantically honest.

Issues and Suggestions

1. Orphaned localStorage entries (minor)

The storage key for the mock agentic loop endpoint now embeds the endpoint value:

const mockAgenticLoopEndpointStorageKey = `kitchen-sink:mock-agentic-loop:endpoint:${mockAgenticLoopEndpoint}`;

When VITE_RIVET_ENDPOINT changes between environments or sessions, the old key is abandoned in localStorage and never cleaned up. Minor leak in a dev tool, but worth noting.

2. DEFAULT_ON_SLEEP_DELAY_MS = 0 in actor source

The actor-side default in src/actors/testing/mock-agentic-loop.ts is changed from 15s to 0ms. This is a production actor file, not just a script default. If ON_SLEEP_DELAY_MS defaults to 0 in deployed environments, actors will immediately proceed on sleep with no delay. Worth confirming this actor is only used in kitchen-sink dev/testing contexts, or that 0ms is safe for the sleep logic.

3. Async close handler

The close handler is now async with await. Since the RivetKit WebSocket API is not a standard EventTarget, it's worth confirming whether the runtime awaits the returned Promise from the close handler. If not, behavior is identical to the prior void pattern (which is fine), but sets a slightly misleading expectation.


No Issues Found

  • The try/catch in the async message handler covers all branches. No new unhandled-rejection risk.
  • The VITE_RIVET_ENDPOINT fallback in scripts/mock-agentic-loop.ts is a sensible DX improvement.
  • No CLAUDE.md conventions are violated.

Summary

Low-risk, clean PR. The main thing to confirm is whether DEFAULT_ON_SLEEP_DELAY_MS = 0 in the actor source is intentional for all environments, and whether the storage key migration (orphaning old localStorage keys) is acceptable for this dev tool.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Preview packages published to npm

Install with:

npm install rivetkit@pr-4942

All packages published as 0.0.0-pr.4942.d6aaad8 with tag pr-4942.

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

@NathanFlurry NathanFlurry force-pushed the 05-04-fix_kitchen_sink_mock_agent_defaults branch from a247dd2 to 6c0e498 Compare May 4, 2026 15:36
Base automatically changed from 05-04-test_rivetkit_enable_driver_regressions to main May 5, 2026 14:57
@NathanFlurry NathanFlurry merged commit 6c0e498 into main May 5, 2026
22 of 24 checks passed
@NathanFlurry NathanFlurry deleted the 05-04-fix_kitchen_sink_mock_agent_defaults branch May 5, 2026 14:58
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