Skip to content

fix: preserve annotation reply metadata#37001

Open
minzifang wants to merge 1 commit into
langgenius:mainfrom
minzifang:fix/annotation-reply-metadata-37000
Open

fix: preserve annotation reply metadata#37001
minzifang wants to merge 1 commit into
langgenius:mainfrom
minzifang:fix/annotation-reply-metadata-37000

Conversation

@minzifang
Copy link
Copy Markdown

Summary

Fixes #37000

This PR preserves metadata.annotation_reply in message_end responses so the frontend can detect annotation-hit replies correctly.

The metadata was previously stripped in two backend paths:

  • api/core/app/apps/base_app_generate_response_converter.py
  • api/core/app/apps/advanced_chat/generate_task_pipeline.py

For chatflow / advanced chat, annotation replies short-circuit workflow execution, so the frontend relies on message_end.metadata.annotation_reply to clear the responding state and show annotation metadata. Without this field, the stop-response button can remain visible after an annotation reply.

Screenshots

The visual reproduction is documented in the linked issue. The affected UI shows an annotation reply already returned while the stop-response button remains visible.

Tests

pytest -o addopts="" \
  tests/unit_tests/core/app/apps/agent_chat/test_agent_chat_generate_response_converter.py \
  tests/unit_tests/core/app/apps/completion/test_completion_generate_response_converter.py \
  tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py -q

Result:

33 passed

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

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 3, 2026
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.

Annotation reply metadata is stripped from message_end events

1 participant