improvement(hitl): streaming, async support + update docs #4058
improvement(hitl): streaming, async support + update docs #4058icecrasher321 merged 9 commits intostagingfrom
Conversation
PR SummaryMedium Risk Overview Async resume execution is now a first-class job type. Adds Streaming infrastructure was generalized and pause-aware. API routes and UI were updated to use the new streaming executor interface. Chat/form/workflow execute endpoints now pass Reviewed by Cursor Bugbot for commit 8075708. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds streaming and async support to the HITL resume endpoint by storing the original Confidence Score: 5/5Safe to merge — all new execution paths are gated behind correct The only finding is a P2 style suggestion (missing apps/sim/app/api/resume/[workflowId]/[executionId]/[contextId]/route.ts — streaming resume timeout/abort handling
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/resume/[workflowId]/[executionId]/[contextId]/route.ts | Core change: reads executionMode from the stored snapshot and dispatches streaming/sync/async resume accordingly. Logic is correct; minor gap is that abortSignal is not forwarded to startResumeExecution in the stream branch. |
| apps/sim/lib/workflows/streaming/streaming.ts | Refactored to accept executeFn callback, making the streaming utility reusable for resume; adds completedBlockIds tracking to filter output correctly on pause/resume. |
| apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts | Adds optional sendEvent, onStream, and onBlockComplete callbacks to StartResumeExecutionArgs so callers can inject streaming hooks; adds getPausedExecutionById helper for background job use. |
| apps/sim/background/resume-execution.ts | New TriggerDev background task for async resume; fetches paused execution and delegates to PauseResumeManager.startResumeExecution. |
| apps/sim/worker/processors/resume.ts | New BullMQ processor for resume-execution queue; mirrors the pattern of other processors. |
| apps/sim/executor/execution/snapshot-serializer.ts | Persists executionMode into the pause snapshot so it survives across the pause/resume boundary. |
Sequence Diagram
sequenceDiagram
participant Client
participant ExecuteRoute as POST /execute
participant Snapshot as ExecutionSnapshot
participant HITL as HITL Block
participant ResumeRoute as POST /resume
participant Manager as PauseResumeManager
Client->>ExecuteRoute: POST (sync/stream/async header)
ExecuteRoute->>Snapshot: store executionMode in metadata
ExecuteRoute->>HITL: workflow reaches HITL block
HITL-->>ExecuteRoute: pause, serialize snapshot
ExecuteRoute-->>Client: paused response + _resume URLs
Client->>ResumeRoute: POST /resume/.../contextId
ResumeRoute->>Snapshot: getStoredSnapshotConfig(executionMode)
alt executionMode == stream
ResumeRoute->>Manager: createStreamingResponse(executeFn)
Manager-->>Client: SSE stream (blocks after HITL)
else executionMode == sync (default)
ResumeRoute->>Manager: startResumeExecution()
Manager-->>Client: JSON result
else executionMode == async
ResumeRoute->>Manager: enqueue resume-execution job
Manager-->>Client: 202 Accepted
end
Reviews (2): Last reviewed commit: "fix tests" | Re-trigger Greptile
...pace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.tsx
Outdated
Show resolved
Hide resolved
|
bugbot run |
|
bugbot run |
|
bugbot run |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8075708. Configure here.
Summary
Respect headers passed in via initial execute calls and update docs to match expected behavior and add relevant endpoints.
Type of Change
Testing
Tested manually. Will test async support on staging environment.
Checklist