fix(workflows): keep long-running calls active - #7579
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Greptile SummaryThis PR adds negotiated heartbeat transports for long-running workflow and MCP calls while retaining ordinary JSON behavior for clients that do not opt in. It also propagates cancellation and execution ownership through streamed runs, adds shared media-type/SSE/NDJSON utilities, improves CLI transport diagnostics, updates the CLI login method interface, and documents the new workflow response format.
Confidence Score: 5/5The PR appears safe to merge because no actionable new failure or outstanding previous finding remains. The recent changes fully remove the non-barrel SSE-helper re-export and update consumers to import directly from the shared source. The earlier media negotiation and CLI error-translation findings are also covered by exact positive-quality parsing and translated streamed-run errors, respectively. No new blocking or non-blocking issue was established.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/v2/workflows/[workflowId]/execute/route.ts | Negotiates NDJSON result streams, emits heartbeats, and transfers admission-ticket ownership until execution settles. |
| apps/sim/lib/workflows/executor/execute-service.ts | Adds pending synchronous execution results with cancellation and deferred execution-ID claim settlement. |
| apps/sim/app/api/mcp/serve/[serverId]/route.ts | Adds negotiated SSE keepalives and cancellation propagation for long-running MCP tool calls. |
| apps/sim/lib/workflows/streaming/streaming.ts | Keeps existing workflow SSE connections active with periodic comment frames and lifecycle cleanup. |
| packages/sim-cli/src/commands/protocol/workflow-run-follow.ts | Consumes heartbeat-delimited workflow results while retaining compatibility with legacy JSON responses and CLI error translation. |
| packages/sim-cli/src/http/ndjson.ts | Introduces incremental NDJSON parsing with malformed-data handling and reader cleanup. |
| apps/sim/lib/core/utils/media-types.ts | Implements exact positive-quality media-type negotiation, including explicit rejection and malformed parameter handling. |
| packages/sim-cli/src/commands/auth.ts | Replaces legacy login flow flags with explicit OAuth and API-key method selection. |
Sequence Diagram
sequenceDiagram
participant Client
participant Route as Workflow/MCP Route
participant Executor
Client->>Route: Request with streaming Accept type
Route->>Executor: Start execution with cancellation signal
Route-->>Client: Immediate heartbeat
loop Every 15 seconds
Route-->>Client: Heartbeat/keepalive
end
Executor-->>Route: Terminal result
Route-->>Client: Final NDJSON or SSE message
Route->>Route: Release admission and execution ownership
Reviews (4): Last reviewed commit: "refactor(streaming): import SSE helpers ..." | Re-trigger Greptile
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
9a49fcd to
f13696f
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
Type of Change
Testing
Checklist