Repository navigation
Conversation
…tion repository
`WorkflowNodeExecutionRepository` declares four methods (core/repositories/factory.py):
def save(self, execution: WorkflowNodeExecution): ...
def save_synchronously(self, execution: WorkflowNodeExecution) -> None: ...
def save_execution_data(self, execution: WorkflowNodeExecution): ...
def get_by_workflow_execution(...) -> Sequence[WorkflowNodeExecution]: ...
`SQLAlchemyWorkflowNodeExecutionRepository` and
`LogStoreWorkflowNodeExecutionRepository` both implement all four.
`CeleryWorkflowNodeExecutionRepository` implements only three — it has no
`save_execution_data`.
Because it subclasses the Protocol, the missing method does not raise
AttributeError; it silently inherits the Protocol's `...` stub:
>>> "save_execution_data" in CeleryWorkflowNodeExecutionRepository.__dict__
False
>>> [b.__name__ for b in C.__mro__ if "save_execution_data" in b.__dict__]
['WorkflowNodeExecutionRepository'] # body is `...`
The workflow persistence layer calls it on every node completion —
`core/app/workflow/layers/persistence.py` `_update_node_execution()` and
`_handle_node_retry()` both do `save()` followed by
`save_execution_data()`. So with
`CORE_WORKFLOW_NODE_EXECUTION_REPOSITORY` pointed at the Celery repository,
every node's execution data (truncated inputs/outputs and their offload
records) is silently dropped instead of persisted.
Implement it the same way the neighbouring `save_synchronously()` already
does: delegate to the composed `SQLAlchemyWorkflowNodeExecutionRepository`
and refresh the in-memory cache, since the SQLAlchemy repository mutates the
domain model in place (`set_truncated_inputs` / `set_truncated_outputs`).
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-10-17 19:00:47.976020265 +0000
+++ /tmp/pyrefly_pr.txt 2026-10-17 19:00:39.051940687 +0000
@@ -3636,36 +3636,6 @@
--> tests/unit_tests/core/rag/retrieval/test_dataset_retrieval_methods.py:145:33
ERROR Argument `None` is not assignable to parameter `text` with type `str` in function `core.rag.splitter.text_splitter.RecursiveCharacterTextSplitter.split_text` [bad-argument-type]
--> tests/unit_tests/core/rag/splitter/test_text_splitter.py:1873:42
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:73:53
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:89:53
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:102:53
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:119:50
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:131:53
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:147:53
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:181:53
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:202:53
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:218:53
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:241:53
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:257:53
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:279:53
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:311:53
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:333:53
-ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
- --> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:385:53
ERROR Argument `list[FromClause]` is not assignable to parameter `tables` with type `Sequence[Table] | None` in function `sqlalchemy.sql.schema.MetaData.create_all` [bad-argument-type]
--> tests/unit_tests/core/repositories/test_human_input_repository.py:56:56
ERROR Argument `Literal['invalid']` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown]` in function `core.repositories.sqlalchemy_workflow_execution_repository.SQLAlchemyWorkflowExecutionRepository.__init__` [bad-argument-type]
|
Contributor
Pyrefly Type Coverage
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #44018 +/- ##
==========================================
+ Coverage 79.84% 88.99% +9.14%
==========================================
Files 5247 5353 +106
Lines 311056 333189 +22133
Branches 64724 66051 +1327
==========================================
+ Hits 248363 296505 +48142
+ Misses 58555 31491 -27064
- Partials 4138 5193 +1055
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CeleryWorkflowNodeExecutionRepositoryis missingsave_execution_data, one of the four methods declared by theWorkflowNodeExecutionRepositoryprotocol, so with the Celery node-execution repository configured every node's execution data is silently dropped instead of persisted.The protocol (
api/core/repositories/factory.py:35-46) declares four methods:SQLAlchemyWorkflowNodeExecutionRepository(:420) andLogStoreWorkflowNodeExecutionRepository(:287) both implement all four.CeleryWorkflowNodeExecutionRepositoryimplements only three —save,save_synchronously,get_by_workflow_execution.Why it fails silently instead of loudly
The Celery class explicitly subclasses the protocol
(
class CeleryWorkflowNodeExecutionRepository(WorkflowNodeExecutionRepository)),so the missing method is not an
AttributeError— it is inherited from theprotocol as its
...stub and becomes a no-op:Where it is called
core/app/workflow/layers/persistence.pycalls it right aftersave()on themain node-completion paths:
_handle_node_retry()(line 271-272)_update_node_execution()(line 463-464)With
CORE_WORKFLOW_NODE_EXECUTION_REPOSITORYset tocore.repositories.celery_workflow_node_execution_repository.CeleryWorkflowNodeExecutionRepository(the setting is configurable — see
docker/envs/core-services/shared.env.example:405), those calls do nothing:truncated node inputs/outputs and their offload records are never written.
Changes
api/core/repositories/celery_workflow_node_execution_repository.py: addsave_execution_data, implemented exactly like the neighbouringsave_synchronously()— delegate to the composedSQLAlchemyWorkflowNodeExecutionRepository, then refresh the in-memory cacheand the workflow-execution mapping. The cache refresh matters because the
SQLAlchemy repository mutates the domain model in place
(
set_truncated_inputs/set_truncated_outputs/ ...), so cached reads mustkeep exposing the same, now-truncated instance.
api/tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:new
test_save_execution_data_delegates_and_refreshes_cache.No refactor, no schema change, no change to the default (SQLAlchemy) backend.
Verification
Run from
api/:15 passed. After:16 passed.celery_workflow_node_execution_repository.pywhile keeping the new testgives
1 failed, 15 passed— the new test fails withAssertionError: Expected 'save_execution_data' to be called once. Called 0 times.,i.e. the inherited protocol stub really is a no-op. Restoring the fix returns
16 passed."save_execution_data" in CeleryWorkflowNodeExecutionRepository.__dict__is
False, and the only class in the MRO providing it isWorkflowNodeExecutionRepositorywith body....ruff check(repo pinruff>=0.16.9, run viauvx ruff@0.16.9) on bothtouched files:
All checks passed!;ruff format --diff:2 files already formatted.c393f6afd512afe7e232063aa449dab00fe71b7fande064879b946682ffb1ded5a5ebefb1540a17cd2f, which are exactly the shasreported by
GET /repos/langgenius/dify/contents/<path>?ref=main; the branchis based on upstream
mainatcc4aaebc9797827afdc46103a69411301c2c6160.Screenshots
Not applicable — backend-only change, no UI impact.
Checklist
make lint && make type-check(backend) andvp staged(frontend) — for the touched files I ran the backend lint equivalent (ruff check/ruff format --diffat the repo's pinned ruff version); full-repomake lintwas not run locally.From WorkBuddy
Coverage follow-up
The
save_execution_dataregression now covers a previously uncached execution, an already-registered execution (without duplicate IDs), and a standalone execution without a workflow run ID. The repository unit file passes all 18 tests locally; coverage records all executable lines and both outcomes of each conditional in the new method. Targeted Ruff lint and format checks pass. Remote Codecov still needs to validate the new revision.From Codex
Superseded by upstream
The Graphon 0.8 orchestration migration in #40277 added the missing
save_execution_dataimplementation in commit 823f40e. The current Celery repository deliberately queues the complete payload throughsave/save_many, so retaining this older synchronous offload implementation would conflict with that lifecycle. Verified the unchanged current upstream repository test module: 39 passed. Closing this proposal as superseded; no replacement PR is needed.From Codex