Skip to content

fix(hitl): async resume#4064

Merged
icecrasher321 merged 2 commits intostagingfrom
fix/hitl-async
Apr 9, 2026
Merged

fix(hitl): async resume#4064
icecrasher321 merged 2 commits intostagingfrom
fix/hitl-async

Conversation

@icecrasher321
Copy link
Copy Markdown
Collaborator

Summary

Async resume response shape should have status url for polling executions status.

Type of Change

  • Bug fix

Testing

Test in staging env.

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
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 9, 2026 1:43am

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 9, 2026

PR Summary

Medium Risk
Changes the async resume API response contract and error handling; callers depending on prior status fields or fallback in-process execution may break, and dispatch failures now surface as 503s instead of silently continuing.

Overview
Updates the resume API’s async mode to capture and return the queued jobId, include success/async flags, and provide a statusUrl (/api/jobs/{jobId}) for polling job status.

Removes the previous “fallback to in-process resume” behavior when async dispatch fails; the endpoint now logs the failure and returns 503 instead. Also updates tests by mocking executeWorkflow to support the chat route test setup.

Reviewed by Cursor Bugbot for commit 85a1794. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 9, 2026

Greptile Summary

This PR adds a missing statusUrl field to the async resume execution response, so API callers can poll for execution status after a resume is queued. The fix mirrors the identical pattern already present in the /api/workflows/[id]/execute route.

Confidence Score: 5/5

Safe to merge — single-line targeted fix with no risk to existing paths.

The change adds one field (statusUrl) to the async 202 response body, exactly mirroring the pattern already used in the execute route. Sync and stream paths are untouched. No logic changes, no new dependencies. All remaining findings are P2 or pre-existing.

No files require special attention.

Vulnerabilities

No security concerns identified. The statusUrl is constructed from NEXT_PUBLIC_APP_URL (the intended public base URL) and points to an authenticated jobs-status endpoint that already validates the caller.

Important Files Changed

Filename Overview
apps/sim/app/api/resume/[workflowId]/[executionId]/[contextId]/route.ts Adds statusUrl to the async (202) resume response, consistent with the execute route pattern; pre-existing catch (error: any) violates the no-any rule but is out of scope for this PR.

Sequence Diagram

sequenceDiagram
    participant Caller as API Caller
    participant Resume as POST /api/resume/[workflowId]/[executionId]/[contextId]
    participant Queue as Job Queue (BullMQ / JobQueue)
    participant Jobs as GET /api/jobs/[jobId]

    Caller->>Resume: POST with resumeInput
    Resume->>Resume: validateWorkflowAccess
    Resume->>Resume: preprocessExecution
    Resume->>Resume: PauseResumeManager.enqueueOrStartResume
    alt executionMode === 'async'
        Resume->>Queue: enqueue 'resume-execution'
        Queue-->>Resume: jobId
        Resume-->>Caller: 202 { async: true, jobId, executionId, statusUrl }
        Note over Caller,Jobs: Caller polls statusUrl
        Caller->>Jobs: GET /api/jobs/{jobId}
        Jobs-->>Caller: { status, output, ... }
    else executionMode === 'stream'
        Resume-->>Caller: SSE stream
    else executionMode === 'sync' (default)
        Resume->>Resume: startResumeExecution (await)
        Resume-->>Caller: 200 { success, output, metadata }
    end
Loading

Reviews (1): Last reviewed commit: "fix(hitl): async resume" | Re-trigger Greptile

@icecrasher321
Copy link
Copy Markdown
Collaborator Author

bugbot run

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 85a1794. Configure here.

@icecrasher321 icecrasher321 merged commit a8468a6 into staging Apr 9, 2026
7 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/hitl-async branch April 9, 2026 07: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