Skip to content

feat(rivetkit): add actor run handler#4005

Closed
NathanFlurry wants to merge 1 commit intoactor-messagesfrom
01-21-feat_rivetkit_add_actor_run_handler
Closed

feat(rivetkit): add actor run handler#4005
NathanFlurry wants to merge 1 commit intoactor-messagesfrom
01-21-feat_rivetkit_add_actor_run_handler

Conversation

@NathanFlurry
Copy link
Member

No description provided.

@railway-app
Copy link

railway-app bot commented Jan 22, 2026

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

Service Status Web Updated (UTC)
website ❌ Build Failed (View Logs) Web Jan 30, 2026 at 8:21 am
mcp-hub ✅ Success (View Logs) Web Jan 30, 2026 at 8:20 am
frontend-inspector ❌ Build Failed (View Logs) Web Jan 28, 2026 at 1:13 am
frontend-cloud ❌ Build Failed (View Logs) Web Jan 28, 2026 at 1:13 am

Copy link
Member Author

NathanFlurry commented Jan 22, 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


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

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

@claude
Copy link

claude bot commented Jan 22, 2026

PR Review: feat(rivetkit): add actor run handler

Summary

This PR introduces a run handler as an alias for onWake in the RivetKit actor lifecycle. The change includes proper validation to prevent defining both handlers simultaneously, along with comprehensive documentation updates.

✅ Strengths

  1. Clean Implementation: The aliasing is implemented correctly using the nullish coalescing operator (??) to prioritize run over onWake
  2. Proper Validation: The Zod schema includes a refinement that prevents users from defining both run and onWake, with a clear error message
  3. Type Safety: Both run and onWake are properly included in all relevant type definitions (ActorConfig, ActorConfigInput)
  4. Documentation: Extensive documentation updates in the lifecycle guide showing the new run handler with practical examples
  5. Backwards Compatibility: Existing code using onWake continues to work without changes

🔍 Code Quality Observations

TypeScript Implementation (config.ts)

  • Clean addition to schema validation (line 135-140)
  • Consistent JSDoc comments explaining the alias relationship
  • Proper inclusion in type definitions (lines 526, 587)

Runtime Implementation (mod.ts)

  • Simple, clear implementation with explanatory comment (lines 855-856)
  • Uses nullish coalescing to give run priority over onWake

Documentation (lifecycle.mdx)

  • Restructured to make run the primary handler with onWake as the documented alias
  • All examples updated to use run instead of onWake
  • Clear note explaining the relationship between the two

🤔 Considerations & Questions

  1. Test Coverage: I don't see test additions for the new run handler. Consider adding tests to verify:

    • That run is called correctly when defined
    • That the validation properly rejects defining both run and onWake
    • That run takes priority when both are somehow defined (though validation should prevent this)
  2. Migration Path: While backward compatibility is maintained, there's no guidance for users on:

    • Whether they should migrate from onWake to run
    • If onWake will be deprecated in the future
    • What the long-term plan is for these two handlers
  3. Error Message Clarity: The error message could be more actionable:

    message: "Cannot define both 'run' and 'onWake'. 'run' is an alias for 'onWake'.",

    Consider: "Cannot define both 'run' and 'onWake'. Use either 'run' (recommended) or 'onWake'."

  4. Documentation Frontmatter: The lifecycle.mdx file has its frontmatter removed (converted to H1). Was this intentional? This might affect:

    • SEO (missing description metadata)
    • Site navigation/sidebar generation
    • The skill: true flag which may be used for features
  5. Code Examples in Docs: Several documentation examples have been simplified (types removed, etc.). While this makes them more readable, ensure they're still runnable/accurate. For instance:

    • Line 283: Missing validateToken function definition
    • Line 342: Generic types simplified - verify this still type-checks

🎯 Recommendations

High Priority:

  1. Add test coverage for the run handler and mutual exclusion validation
  2. Restore the frontmatter in lifecycle.mdx or confirm its removal was intentional
  3. Verify all simplified code examples in the documentation are valid

