Skip to content

fix(rivetkit): log and surface actor startup failures - #5528

Merged
abcxff merged 2 commits into
mainfrom
stack/fix-rivetkit-log-and-surface-actor-startup-failures-wyxwxpum
Aug 11, 2026
Merged

fix(rivetkit): log and surface actor startup failures#5528
abcxff merged 2 commits into
mainfrom
stack/fix-rivetkit-log-and-surface-actor-startup-failures-wyxwxpum

Conversation

@abcxff

@abcxff abcxff commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@claude

claude Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review

Small, well-scoped fix to run_actor in rivetkit-rust/packages/rivetkit/src/start.rs. Wrapping the startup phase (input decode -> state creation -> create -> on_create -> on_start) in a single fallible block so failures reach the startup_ready handshake instead of silently dropping the sender is the right fix.

Verification

  • Confirmed the bug this fixes is real: previously, an error from A::create_state/A::create/on_create/on_start propagated via ? straight out of run_actor, dropping startup_ready without a reply. The receiver in rivetkit-cores ActorTask::spawn_run_handle (task.rs:1348-1353) would then see a closed channel and surface a generic "receive runtime startup ready reply" error instead of the real cause.
  • The fix pattern (RivetError::extract + anyhow::Error::new(...) on the error branch, raw error on the success branch/final return) matches the existing precedent in registry.rs::build_factory (the wrap_start failure path) and the NAPI adapters run_preamble handling in napi_actor_events.rs, so this brings the Rust wrapper manual-startup-ready handshake in line with both. It also matches the rivetkit-core CLAUDE.md rule: forward existing anyhow::Error across lifecycle/action replies by preserving structured RivetError data with RivetError::extract instead of stringifying it.
  • The eventual return Err(error) still returns the raw, un-extracted error as the run_actor future result, which is what handle_run_handle_outcome in task.rs logs via log_actor_error when it drains the run handle, consistent with the comment claim.
  • Tabs/formatting and comment style match CLAUDE.md conventions (complete sentences, no dashes).

Nits (non-blocking)

  • The new test run_actor_invalid_input_fails_to_start only exercises the input-decode failure branch. Since the whole point of the change is that create/on_create/on_start failures now share the same forwarding path, a second test that fails inside on_start (or on_create) would directly confirm the refactor did not just happen to work for the one branch that was reachable before this change too.
  • Minor duplication: the "extract + reply to startup_ready + return original error" pattern now exists in both registry.rs::build_factory (for wrap_start errors) and here (for the body of run_actor). Not worth abstracting for two call sites, just noting for awareness if a third one shows up later.

No correctness, security, or performance issues found. The change is on the actor startup path only (not a hot loop), and the extra Result wrapping/await has negligible cost.

@abcxff
abcxff force-pushed the stack/fix-rivetkit-treat-empty-actor-input-bytes-as-absent-ouvoqtns branch from 226de9f to e9dadf6 Compare July 31, 2026 05:27
@abcxff
abcxff force-pushed the stack/fix-rivetkit-log-and-surface-actor-startup-failures-wyxwxpum branch from f63600c to efaf873 Compare July 31, 2026 05:27
@abcxff
abcxff force-pushed the stack/fix-rivetkit-treat-empty-actor-input-bytes-as-absent-ouvoqtns branch from e9dadf6 to 0283e79 Compare July 31, 2026 06:03
@abcxff
abcxff force-pushed the stack/fix-rivetkit-log-and-surface-actor-startup-failures-wyxwxpum branch from efaf873 to 11b03c3 Compare July 31, 2026 06:03
@abcxff
abcxff force-pushed the stack/fix-rivetkit-treat-empty-actor-input-bytes-as-absent-ouvoqtns branch from 0283e79 to bf4c501 Compare August 3, 2026 20:17
@abcxff
abcxff force-pushed the stack/fix-rivetkit-log-and-surface-actor-startup-failures-wyxwxpum branch from 11b03c3 to cb11619 Compare August 3, 2026 20:17
@abcxff
abcxff force-pushed the stack/fix-rivetkit-treat-empty-actor-input-bytes-as-absent-ouvoqtns branch from bf4c501 to dd67c01 Compare August 10, 2026 17:16
@abcxff
abcxff force-pushed the stack/fix-rivetkit-log-and-surface-actor-startup-failures-wyxwxpum branch from cb11619 to 018143b Compare August 10, 2026 17:16
@abcxff
abcxff force-pushed the stack/fix-rivetkit-treat-empty-actor-input-bytes-as-absent-ouvoqtns branch from dd67c01 to 49b398a Compare August 10, 2026 20:35
@abcxff
abcxff force-pushed the stack/fix-rivetkit-log-and-surface-actor-startup-failures-wyxwxpum branch from 018143b to 2899a10 Compare August 10, 2026 20:35
@abcxff
abcxff force-pushed the stack/fix-rivetkit-log-and-surface-actor-startup-failures-wyxwxpum branch from 2899a10 to e5d0c23 Compare August 10, 2026 22:09
@abcxff
abcxff force-pushed the stack/fix-rivetkit-treat-empty-actor-input-bytes-as-absent-ouvoqtns branch from 49b398a to 49f6c6b Compare August 10, 2026 22:09
@abcxff
abcxff force-pushed the stack/fix-rivetkit-log-and-surface-actor-startup-failures-wyxwxpum branch from e5d0c23 to 7e2fcbd Compare August 11, 2026 13:39
@abcxff
abcxff changed the base branch from stack/fix-rivetkit-treat-empty-actor-input-bytes-as-absent-ouvoqtns to stack/fix-sdks-drop-rivet-util-metrics-dep-from-protocol-crates-to-unlink-rocksdb-woolkmvt August 11, 2026 13:39
@abcxff
abcxff force-pushed the stack/fix-rivetkit-log-and-surface-actor-startup-failures-wyxwxpum branch from 7e2fcbd to 82030ba Compare August 11, 2026 14:24
@abcxff
abcxff force-pushed the stack/fix-sdks-drop-rivet-util-metrics-dep-from-protocol-crates-to-unlink-rocksdb-woolkmvt branch from 69621d8 to c245c3a Compare August 11, 2026 14:24
@abcxff
abcxff force-pushed the stack/fix-rivetkit-log-and-surface-actor-startup-failures-wyxwxpum branch from 82030ba to d0770c7 Compare August 11, 2026 17:22
@abcxff
abcxff force-pushed the stack/fix-sdks-drop-rivet-util-metrics-dep-from-protocol-crates-to-unlink-rocksdb-woolkmvt branch from c245c3a to 686f265 Compare August 11, 2026 17:22
@abcxff
abcxff changed the base branch from stack/fix-sdks-drop-rivet-util-metrics-dep-from-protocol-crates-to-unlink-rocksdb-woolkmvt to main August 11, 2026 17:23
@abcxff
abcxff merged commit d0770c7 into main Aug 11, 2026
3 of 8 checks passed
@abcxff
abcxff deleted the stack/fix-rivetkit-log-and-surface-actor-startup-failures-wyxwxpum branch August 11, 2026 17:24
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