Skip to content

fix(workflows): keep long-running calls active - #7579

Merged
waleedlatif1 merged 4 commits into
stagingfrom
codex/fix-cli-manual-run-timeout
Sep 8, 2026
Merged

fix(workflows): keep long-running calls active#7579
waleedlatif1 merged 4 commits into
stagingfrom
codex/fix-cli-manual-run-timeout

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • keep long workflow and MCP calls active with negotiated heartbeat streams while preserving existing JSON responses
  • preserve cancellation, admission, and execution ID ownership across streamed runs and improve CLI transport diagnostics
  • document the streamed workflow response and configure the AWS example for long-lived connections

Type of Change

  • Bug fix

Testing

  • Full lint and 46-audit suite
  • App and CLI type checks
  • 148 workflow and MCP tests
  • 932 CLI tests
  • OpenAPI, docs manifest, CLI build, and strict Helm validation

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Sep 8, 2026 2:05am UTC

Request Review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This 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.

  • Adds NDJSON heartbeat and terminal-result framing for synchronous workflow execution.
  • Adds SSE keepalives for MCP and workflow event streams.
  • Preserves admission tickets and execution-ID claims until streamed runs settle.
  • Adds CLI parsing and fallback support for streamed and legacy workflow responses.
  • Correctly resolves all three previous review findings, including direct SSE-helper imports.

Confidence Score: 5/5

The 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.

Important Files Changed

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
Loading

Reviews (4): Last reviewed commit: "refactor(streaming): import SSE helpers ..." | Re-trigger Greptile

Comment thread apps/sim/app/api/v2/workflows/[workflowId]/execute/route.ts
Comment thread packages/sim-cli/src/commands/protocol/workflow-run-follow.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

Comment thread apps/sim/lib/copilot/request/session/sse.ts Outdated
@waleedlatif1
waleedlatif1 force-pushed the codex/fix-cli-manual-run-timeout branch from 9a49fcd to f13696f Compare September 8, 2026 02:03
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@waleedlatif1
waleedlatif1 merged commit 15fc6ab into staging Sep 8, 2026
38 checks passed
@waleedlatif1
waleedlatif1 deleted the codex/fix-cli-manual-run-timeout branch September 8, 2026 02:09
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