Skip to content

improvement(release): code cleanup#4069

Merged
icecrasher321 merged 1 commit intostagingfrom
improvement/comments-addr
Apr 9, 2026
Merged

improvement(release): code cleanup#4069
icecrasher321 merged 1 commit intostagingfrom
improvement/comments-addr

Conversation

@icecrasher321
Copy link
Copy Markdown
Collaborator

Summary

Dead code from forms sse route.

Type of Change

  • Documentation
  • Other: Code Cleanup

Testing

N/A

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.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Apr 9, 2026 6:14am

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 9, 2026

PR Summary

Low Risk
Low risk cleanup and documentation alignment; main runtime change is simplifying stream draining for form submissions and tightening a resume-mode conditional, which should not affect behavior outside those endpoints.

Overview
Updates HITL documentation to reflect the async resume response now returning success/async, jobId, and a statusUrl, and adds guidance to poll GET /api/jobs/{jobId} for completion.

Cleans up the form submission API to stop parsing SSE payloads and instead simply drain the stream until completion.

Adjusts the resume API to run the synchronous JSON response path only when the stored execution mode is explicitly sync (instead of any non-async mode).

Reviewed by Cursor Bugbot for commit a6ed00b. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 9, 2026

Greptile Summary

This PR removes dead SSE-parsing code from the form submission route, tightens the sync-mode guard in the resume route from executionMode !== 'async' to the explicit executionMode === 'sync', and corrects the HITL documentation to reflect the real async-resume response shape (including jobId and statusUrl).

Confidence Score: 5/5

Safe to merge — all three changes are correct cleanups with no behavioral regressions.

Dead code removal in form route is unambiguous. The resume route guard change (!== 'async'=== 'sync') is semantically equivalent given the type-constrained executionMode values ('sync' | 'stream' | 'async'). Docs now match the actual API response. No P0/P1 findings.

No files require special attention.

Vulnerabilities

No security concerns identified.

Important Files Changed

Filename Overview
apps/sim/app/api/form/[identifier]/route.ts Removes dead SSE-parsing code (unused lastOutput variable, TextDecoder, line-splitting, JSON parse) from stream drain loop — replaced with a simpler drain-only loop.
apps/sim/app/api/resume/[workflowId]/[executionId]/[contextId]/route.ts Changes sync-mode guard from executionMode !== 'async' to the more explicit executionMode === 'sync', making each execution-mode branch mutually exclusive and clearer.
apps/docs/content/docs/en/blocks/human-in-the-loop.mdx Updates async-mode resume docs to show the actual response shape (with jobId/statusUrl) and adds the /api/jobs/{jobId} polling endpoint — correcting previously stale documentation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[POST /api/resume] --> B{isApiCaller?}
    B -- No --> F[Fire-and-forget\nstartResumeExecution]
    B -- Yes --> C{executionMode}
    C -- stream --> D[SSE streaming response\nwith SSE_HEADERS]
    C -- sync --> E[Await startResumeExecution\nReturn JSON result]
    C -- async --> G[Enqueue BullMQ/job-queue\nReturn 202 + jobId + statusUrl]
    G --> H[GET /api/jobs/jobId\nPoll for completion]
Loading

Reviews (1): Last reviewed commit: "improvement(release): address comments" | Re-trigger Greptile

@icecrasher321 icecrasher321 merged commit dc7d876 into staging Apr 9, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the improvement/comments-addr 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