Skip to content

feat(workflow): connect workflow visualizer with live data#4153

Open
jog1t wants to merge 1 commit into02-06-feat_sentry_use_correct_envfrom
02-07-feat_workflow_connect_workflow_visualizer_with_live_data
Open

feat(workflow): connect workflow visualizer with live data#4153
jog1t wants to merge 1 commit into02-06-feat_sentry_use_correct_envfrom
02-07-feat_workflow_connect_workflow_visualizer_with_live_data

Conversation

@jog1t
Copy link
Contributor

@jog1t jog1t commented Feb 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

@jog1t jog1t mentioned this pull request Feb 6, 2026
11 tasks
@jog1t jog1t marked this pull request as ready for review February 6, 2026 23:32
Copy link
Contributor Author

jog1t commented Feb 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


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.

@jog1t jog1t mentioned this pull request Feb 6, 2026
11 tasks
@claude
Copy link

claude bot commented Feb 6, 2026

Code Review: Workflow Visualizer Live Data Integration

Summary

This PR successfully connects the workflow visualizer with live data from the inspector protocol. The implementation is well-structured with proper data transformation and React Query integration.


✅ Strengths

Architecture & Design

  • Clean separation of concerns: New transform-workflow-history.ts file isolates transformation logic from UI components
  • Proper data flow: WebSocket → Inspector Context → React Query → UI components
  • Type safety: Strong TypeScript types throughout the transformation pipeline

Implementation Quality

  • Comprehensive transformation: Handles all workflow entry types (step, loop, sleep, message, checkpoint, join, race, removed)
  • Error handling: Proper try-catch in transformWorkflowHistoryFromInspector with fallback behavior
  • Real-time updates: WorkflowHistoryUpdated message handler enables live workflow state updates
  • Consistent naming: Added name parameter to action resolvers for better debugging

🔍 Issues & Recommendations

1. Potential Memory Leak in ActionsManager (Medium Priority)

Location: actor-inspector-context.tsx:962-971

The timeout in createResolver is not cleaned up if the promise resolves before timeout. This could accumulate timers.

Recommendation:

createResolver<T = void>(options?: {
  timeoutMs?: number;
  name?: string;
}): { id: number; promise: Promise<T> } {
  const id = this.nextId++;
  const { promise, resolve, reject } = Promise.withResolvers<T>();
  this.suspensions.set(id, { promise, resolve, reject });
  const timeoutMs = options?.timeoutMs ?? 2_000;

  const timeoutId = setTimeout(() => {
    if (this.suspensions.has(id)) {
      reject(new Error(`Action timed out: ${options?.name ?? "unknown"}`));
      this.suspensions.delete(id);
    }
  }, timeoutMs);

  // Clear timeout when resolved
  const wrappedResolve = (value: T) => {
    clearTimeout(timeoutId);
    resolve(value);
  };
  
  this.suspensions.set(id, { promise, resolve: wrappedResolve, reject });
  return { id, promise };
}

2. Silent Error Handling in decodeCborOrNull (Low Priority)

Location: transform-workflow-history.ts:11-18

The function silently catches all decode errors. Consider logging for debugging.

3. Type Assertion Without Validation (Low Priority)

Location: transform-workflow-history.ts:135

originalType: kind.val.originalType as EntryKindType,

This assumes originalType is always valid. Consider runtime validation.

4. Workflow State Derivation Logic (Low Priority)

Location: transform-workflow-history.ts:209-218

The condition at line 216 could be clearer - it's checking if the workflow has started but not finished.

5. Fallback Value (Low Priority)

Location: transform-workflow-history.ts:220

workflowId: entries[0]?.id ?? "unknown",

Consider if "unknown" is appropriate - it might mask data issues.


🧪 Testing Recommendations

  1. Test workflow state transitions: Verify pending → running → completed/failed updates work
  2. Test error scenarios: Malformed data, missing metadata, timeouts
  3. Test edge cases: Empty workflows, deeply nested loops/branches
  4. Memory leak testing: Verify action resolvers don't accumulate

📝 Minor Observations

  1. Import organization: Line 6 of transform-workflow-history.ts is very long - consider breaking it up
  2. Placeholder query: actorIsWorkflowEnabledQueryOptions always returns false - update when implemented
  3. Error consistency: Line 938 returns { history: null, isEnabled: true } on error - should isEnabled be false?
  4. Code formatting: Many formatting changes make the diff harder to review

✨ Overall Assessment

Quality: High
Test Coverage: Needs improvement (no tests added)
Documentation: Good
Breaking Changes: None

This is a solid implementation that successfully integrates live workflow data. Main concerns are around error handling edge cases and potential memory management. Code is production-ready with the minor improvements suggested above.

Recommendation: ✅ Approve with minor suggestions


🎯 Action Items

  • Add timeout cleanup to ActionsManager
  • Add logging to CBOR decode failures
  • Add unit tests for transformWorkflowHistory
  • Verify memory usage with long-running workflows

@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 6, 2026

Graphite Automations

"Test" took an action on this PR • (02/06/26)

1 assignee was added to this PR based on Kacper Wojciechowski's automation.

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