Skip to content

fix(api): filter Graphon workflow response events#36249

Draft
laipz8200 wants to merge 3 commits into
mainfrom
laipz8200/workflow-response-stream-filter
Draft

fix(api): filter Graphon workflow response events#36249
laipz8200 wants to merge 3 commits into
mainfrom
laipz8200/workflow-response-stream-filter

Conversation

@laipz8200
Copy link
Copy Markdown
Member

@laipz8200 laipz8200 commented May 16, 2026

Summary

  • Applies Graphon ResponseStreamFilter in workflow-based app runners before Dify handles graph events.
  • Uses the same filter for streaming and blocking workflow execution so response stream chunks are handled consistently.
  • Temporarily points graphon at the revision from feat(events): add graph event filters graphon#146.

Merge Blocker

This Draft PR must wait for Graphon 0.5.0 to be released before merge. After the release, replace the temporary git revision pin with the released package constraint.

@github-actions github-actions Bot added the web This relates to changes on the web. label May 16, 2026
@laipz8200 laipz8200 changed the base branch from main to codex/upgrade-graphon-0-4-0 May 16, 2026 12:46
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 16, 2026

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-05-18 08:21:23.273819575 +0000
+++ /tmp/pyrefly_pr.txt	2026-05-18 08:21:10.886753383 +0000
@@ -3105,36 +3105,40 @@
    --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:226:22
 ERROR Object of class `NoneType` has no attribute `value` [missing-attribute]
    --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:235:16
+ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:239:55
+ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._iter_workflow_events` [bad-argument-type]
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:266:61
 ERROR Argument `TestWorkflowBasedAppRunner.test_handle_graph_run_events_and_pause_notifications._QueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:244:55
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:277:55
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._handle_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:270:30
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:303:30
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._handle_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:271:30
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:304:30
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._handle_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:272:30
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:305:30
 ERROR Type `object` is not iterable [not-iterable]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:274:69
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:307:69
 ERROR Type `object` is not iterable [not-iterable]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:275:71
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:308:71
 ERROR Type `object` is not iterable [not-iterable]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:276:39
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:309:39
 ERROR Argument `TestWorkflowBasedAppRunner.test_handle_node_events_publishes_queue_events._QueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:287:55
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:320:55
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._handle_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:295:13
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:328:13
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._handle_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:305:13
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:338:13
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._handle_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:316:13
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:349:13
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._handle_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:332:13
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:365:13
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._handle_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:346:13
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:379:13
 ERROR Argument `TestWorkflowBasedAppRunner.test_handle_start_node_result_events_project_outputs._QueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:426:55
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:459:55
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._handle_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:444:30
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:477:30
 ERROR Argument `_DummyQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
   --> tests/unit_tests/core/app/apps/test_workflow_app_runner_notifications.py:36:51
 ERROR Argument `_DummyWorkflowEntry` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._handle_event` [bad-argument-type]

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 16, 2026

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 0.00% 43.71% +43.71%
Strict coverage 0.00% 43.24% +43.24%
Typed symbols 0 22,153 +22,153
Untyped symbols 0 28,836 +28,836
Modules 0 2558 +2,558

@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.94%. Comparing base (730a0be) to head (4fa49b2).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #36249      +/-   ##
==========================================
- Coverage   85.94%   85.94%   -0.01%     
==========================================
  Files        4454     4454              
  Lines      211360   211379      +19     
  Branches    39501    39507       +6     
==========================================
+ Hits       181653   181668      +15     
- Misses      26499    26502       +3     
- Partials     3208     3209       +1     
Flag Coverage Δ
api 85.46% <100.00%> (-0.01%) ⬇️
dify-ui 94.59% <ø> (ø)
web 86.55% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from codex/upgrade-graphon-0-4-0 to main May 18, 2026 00:43
Apply Graphon ResponseStreamFilter to workflow-based app runners so workflow execution consumes filtered graph events in both streaming and blocking paths.

Pin Graphon to the PR revision while the change waits for the 0.5.0 release, and update unit coverage for the filtered event stream behavior.
@laipz8200 laipz8200 force-pushed the laipz8200/workflow-response-stream-filter branch from b69ee7f to dce25a3 Compare May 18, 2026 07:56
@github-actions github-actions Bot added web This relates to changes on the web. and removed web This relates to changes on the web. labels May 18, 2026
@WH-2099 WH-2099 self-assigned this May 18, 2026
@WH-2099 WH-2099 self-requested a review May 18, 2026 08:12
Point the temporary Graphon source pin at the latest langgenius/graphon#146 head after its event filter updates.
@laipz8200 laipz8200 force-pushed the laipz8200/workflow-response-stream-filter branch from 99ec228 to 19b334e Compare May 18, 2026 08:17
@github-actions github-actions Bot removed the web This relates to changes on the web. label May 18, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants