Skip to content

fix(webapp): abort workflow stream on human input pause - #39775

Open
Souravrajvi0 wants to merge 1 commit into
langgenius:mainfrom
Souravrajvi0:feat/human-input-resume-dup-33b5
Open

fix(webapp): abort workflow stream on human input pause#39775
Souravrajvi0 wants to merge 1 commit into
langgenius:mainfrom
Souravrajvi0:feat/human-input-resume-dup-33b5

Conversation

@Souravrajvi0

Copy link
Copy Markdown
Contributor

Summary

Fixes #39686

When a WebApp workflow pauses for human input, the initial sendWorkflowMessage POST stream stayed open while a resume SSE (/workflow/{id}/events) was opened. Both streams could deliver conflicting events — the aborted POST stream often emitted workflow_finished with Stopped status, causing the UI to show "Stopped by user" even though the worker completed successfully.

This change:

  • Tracks the active workflow stream via getAbortController
  • Aborts the active stream before opening the resume SSE on workflow_paused
  • Ignores stale Stopped events from the initial stream while the workflow is paused

Screenshots

Before After
UI shows "Stopped by user" after human input resume Workflow completes and UI shows success

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

When a WebApp workflow pauses for human input, keep the initial POST
stream from competing with the resume SSE. Abort the active stream
before opening /workflow/{id}/events and ignore stale Stopped events
from the aborted connection.

Fixes langgenius#39686
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 29, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebApp re-triggers a duplicate full workflow run after Human Input resume, causing 'Stopped by user'

1 participant