Skip to content

[slop]fix(rivetkit): surface raw error messages instead of generic#4985

Draft
abcxff wants to merge 1 commit into05-06-_slop_fix_rivetkit_remove_async_drizzle_db_proxyfrom
05-06-_slop_fix_rivetkit_surface_raw_error_messages_instead_of_generic
Draft

[slop]fix(rivetkit): surface raw error messages instead of generic#4985
abcxff wants to merge 1 commit into05-06-_slop_fix_rivetkit_remove_async_drizzle_db_proxyfrom
05-06-_slop_fix_rivetkit_surface_raw_error_messages_instead_of_generic

Conversation

@abcxff
Copy link
Copy Markdown
Contributor

@abcxff abcxff commented May 6, 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 May 6, 2026

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

Service Status Web Updated (UTC)
website 😴 Sleeping (View Logs) Web May 7, 2026 at 5:06 am
kitchen-sink ❌ Build Failed (View Logs) Web May 7, 2026 at 1:27 am
frontend-cloud ❌ Build Failed (View Logs) Web May 6, 2026 at 3:30 pm
frontend-inspector ❌ Build Failed (View Logs) Web May 6, 2026 at 3:30 pm
ladle ❌ Build Failed (View Logs) Web May 6, 2026 at 3:28 pm
mcp-hub ✅ Success (View Logs) Web May 6, 2026 at 3:28 pm

Copy link
Copy Markdown
Contributor Author

abcxff commented May 6, 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
Contributor

claude Bot commented May 6, 2026

Code Review

Overview

This PR makes two changes: (1) removes the RIVET_EXPOSE_ERRORS env-var gate so that all internal errors now always surface their raw message to callers, and (2) adds a structured sqlite.query_failed error type for user SQL errors (syntax, constraints, etc.).


Security Regression — build_internal always exposes raw messages

File: engine/packages/error/src/error.rs

The previous expose_internal_errors() gate controlled whether build_internal populated the message field. Without it, every unstructured anyhow::Error that falls through RivetError::extract as INTERNAL_ERROR will now include the raw error string in the message field sent to actor clients.

This directly contradicts CLAUDE.md:

The dev-mode toggle that exposes raw messages lives in core (reads env at build_internal), not in the TS bridge.

The toggle was meant to stay in build_internal — not be removed entirely. In production, an actor client will now receive raw internal error messages (e.g. file paths, DB connection details, internal state) for any unhandled actor error that isn't already a structured RivetError.

Suggested fix: Restore the env-var gate, or replace it with a build-time feature flag if the goal is a cleaner dev/prod split:

message: expose_internal_errors().then(|| format!("{}", error)),

Note: The API builder (engine/packages/api-builder) does its own chain traversal and sanitizes internal errors separately, so REST API responses are unaffected. The exposure is specifically through the rivetkit actor error response path where RivetError::extract is called and its result serialized for the caller.


sqlite.query_failed error type (good addition)

Files: rivetkit-rust/packages/rivetkit-core/src/error.rs, rivetkit-rust/engine/artifacts/errors/sqlite.query_failed.json, rivetkit-rust/packages/rivetkit-core/src/actor/sqlite.rs

The structured QueryFailed variant and its 400 status code mapping are correct. User SQL errors (constraint violations, syntax errors) are caller-triggered and should surface a meaningful message — this is the right classification.

The map_local_worker_error fall-through is reasonable: the function already handles all lifecycle errors (Overloaded, Closed, Dying, Fatal) explicitly, so the remainder are indeed SQLite engine errors from user-provided SQL. If internal VFS-level errors can also reach this path without being classified as lifecycle errors, they'd get a 400 query_failed instead of a 500 — but that's a separate concern from this PR.


Minor Issues

  • Missing EOF newline: rivetkit-rust/engine/artifacts/errors/sqlite.query_failed.json is missing a trailing newline.
  • PR description is empty: The checklist is unchecked and there is no summary, issue link, or test description. Even for a draft, a one-liner on intent helps reviewers.

Summary

Change Assessment
Remove RIVET_EXPOSE_ERRORS gate Needs the gate restored — violates CLAUDE.md and leaks internal error details in production
Add sqlite.query_failed error type Correct and well-scoped
Map unknown local worker errors to QueryFailed Reasonable given the call context
Missing EOF newline in JSON artifact Minor

@abcxff abcxff changed the base branch from 05-06-_slop_fix_rivetkit_remove_async_drizzle_db_proxy to graphite-base/4985 May 6, 2026 21:59
@abcxff abcxff force-pushed the graphite-base/4985 branch from 1134c24 to 38d756b Compare May 7, 2026 01:27
@abcxff abcxff force-pushed the 05-06-_slop_fix_rivetkit_surface_raw_error_messages_instead_of_generic branch from e506879 to 5b11eab Compare May 7, 2026 01:27
@abcxff abcxff changed the base branch from graphite-base/4985 to 05-06-_slop_fix_rivetkit_remove_async_drizzle_db_proxy May 7, 2026 01:27
@abcxff abcxff mentioned this pull request May 7, 2026
11 tasks
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