Skip to content

fix: update message answer on completion after resume from pause - #38666

Open
EvanYao826 wants to merge 1 commit into
langgenius:mainfrom
EvanYao826:fix/human-input-after-branch
Open

fix: update message answer on completion after resume from pause#38666
EvanYao826 wants to merge 1 commit into
langgenius:mainfrom
EvanYao826:fix/human-input-after-branch

Conversation

@EvanYao826

Copy link
Copy Markdown
Contributor

Fixes #38614

Summary

When a ChatFlow workflow pauses (e.g., Human Input node) after a Question Classifier or Condition Branch node, the message is saved with PAUSED status and an empty answer. When the workflow resumes and completes, _handle_advanced_chat_message_end_event skipped saving the final state because _message_saved_on_pause was True, leaving the message stuck with PAUSED status and no answer in the conversation.

Root Cause

In _handle_workflow_paused_event, the message is saved and its status is set to PAUSED. On completion, _handle_advanced_chat_message_end_event guarded against double-saving with if not self._message_saved_on_pause, which skipped the update for resumed workflows. The final answer text was available in _task_state.answer, but never persisted.

Fix

Removed the _message_saved_on_pause guard so _save_message is always called on completion. _save_message uses _get_message (a SELECT by message_id) and updates the existing message in-place, so calling it again on completion overwrites the stale PAUSED snapshot with the correct answer and NORMAL status. This is safe because _save_message is idempotent — it only modifies the already-existing DB row.

When a ChatFlow workflow pauses (e.g., Human Input node) after a Question
Classifier or Condition Branch, the message is saved with PAUSED status
and empty answer. On resume and completion, _handle_advanced_chat_message_
end_event skipped saving the final state because _message_saved_on_pause
was True, leaving the message stuck with PAUSED status and no answer.

The fix removes the guard so _save_message is always called on completion.
_save_message updates the existing message in-place (it does a SELECT by
message_id), overwriting the stale PAUSED snapshot with the final
answer and NORMAL status.

Fixes langgenius#38614
@EvanYao826
EvanYao826 requested a review from QuantumGhost as a code owner July 10, 2026 12:47
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 52.85% 52.85% 0.00%
Strict coverage 52.36% 52.36% 0.00%
Typed symbols 32,803 32,803 0
Untyped symbols 29,539 29,539 0
Modules 2988 2988 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Human Input node doesn't send message to Chat UI after Question Classifier or Condition Branch

1 participant