feat(rivetkit): rerun workflows from inspector#4533
Conversation
|
🚅 Deployed to the rivet-pr-4533 environment in rivet-frontend
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
9c41fe2 to
1d0028d
Compare
1d0028d to
8fb8fed
Compare
339c3bc to
7b7c06e
Compare
8fb8fed to
769e543
Compare
Merge activity
|
|
PR Review: feat(rivetkit): rerun workflows from inspector This PR adds UI support for replaying workflows from a specific step in the Actor workflow inspector via two surfaces: a right-click context menu on graph nodes and a persistent toolbar button. HIGH SEVERITY Issue: data.canReplay is always undefined — context menu never opens In workflow-visualizer.tsx, the onNodeContextMenu handler gates on data.canReplay. However, canReplay is never set on any node's data in workflow-to-xyflow.ts or the WorkflowNodeData interface. Because the interface has an index signature ([key: string]: unknown), TypeScript will not catch this. data.canReplay will always be undefined and the context menu will never open. The field needs to be added to the WorkflowNodeData interface and populated wherever node data is constructed. MEDIUM SEVERITY Issue: Duplicate endpoint in skill-base-rivetkit.md The line "POST /inspector/workflow/replay" appears to have been added at line 35, but also already exists later in the same file, creating a duplicate bullet point. Issue: Hint text shown regardless of protocol version The helper text "Right-click a previous step to replay the workflow from there." renders unconditionally, even when inspector.inspectorProtocolVersion is less than 4. Users on older inspectors see a hint for a feature that will not work. This should be gated on the same version check used for the button and onReplayStep prop. LOW SEVERITY Issue: Context menu may clip off viewport edges The menu is positioned at clientX/clientY with no boundary detection. Nodes near the right or bottom edge will cause the menu to overflow off-screen. Consider checking against window.innerWidth / window.innerHeight and flipping the anchor. Issue: isReplaying state can become stale isReplaying is captured into contextMenu state at menu-open time from data.isReplaying. If a replay is triggered elsewhere after the menu opens, the disabled state in the context menu will not update. Consider deriving this from the mutation state reactively. Issue: canReplayCurrentStep does not handle first-attempt failures The toolbar button requires retryCount > 0, so a step that fails on its first attempt will not show the button. If first-attempt replay is desirable, the condition should be relaxed or at minimum documented. Issue: canReplay missing from WorkflowNodeData interface After fixing the runtime bug above, the TypeScript interface should include canReplay as an optional boolean for type safety. CODE QUALITY The implementation is generally well-structured. The useEffect for outside-click/Escape dismissal is correct and properly cleans up listeners. Using globalThis.Node to disambiguate from React's Node type is a thoughtful detail. Tailwind classes on the context menu correctly mirror shadcn/ui dropdown styling. The version guard inspectorProtocolVersion >= 4 is consistently applied across the toolbar button and onReplayStep prop. |

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: