improvement(sockets): workflow switching state machine#4104
improvement(sockets): workflow switching state machine#4104icecrasher321 merged 2 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Updates the client Improves UX around realtime disruptions by adding an Reviewed by Cursor Bugbot for commit e5f55af. Configure here. |
Greptile SummaryThis PR introduces a The overall architecture is well-designed and comprehensively tested. Two minor cleanups are worth addressing before merge: a misleading log message when workflow visibility guards fire, and a dead Confidence Score: 5/5Safe to merge; both remaining findings are P2 style/cleanup suggestions with no impact on runtime correctness. The core state-machine design is sound, all key race-condition scenarios are covered by unit tests, and the refactor correctly preserves operation-cancellation semantics on workflow leave. The two open findings are a misleading log level and a dead interface field — neither affects runtime behavior. No files require special attention; the two style suggestions are in Important Files Changed
Sequence DiagramsequenceDiagram
participant UI as UI / URL change
participant SP as SocketProvider
participant JC as SocketJoinController
participant S as Socket.IO Server
UI->>SP: urlWorkflowId changes → requestWorkflow("B")
SP->>JC: requestWorkflow("B")
JC-->>SP: [join "B"]
SP->>S: emit join-workflow{B}
Note over SP: pendingJoin="B", currentWorkflowId still "A"<br/>Cursors hidden (activeId≠currentId)
alt Rapid switch to C before response
UI->>SP: requestWorkflow("C")
SP->>JC: requestWorkflow("C")
JC-->>SP: [] (pending for B, flush blocked)
S-->>SP: join-workflow-success{B}
SP->>JC: handleJoinSuccess("B")
JC-->>SP: [join "C"] (desired≠B → ignored)
SP->>S: emit join-workflow{C}
S-->>SP: join-workflow-success{C}
SP->>JC: handleJoinSuccess("C")
JC-->>SP: [] (apply=true)
SP->>SP: setCurrentWorkflowId("C")
else Retryable error
S-->>SP: join-workflow-error{B, retryable:true}
SP->>JC: handleJoinError({B, retryable:true})
JC-->>SP: [schedule-retry{B, delay}]
SP->>SP: setTimeout → retryJoin("B")
SP->>JC: retryJoin("B")
JC-->>SP: [join "B"]
SP->>S: emit join-workflow{B}
end
Reviews (1): Last reviewed commit: "improvement(sockets): workflow switching..." | Re-trigger Greptile |
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e5f55af. Configure here.

Summary
Workflow switching state machine to prevent timing based issues.
Type of Change
Testing
Tested manually. Add tests for state machine.
Checklist