Medium Priority:
4. Consider adding a migration guide or note about the relationship between run and onWake
5. Update error message to be more actionable
6. Consider adding a deprecation notice if onWake will eventually be removed

Low Priority:
7. Add inline examples in the JSDoc for the run handler in config.ts

🔒 Security & Performance

  • ✅ No security concerns identified
  • ✅ No performance impact (simple aliasing)
  • ✅ Proper validation prevents configuration errors

📊 Overall Assessment

This is a well-implemented feature that improves the API ergonomics by providing a more intuitive name for the wake handler. The implementation is clean and maintains backward compatibility. The main areas for improvement are test coverage and clarifying the documentation changes (particularly the frontmatter removal).

Recommendation: Approve with minor changes (add tests, verify documentation frontmatter)

@NathanFlurry NathanFlurry force-pushed the 01-21-feat_rivetkit_add_actor_run_handler branch from 70b8762 to 79b136e Compare January 22, 2026 07:14
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4005 January 22, 2026 07:14 Destroyed
@NathanFlurry NathanFlurry force-pushed the 01-21-feat_rivetkit_add_actor_run_handler branch from 79b136e to 2fe5b7d Compare January 22, 2026 17:45
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4005 January 22, 2026 17:45 Destroyed
@NathanFlurry NathanFlurry force-pushed the 01-21-feat_rivetkit_add_actor_run_handler branch from 2fe5b7d to 329640c Compare January 24, 2026 23:35
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4005 January 24, 2026 23:35 Destroyed
@NathanFlurry NathanFlurry force-pushed the 01-21-feat_rivetkit_add_actor_run_handler branch from 329640c to 4e8ca02 Compare January 28, 2026 01:12
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4005 January 28, 2026 01:12 Destroyed
@jog1t jog1t force-pushed the 01-21-feat_rivetkit_add_actor_run_handler branch from 4e8ca02 to f1e4e30 Compare January 28, 2026 19:55
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4005 January 28, 2026 19:55 Destroyed
@NathanFlurry NathanFlurry changed the base branch from actor-messages to graphite-base/4005 January 30, 2026 08:18
@NathanFlurry NathanFlurry force-pushed the 01-21-feat_rivetkit_add_actor_run_handler branch from f1e4e30 to 1c34e5c Compare January 30, 2026 08:19
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4005 January 30, 2026 08:19 Destroyed
@NathanFlurry NathanFlurry changed the base branch from graphite-base/4005 to actor-messages January 30, 2026 08:19
@jog1t jog1t force-pushed the 01-21-feat_rivetkit_add_actor_run_handler branch from 1c34e5c to 539fdca Compare January 30, 2026 21:29
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4005 January 30, 2026 21:29 Destroyed
@NathanFlurry NathanFlurry changed the base branch from actor-messages to graphite-base/4005 January 30, 2026 21:49
@jog1t jog1t changed the base branch from graphite-base/4005 to actor-messages January 30, 2026 23:26
@NathanFlurry NathanFlurry changed the base branch from actor-messages to graphite-base/4005 January 31, 2026 03:29
@NathanFlurry NathanFlurry force-pushed the 01-21-feat_rivetkit_add_actor_run_handler branch from 539fdca to 21606fd Compare February 3, 2026 19:40
@NathanFlurry NathanFlurry changed the base branch from graphite-base/4005 to actor-messages February 3, 2026 19:40
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4005 February 3, 2026 19:41 Destroyed
@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 4, 2026

Merge activity

  • Feb 4, 8:36 PM UTC: NathanFlurry added this pull request to the Graphite merge queue.
  • Feb 4, 8:37 PM UTC: CI is running for this pull request on a draft pull request (#4114) due to your merge queue CI optimization settings.
  • Feb 4, 8:38 PM UTC: Merged by the Graphite merge queue via draft PR: #4114.

graphite-app bot pushed a commit that referenced this pull request Feb 4, 2026
@graphite-app graphite-app bot closed this Feb 4, 2026
@graphite-app graphite-app bot deleted the 01-21-feat_rivetkit_add_actor_run_handler branch February 4, 2026 20:38
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4005 February 4, 2026 20:38 Destroyed
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