Skip to content

fix: update Rivet doc examples and peer dep#230

Open
NathanFlurry wants to merge 2 commits intomainfrom
NathanFlurry/fix-rivet-docs
Open

fix: update Rivet doc examples and peer dep#230
NathanFlurry wants to merge 2 commits intomainfrom
NathanFlurry/fix-rivet-docs

Conversation

@NathanFlurry
Copy link
Member

Summary

  • Fix resource leak in docs/security.mdx: The submitPrompt action was creating a new SandboxAgent.connect() + createSession() on every call without cleanup, leaking SDK connections and event subscriptions. Moved SDK/session setup to createVars and added onSleep cleanup, matching the pattern used in multiplayer.mdx and session-persistence.mdx.
  • Update stale peer dependency: sdks/persist-rivet/package.json had rivetkit >=0.5.0 but the lockfile shows rivetkit@2.0.42. Updated to >=2.0.0.

Review notes

Also reviewed against current rivet.dev/docs:

  • c.broadcast() without explicit events declaration is valid (confirmed by RivetKit reference)
  • Actor patterns (createVars, onSleep, setup, createClient) all match current API
  • Queue usage is an optional best-practice for concurrent state mutations but not required for these examples

Test plan

  • Verify docs render correctly
  • Confirm @sandbox-agent/persist-rivet still installs with rivetkit 2.x

🤖 Generated with Claude Code

NathanFlurry and others added 2 commits March 9, 2026 19:59
- Fix security.mdx: move SDK/session setup from per-action to createVars
  to prevent resource leaks (new SDK + session was created on every
  submitPrompt call without cleanup)
- Add onSleep cleanup hook matching multiplayer.mdx pattern
- Update persist-rivet peer dependency from >=0.5.0 to >=2.0.0
  (rivetkit is at 2.0.42)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@railway-app
Copy link

railway-app bot commented Mar 10, 2026

🚅 Deployed to the sandbox-agent-pr-230 environment in sandbox-agent

Service Status Web Updated (UTC)
website 😴 Sleeping (View Logs) Web Mar 10, 2026 at 3:54 am

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