Skip to content

fix(rivetkit): keep internal error exposure behavior consistent#4661

Draft
NathanFlurry wants to merge 1 commit intobreak-up/stabilize-driver-lifecycle-testsfrom
break-up/keep-error-exposure-consistent
Draft

fix(rivetkit): keep internal error exposure behavior consistent#4661
NathanFlurry wants to merge 1 commit intobreak-up/stabilize-driver-lifecycle-testsfrom
break-up/keep-error-exposure-consistent

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 Apr 14, 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 14, 2026

PR Review: fix(rivetkit): keep internal error exposure behavior consistent

Overview

This PR makes two related changes to internal error exposure behavior:

  1. Removes NODE_ENV=development as an implicit trigger for exposing internal errors in both router-endpoints.ts and isolate-runtime.ts
  2. Fixes a bug in isolate-runtime.ts where RIVET_EXPOSE_ERRORS: "1" was hardcoded in the sandbox environment, meaning internal errors were always exposed in sandboxed processes regardless of actual environment configuration

Issues Found

Bug: Missed File — Inconsistency Remains

The PR title says "keep internal error exposure behavior consistent", but protocol/old.ts still retains the old NODE_ENV=development behavior:

// rivetkit-typescript/packages/rivetkit/src/actor/protocol/old.ts:303-304
getEnvUniversal("RIVET_EXPOSE_ERRORS") === "1" ||
    getEnvUniversal("NODE_ENV") === "development",

This file was not updated, leaving the behavior inconsistent across the three implementations of this check.

Security: Hardcoded Sandbox Error Exposure (Good Fix, Worth Calling Out)

The old code unconditionally set RIVET_EXPOSE_ERRORS: "1" in the sandbox environment regardless of the host environment. This was a security bug — it would always expose full internal error details to clients running inside sandboxed actors in production. The new code correctly inherits the value from the parent process only when set.

Developer Experience Impact

Developers who previously relied on NODE_ENV=development to automatically see detailed error messages must now explicitly set RIVET_EXPOSE_ERRORS=1. This is a deliberate tradeoff, but it's a behavioral change that could be surprising. A note in developer-facing documentation would help.


Minor Issues

  • Function signature inconsistency: getRequestExposeInternalError in isolate-runtime.ts takes no arguments, while the one in router-endpoints.ts takes _req: Request. These parallel implementations have diverged in signature. Consider unifying them or adding a comment explaining the difference.

  • No tests: No tests cover the change in RIVET_EXPOSE_ERRORS behavior (e.g., verifying that NODE_ENV=development no longer triggers error exposure, or that the sandbox correctly inherits the flag). Test coverage would prevent regressions.

  • Empty PR description: The PR body is unfilled template text. A brief explanation of what was inconsistent and why this change was needed would help reviewers and future git blame readers.


Summary

The core intent is correct and the sandbox hardcoding fix is a real security improvement. The main blocker is the missed protocol/old.ts case that leaves the original inconsistency in place.

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