Skip to content

feat(workflow): expose bulk execution status as a system variable - #40955

Open
lxy123hh wants to merge 2 commits into
langgenius:mainfrom
lxy123hh:feat/40021-bulk-execution-system-variable
Open

feat(workflow): expose bulk execution status as a system variable#40955
lxy123hh wants to merge 2 commits into
langgenius:mainfrom
lxy123hh:feat/40021-bulk-execution-system-variable

Conversation

@lxy123hh

@lxy123hh lxy123hh commented Aug 19, 2026

Copy link
Copy Markdown

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

  • expose a read-only Boolean sys.is_bulk_execution variable for top-level Workflow runs
  • propagate the bulk execution flag from Batch requests through the workflow generate entity into the system variable pool
  • default the flag to false for existing clients while allowing Service API callers to set it explicitly
  • keep Chatflow and the existing RAG Pipeline sys.batch variable unchanged
  • add frontend and backend regression coverage for request propagation, serialization, and variable visibility

Fixes #40021

Screenshots

Image

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 vp staged (frontend) to appease the lint gods

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 19, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label Aug 19, 2026
@crazywoola

Copy link
Copy Markdown
Member

Please attach some screenshots as well.

@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-08-19 03:25:35.817129645 +0000
+++ /tmp/pyrefly_pr.txt	2026-08-19 03:25:22.501914818 +0000
@@ -3491,7 +3491,7 @@
 ERROR Argument `Literal['account']` is not assignable to parameter `created_by_role` with type `CreatorUserRole` in function `models.model.UploadFile.__init__` [bad-argument-type]
     --> tests/unit_tests/controllers/console/datasets/test_datasets_segments.py:1208:29
 ERROR Object of class `FunctionType` has no attribute `assert_called_once_with` [missing-attribute]
-   --> tests/unit_tests/controllers/console/explore/test_trial.py:199:5
+   --> tests/unit_tests/controllers/console/explore/test_trial.py:207:5
 ERROR Argument `() -> Session` is not assignable to parameter `session_factory` with type `sessionmaker[@_]` in function `sqlalchemy.orm.scoping.scoped_session.__init__` [bad-argument-type]
   --> tests/unit_tests/controllers/console/explore/test_wraps.py:28:39
 ERROR Argument `str` is not assignable to parameter `view` with type `(InstalledApp) -> str` in function `controllers.console.explore.wraps.decorator` [bad-argument-type]
@@ -3897,7 +3897,7 @@
 ERROR Missing argument `message_id` in function `controllers.common.controller_schemas.SavedMessageCreatePayload.__init__` [missing-argument]
    --> tests/unit_tests/controllers/web/test_pydantic_models.py:308:38
 ERROR Missing argument `inputs` in function `controllers.common.controller_schemas.WorkflowRunPayload.__init__` [missing-argument]
-   --> tests/unit_tests/controllers/web/test_pydantic_models.py:329:31
+   --> tests/unit_tests/controllers/web/test_pydantic_models.py:334:31
 ERROR Object of class `FromClause` has no attribute `create` [missing-attribute]
   --> tests/unit_tests/controllers/web/test_web_forgot_password.py:30:9
 ERROR `None` is not subscriptable [unsupported-operation]
@@ -5069,13 +5069,13 @@
 ERROR Cannot index into `str` [bad-index]
    --> tests/unit_tests/core/app/apps/test_streaming_utils.py:128:12
 ERROR Argument `tuple[Literal['layer']]` is not assignable to parameter `graph_engine_layers` with type `Sequence[GraphEngineLayer]` in function `core.app.apps.workflow.app_generator.WorkflowAppGenerator.resume` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_generator.py:323:29
+   --> tests/unit_tests/core/app/apps/test_workflow_app_generator.py:325:29
 ERROR Argument `tuple[Literal['base-layer']]` is not assignable to parameter `graph_engine_layers` with type `Sequence[GraphEngineLayer]` in function `core.app.apps.workflow.app_generator.WorkflowAppGenerator._generate` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_generator.py:407:33
+   --> tests/unit_tests/core/app/apps/test_workflow_app_generator.py:409:33
 ERROR Cannot index into `object` [bad-index]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_generator.py:416:27
+   --> tests/unit_tests/core/app/apps/test_workflow_app_generator.py:418:27
 ERROR Cannot index into `object` [bad-index]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_generator.py:419:12
+   --> tests/unit_tests/core/app/apps/test_workflow_app_generator.py:421:12
 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:72:55
 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]

@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 59.69% 59.70% +0.00%
Strict coverage 59.28% 59.28% +0.00%
Typed symbols 39,917 39,922 +5
Untyped symbols 27,142 27,143 +1
Modules 3181 3181 0

@lxy123hh

Copy link
Copy Markdown
Author

Please attach some screenshots as well.

Thanks for the feedback. I've added a screenshot showing sys.is_bulk_execution in the workflow system variable selector.

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

Labels

size:M This PR changes 30-99 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.

Add a flag/variable to indicate whether a workflow run is part of a bulk execution

2 participants