Skip to content

chore(deps): upgrade Graphon to 0.9.0 and adapt runtime contracts - #45356

Merged
WH-2099 merged 5 commits into
mainfrom
chore/graphon-0.9.0
Dec 2, 2026
Merged

WH-2099 merged 5 commits into
mainfrom
chore/graphon-0.9.0

Conversation

@WH-2099

@WH-2099 WH-2099 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

AI disclosure: Codex assisted with the implementation and validation.

Summary

Prepare the Dify API and standalone Agent for the next Graphon release. Both packages use the same upstream Graphon #446 source archive to exercise ExternalWait with BYOA. Switch both lockfiles to the published release before merging.

During an active run, function-calling and chat ReAct runners preserve ordered assistant content blocks and opaque provider state across tool calls.
Agent v2 retains the original assistant payload and pairs tool results with the provider's call IDs.
Named tool updates replace argument snapshots; unnamed updates append fragments, including updates that omit the call ID.
A real Agent tool regression checks the signed assistant payload and matching result sent on the next request.

Chatflow keeps the engine frame observations required by Graphon's response stream filter to resolve answer variables.
Full variable observations are consumed before events reach the host.
Reply text comes from the filtered stream, including Answers inside Loop and Iteration.
Removing the former node-completion replay prevents each nested answer from being emitted twice.
Real engine-to-queue regressions cover two replies in each container followed by a root reply.
Missing answer variables follow Graphon 0.9.0's empty-output contract.

The integration accepts secret segments in retrieval, dynamic email recipients and truncation, preserves JSON values in draft variable responses, and constructs webhook file variables directly from validated file references.
Generated workspace contracts include Graphon's boolean default values.
The Code-node error editor initializes booleans to false and boolean arrays to [], with a labeled switch and the existing JSON editor for editing them.

Hyphenated node references resolve in Prompt templates, RAG datasource requests and input-form discovery.
A pure RAG binding function replaces five copies of the parser while preserving RAG's digit-leading input names and leading-reference behavior.
Workflow reference preflight uses Graphon's template pattern.
Three unused FC tool-call methods and their obsolete tests are removed.

Refs #45355, #41092, #43305 and #44036.
Issue #47571 tracks the remaining migration work.

Scope and upstream limitations

Provider state is retained for the active run; cross-request thinking replay remains outside this migration.
Graphon 0.9.0 does not support checkpoints after child response progress, including after the child finishes; this remains upstream work in Graphon #356.
The review also reproduced an upstream response-filter failure when a Workflow Tool and its caller reuse a container node ID.
This migration preserves Graphon's ownership of those behaviors.
Unmerged Graphon #421 and other unfinished upstream behavior are outside the released 0.8-to-0.9 adaptation.

Validation

This branch includes main through a82bfa7eee1.
All 11 GitHub Actions workflows passed on 27c88ceb0bf, including the API, standalone Agent, Web and browser E2E suites. Main CI · Docker builds
Patch coverage reached 100% against a 90.67% target. Codecov report

The latest local run passed 205 API tests, 22 tests for the default value editor, and all eight Agent tool limit tests, including cancellation with Redis.
The API tests cover persisted checkpoints with unknown versions or malformed data, empty blocking replies with usage, and literal datasource parameters that match variable names.
The Agent timeout tests now let the request reach the tool before advancing the event loop clock.

Earlier validation

  • 1,075 targeted API unit and contract tests passed, including the changed suites, inner Agent LLM boundary, and chat task pipeline.
  • Standalone Agent LLM adapter and packaging tests: 112 passed, with 40 subtests passed.
  • Error-default editor tests: 12 unit tests and the Chromium interaction regression passed.
  • API make lint and make type-check passed, including all 114 import-boundary contracts.
  • Standalone Agent Ruff and Pyrefly passed.
  • The complete repository frontend static check passed with zero errors and 1,168 existing warnings.
  • Commit hooks, the incremental test-double guard, and installs against the frozen Python and frontend lockfiles passed.

Before the implementation fixes, eight backend regressions failed alongside eight passing controls, the browser regression reproduced empty-string defaults for both boolean types, and the two nested Answer regressions failed.
Earlier full CI passed on 4fd3021e998, including API integration tests, Agent and Web tests, and browser E2E.

Provider responses were simulated at the HTTP boundary.
Live provider calls, Docker image builds, and the full browser suite were not run locally.

BYOA pause and resume

  • Construct ExternalWait with the final Graphon 添加了成员,成员怎么登录?默认密码是什么? #446 fields. dify.external_agent identifies BYOA, and the invocation ID remains the wait ID. Single-step execution distinguishes BYOA from other external waits. Live and reconnect responses expose node_execution_id together with the existing execution_id field.
  • Normalize the legacy 0.8 BYOA pause reason on read through the shared resumption context. The synthetic fixture captures two frames of the same node alongside a Human Input reason. Stored checkpoint bytes and the response filter payload are preserved. Drain 0.8 workers before the new version writes pause checkpoints.
  • Exercise real Chatflow Loop and Iteration graphs that emit a child Answer before an External Agent pause. After restoring the engine and reply checkpoints, assert ordered output inside|result|after and one remote send for the same invocation. The exact upstream error is an expected failure only on the pinned 添加了成员,成员怎么登录?默认密码是什么? #446 archive. A released package with the same failure fails the regression.

The combined local API run passed 1,839 tests with 2 expected failures on the #446 archive. Both nested tests passed using a local combination of the #446 merge and the open #412 patch. Agent compatibility and packaging passed 112 tests and 40 subtests. Both lock checks, all 134 import contracts, formatting and targeted type checks passed.

Keep this PR in draft until a published Graphon version includes ExternalWait and supports nested reply checkpoint restoration. Replace both source overrides and rerun the nested tests and CI with that release. Graphon #412

@WH-2099 WH-2099 self-assigned this Nov 2, 2026
@github-actions github-actions Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 91.07% 91.08% +0.01%
Strict coverage 90.74% 90.74% +0.01%
Typed symbols 110,493 110,533 +40
Untyped symbols 10,869 10,866 -3
Modules 5114 5119 +5

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-12-02 07:30:26.627693627 +0000
+++ /tmp/pyrefly_pr.txt	2026-12-02 07:30:12.559549369 +0000
@@ -2155,95 +2155,89 @@
 ERROR `list[DummyTool]` is not assignable to attribute `_prompt_messages_tools` with type `Sequence[PromptMessageTool]` [bad-assignment]
   --> tests/unit_tests/core/agent/test_cot_chat_agent_runner.py:52:39
 ERROR `DummyGenerateEntity` is not assignable to attribute `application_generate_entity` with type `AgentChatAppGenerateEntity` [bad-assignment]
-  --> tests/unit_tests/core/agent/test_cot_chat_agent_runner.py:56:44
+  --> tests/unit_tests/core/agent/test_cot_chat_agent_runner.py:57:44
 ERROR `Literal[0]` is not assignable to attribute `prompt_price` with type `Decimal` [bad-assignment]
-  --> tests/unit_tests/core/agent/test_fc_agent_runner.py:57:26
+  --> tests/unit_tests/core/agent/test_fc_agent_runner.py:60:26
 ERROR `Literal[0]` is not assignable to attribute `completion_price` with type `Decimal` [bad-assignment]
-  --> tests/unit_tests/core/agent/test_fc_agent_runner.py:58:30
+  --> tests/unit_tests/core/agent/test_fc_agent_runner.py:61:30
 ERROR `Literal[0]` is not assignable to attribute `total_price` with type `Decimal` [bad-assignment]
-  --> tests/unit_tests/core/agent/test_fc_agent_runner.py:59:25
+  --> tests/unit_tests/core/agent/test_fc_agent_runner.py:62:25
 ERROR Missing argument `session` in function `core.agent.base_agent_runner.BaseAgentRunner.__init__` [missing-argument]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:251:37
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:228:37
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:285:5
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:262:5
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:296:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:273:9
 ERROR Argument `None` is not assignable to parameter `query` with type `str` in function `core.agent.fc_agent_runner.FunctionCallAgentRunner._organize_user_query` [bad-argument-type]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:397:46
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:320:46
 ERROR `list[str]` is not assignable to attribute `files` with type `Sequence[File] | list[File]` [bad-assignment]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:409:24
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:332:24
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:465:58
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:388:58
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:510:19
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:433:19
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:574:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:497:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:575:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:498:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:596:17
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:519:17
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:624:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:547:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:625:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:548:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:629:17
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:552:17
 ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:648:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:617:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:650:35
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:619:35
 ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:652:33
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:624:33
 ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:653:33
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:625:33
 ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:654:16
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:626:16
 ERROR Object of class `FunctionType` has no attribute `assert_called` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:659:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:631:9
 ERROR Object of class `FunctionType` has no attribute `call_args_list` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:661:23
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:633:23
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:667:19
-ERROR Argument `list[TextPromptMessageContent]` is not assignable to parameter `content` with type `str | None` in function `DummyMessage.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:684:57
-ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:690:9
-ERROR Argument `list[TextPromptMessageContent]` is not assignable to parameter `content` with type `str | None` in function `DummyMessage.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:706:57
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:639:19
+ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:662:9
 ERROR Object of class `FunctionType` has no attribute `side_effect` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:714:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:683:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:716:35
-ERROR Argument `list[TextPromptMessageContent]` is not assignable to parameter `content` with type `str | None` in function `DummyMessage.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:722:46
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:685:35
 ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:725:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:694:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:727:35
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:696:35
 ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:729:16
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:698:16
 ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:745:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:711:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:756:35
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:722:35
 ERROR Object of class `FunctionType` has no attribute `side_effect` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:772:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:735:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:774:35
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:737:35
 ERROR Object of class `FunctionType` has no attribute `side_effect` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:791:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:751:9
 ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:796:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:756:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:805:35
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:765:35
 ERROR Object of class `FunctionType` has no attribute `call_args_list` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:812:25
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:772:25
 ERROR Object of class `NoneType` has no attribute `max_iteration` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:816:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:776:9
 ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:828:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:785:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:831:29
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:788:29
 ERROR Argument `dict[Unknown, Unknown]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.variables.manager.BasicVariablesConfigManager.convert` [bad-argument-type]
   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/variables/test_manager.py:14:67
 ERROR Argument `dict[str, list[dict[str, bool | str | dict[str, str]] | dict[str, bool]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.variables.manager.BasicVariablesConfigManager.convert` [bad-argument-type]
@@ -2606,10 +2600,14 @@
    --> tests/unit_tests/core/app/apps/chat/test_app_generator.py:506:28
 ERROR Argument `DummyQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
    --> tests/unit_tests/core/app/apps/chat/test_app_generator.py:506:49
+WARN `HitlRequired` is deprecated [deprecated]
+  --> tests/unit_tests/core/app/apps/common/test_workflow_response_converter.py:45:43
 ERROR Object of class `NoneType` has no attribute `data` [missing-attribute]
     --> tests/unit_tests/core/app/apps/common/test_workflow_response_converter.py:1176:20
 ERROR Class member `_RecordingWorkflowAppRunner._publish_event` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
     --> tests/unit_tests/core/app/apps/common/test_workflow_response_converter.py:1478:9
+WARN `graphon.entities.pause_reason.HitlRequired` is deprecated [deprecated]
+    --> tests/unit_tests/core/app/apps/common/test_workflow_response_converter.py:1692:24
 ERROR Object of type `FileInputConfig | FileListInputConfig | ParagraphInputConfig | SelectInputConfig` has no attribute `option_source` [missing-attribute]
     --> tests/unit_tests/core/app/apps/common/test_workflow_response_converter.py:1879:16
 ERROR Argument `Literal['bad']` is not assignable to parameter `metadata` with type `Mapping[str, object]` in function `core.app.entities.task_entities.Data.model_construct` [bad-argument-type]
@@ -2760,6 +2758,8 @@
    --> tests/unit_tests/core/app/apps/test_base_app_runner.py:821:17
 ERROR Argument `TestAppRunner.test_handle_multimodal_image_content_fallback_return_branch._ToggleBool` is not assignable to parameter `base64_data` with type `str` in function `graphon.model_runtime.entities.message_entities.ImagePromptMessageContent.model_construct` [bad-argument-type]
    --> tests/unit_tests/core/app/apps/test_base_app_runner.py:822:25
+WARN `HitlRequired` is deprecated [deprecated]
+  --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:97:43
 ERROR Argument `Mapping[str, Any] | None` is not assignable to parameter `graph_config` with type `Mapping[str, Any]` in function `core.workflow.workflow_entry.WorkflowEntry.__init__` [bad-argument-type]
    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:196:39
 ERROR No matching overload found for function `dict.get` called with arguments: (dict[str, int | list[Unknown] | str] | dict[str, list[str] | str] | dict[str, list[Unknown] | str] | dict[str, str] | str, Literal['']) [no-matching-overload]
@@ -2794,6 +2794,8 @@
    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:606:34
 ERROR Object of class `NoneType` has no attribute `value` [missing-attribute]
    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:729:20
+WARN `graphon.entities.pause_reason.HitlRequired` is deprecated [deprecated]
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:763:22
 ERROR Type `object` is not iterable [not-iterable]
    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:775:73
 ERROR Type `object` is not iterable [not-iterable]
@@ -2810,10 +2812,16 @@
    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:954:61
 ERROR Object of class `object` has no attribute `metadata` [missing-attribute]
    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:956:60
-ERROR `Literal['iteration_id']` is not assignable to dict key type `WorkflowNodeExecutionMetadataKey` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:990:75
+ERROR Argument `Mapping[str, Any] | None` is not assignable to parameter `graph_config` with type `Mapping[str, Any]` in function `core.workflow.workflow_entry.WorkflowEntry.__init__` [bad-argument-type]
+    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1032:48
+WARN `graphon.entities.pause_reason.HitlRequired` is deprecated [deprecated]
+    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1184:24
 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]
-    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1158:29
+    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1198:29
+WARN `graphon.entities.pause_reason.HitlRequired` is deprecated [deprecated]
+    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1546:37
+WARN `graphon.entities.pause_reason.HitlRequired` is deprecated [deprecated]
+    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1657:32
 ERROR Argument `tuple[Literal['layer']]` is not assignable to parameter `graph_engine_layers` with type `Sequence[Layer]` in function `core.app.apps.workflow.app_generator.WorkflowAppGenerator.resume` [bad-argument-type]
    --> tests/unit_tests/core/app/apps/workflow/test_app_generator.py:663:33
 ERROR Argument `tuple[Literal['base-layer']]` is not assignable to parameter `graph_engine_layers` with type `Sequence[Layer]` in function `core.app.apps.workflow.app_generator.WorkflowAppGenerator._generate` [bad-argument-type]
@@ -4008,37 +4016,37 @@
 ERROR Class member `_EventQueue.listen` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
     --> tests/unit_tests/core/workflow/nodes/human_input/test_entities.py:1485:9
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/core/workflow/nodes/knowledge_retrieval/test_knowledge_retrieval_node.py:613:16
+   --> tests/unit_tests/core/workflow/nodes/knowledge_retrieval/test_knowledge_retrieval_node.py:638:16
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/core/workflow/nodes/knowledge_retrieval/test_knowledge_retrieval_node.py:614:27
+   --> tests/unit_tests/core/workflow/nodes/knowledge_retrieval/test_knowledge_retrieval_node.py:639:27
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/core/workflow/nodes/knowledge_retrieval/test_knowledge_retrieval_node.py:615:16
+   --> tests/unit_tests/core/workflow/nodes/knowledge_retrieval/test_knowledge_retrieval_node.py:640:16
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/core/workflow/nodes/knowledge_retrieval/test_knowledge_retrieval_node.py:616:16
+   --> tests/unit_tests/core/workflow/nodes/knowledge_retrieval/test_knowledge_retrieval_node.py:641:16
 ERROR Object of class `RuntimeState` has no attribute `app_config` [missing-attribute]
   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:66:5
 ERROR Object of class `RuntimeState` has no attribute `app_config` [missing-attribute]
   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:67:5
 ERROR Object of class `RuntimeState` has no attribute `app_config` [missing-attribute]
-   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:485:5
+   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:437:5
 ERROR Cannot index into `object` [bad-index]
-   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:503:12
+   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:455:12
 ERROR Cannot index into `object` [bad-index]
-   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:504:12
+   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:456:12
 ERROR Cannot index into `object` [bad-index]
-   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:505:12
+   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:457:12
 ERROR Cannot index into `object` [bad-index]
-   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:506:12
+   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:458:12
 ERROR Cannot index into `object` [bad-index]
-   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:507:12
+   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:459:12
 ERROR Cannot index into `object` [bad-index]
-   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:508:12
+   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:460:12
 ERROR Cannot index into `object` [bad-index]
-   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:509:12
+   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:461:12
 ERROR Cannot index into `object` [bad-index]
-   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:510:12
+   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:462:12
 ERROR Cannot index into `object` [bad-index]
-   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:511:12
+   --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:463:12
 ERROR Argument `SimpleNamespace` is not assignable to parameter `runtime_state` with type `RuntimeState` in function `core.workflow.node_factory.DifyNodeFactory.__init__` [bad-argument-type]
    --> tests/unit_tests/core/workflow/test_node_factory.py:123:31
 ERROR Class member `_Version1.init_node_data` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
@@ -4152,39 +4160,39 @@
 ERROR Object of class `object` has no attribute `tool` [missing-attribute]
     --> tests/unit_tests/core/workflow/test_node_runtime.py:2375:16
 WARN Cannot instantiate `BaseNodeData` because it directly extends `ABC` or uses `ABCMeta` [direct-abstract-base-instantiation]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1013:50
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1050:50
 ERROR `in` is not supported between `Literal['Maximum execution steps exceeded: 3 > 2']` and `None` [not-iterable]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1070:20
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1107:20
 WARN Cannot instantiate `BaseNodeData` because it directly extends `ABC` or uses `ABCMeta` [direct-abstract-base-instantiation]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1204:37
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1241:37
 ERROR Class member `EmptySplitKey.split` overrides parent class `UserString` in an inconsistent manner [bad-override]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1646:21
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1683:21
 ERROR Class member `EmptySplitKey.split` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1646:21
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1683:21
 ERROR `TestWorkflowEntryHelpersCases.TestMappingUserInputsBranches.test_rejects_invalid_node_variable_key.EmptySplitKey` is not assignable to dict key type `str` [bad-assignment]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1651:39
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1688:39
 ERROR Argument `TestWorkflowEntryHelpersCases.TestWorkflowEntryNodeLayers.test_run_node_with_layers_reports_success.FakeNode` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.workflow.workflow_entry.WorkflowEntry._run_node_with_layers` [bad-argument-type]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1754:82
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1791:82
 ERROR Object of class `FunctionType` has no attribute `assert_called_once_with` [missing-attribute]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1759:17
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1796:17
 ERROR Object of class `FunctionType` has no attribute `assert_called_once_with` [missing-attribute]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1760:17
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1797:17
 ERROR Object of class `FunctionType` has no attribute `assert_called_once_with` [missing-attribute]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1761:17
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1798:17
 ERROR Object of class `FunctionType` has no attribute `assert_called_once_with` [missing-attribute]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1762:17
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1799:17
 ERROR Object of class `FunctionType` has no attribute `assert_called_once_with` [missing-attribute]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1763:17
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1800:17
 ERROR Argument `TestWorkflowEntryHelpersCases.TestWorkflowEntryNodeLayers.test_run_node_with_layers_reports_errors.FakeNode` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.workflow.workflow_entry.WorkflowEntry._run_node_with_layers` [bad-argument-type]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1790:77
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1827:77
 ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1793:24
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1830:24
 ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1794:35
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1831:35
 ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1795:24
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1832:24
 ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1796:35
+    --> tests/unit_tests/core/workflow/test_workflow_entry.py:1833:35
 ERROR Object of class `object` has no attribute `append` [missing-attribute]
    --> tests/unit_tests/dev/test_generate_knowledge_fs_contract.py:121:13
 ERROR Cannot set item in `object` [unsupported-operation]
@@ -4228,11 +4236,11 @@
 ERROR Argument `dict[str, list[dict[str, dict[str, str | dict[str, str] | dict[str, int | str]]]]]` is not assignable to parameter `graph` with type `dict[str, object] | None` in function `_make_workflow` [bad-argument-type]
    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline.py:676:71
 ERROR Argument `() -> tuple[StartNode, Generator[object, Unknown]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[CustomContainerRequest | IterationFrameRequest | LoopFrameRequest | NodeEvent]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline.py:1949:24
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline.py:1966:24
 ERROR Argument `() -> tuple[StartNode, Iterator[NodeRunFailedEvent]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[CustomContainerRequest | IterationFrameRequest | LoopFrameRequest | NodeEvent]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline.py:1969:20
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline.py:1986:20
 ERROR Argument `() -> tuple[StartNode, Iterator[NodeRunFailedEvent]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[CustomContainerRequest | IterationFrameRequest | LoopFrameRequest | NodeEvent]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline.py:1989:20
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline.py:2006:20
 ERROR No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, object]) [no-matching-overload]
   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_transform_service.py:29:18
 ERROR No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, object]) [no-matching-overload]
@@ -4444,8 +4452,8 @@
 ERROR `None` is not subscriptable [unsupported-operation]
     --> tests/unit_tests/services/test_workflow_persistence.py:1476:20
 ERROR `dict[str, str]` is not assignable to dict value type `list[Unknown] | str` [bad-assignment]
-   --> tests/unit_tests/services/test_workflow_service.py:471:30
+   --> tests/unit_tests/services/test_workflow_service.py:480:30
 ERROR Argument `Literal['invalid']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-    --> tests/unit_tests/services/test_workflow_service.py:4468:24
+    --> tests/unit_tests/services/test_workflow_service.py:4505:24
 ERROR Argument `dict[str, str | dict[str, str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.workflow_service.WorkflowService._build_human_input_node_for_debugging` [bad-argument-type]
-    --> tests/unit_tests/services/test_workflow_service.py:4499:69
+    --> tests/unit_tests/services/test_workflow_service.py:4536:69

@github-actions github-actions Bot added the web This relates to changes on the web. label Nov 2, 2026
@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.69%. Comparing base (a82bfa7) to head (27c88ce).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #45356      +/-   ##
==========================================
+ Coverage   90.67%   90.69%   +0.02%     
==========================================
  Files        7068     7070       +2     
  Lines      445108   445097      -11     
  Branches    89706    89694      -12     
==========================================
+ Hits       403602   403695      +93     
+ Misses      34455    34374      -81     
+ Partials     7051     7028      -23     
Flag Coverage Δ
api 90.19% <98.63%> (+0.03%) ⬆️

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

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hpiclaranet

Copy link
Copy Markdown

Independent review of the Graphon 0.9.0 upgrade — thanks for carrying the opaque_body contract through; this is the right path for #41092 and supersedes our earlier #41095. The core approach is sound: LLMResultAccumulator preserves opaque_body and ordered content blocks, streaming keeps yielding the original chunks, and the COT scratchpad bypass is the correct call for signed/ordered assistant turns.

One blocker and a few follow-ups (all verified against the diff and graphon v0.9.0):

🔴 Blocker — secret query leakage in knowledge retrieval

api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py (and api/services/knowledge_fs/knowledge_retrieval_v2/knowledge_retrieval_v2_node.py) now accept (StringSegment, SecretSegment) as the query source, but the extracted .value is placed unredacted into NodeRunResult.inputs. Those inputs are persisted (sqlalchemy_workflow_node_execution_repository.py) and exported to OTel as RetrieverAttributes.QUERY (api/extensions/otel/parser/retrieval.py). Graphon's confidentiality masking only applies while the value is still typed as Segment — here it is already a plain string. The new test even asserts result.inputs["query"] contains the original value.

Suggestion: keep the real query only for retrieval, redact the persisted inputs and the OTel attributes, and add regression tests for DB/trace redaction.

🟡 Major — bare json.loads on tool-call arguments (pre-existing, amplified here)

fc_agent_runner.py extract_blocking_tool_calls still does json.loads(prompt_message.function.arguments) with no JSONDecodeError handling. Now that it runs on the accumulated result, a truncated/malformed argument snapshot aborts the agent instead of surfacing a tool error. Consider try/except (or json_repair, already in deps) — low-risk follow-up.

🟡 Major — draft-variable offload path affected by the bump (file not in this PR)

api/services/workflow_draft_variable_service.py + api/models/workflow.py still persist via dumps_with_segments, which in 0.9 un-packs Segment → .value and File → model_dump(mode="json"), so file_paths markers only work on the full typed snapshot. A nested File inside array[any] round-trips back as a dict without file identity (the new test_workflow_draft_variable_fields.py covers dict-of-file, not a real File round-trip). Also dump_to_file still checks isinstance(value_seg, StringSegment) while sibling files were updated to (StringSegment, SecretSegment). Not introduced by this PR, but a side-effect of the bump worth a follow-up.

🟢 Minor — streaming tool-call IDs may be mutated before yield

fc_agent_runner.py: accumulator.consume(chunk) can generate an ID for a nameless tool call inside merge_tool_call_deltas, and the same object is then yielded to BaseAppRunner. If the provider-chunk contract must be preserved, accumulate a copy; otherwise document the normalization and add a test for ID-less chunks.

🟢 Process

Overall: architecture is right; only the secret-redaction issue blocks.

WH-2099 and others added 4 commits December 2, 2026 07:12
Use the same Graphon source revision in the API and standalone Agent
for ExternalWait. Migrate 0.8 BYOA pause reasons when reading saved
checkpoints and retain invocation and frame identities.

Preserve provider state and tool call IDs across active Agent rounds.
Consume child Answer stream events, adapt variable and file contracts,
and resolve hyphenated references in Prompt, RAG and workflow preflight.

Refs: #45355, #41092, #43305, #44036
Co-authored-by: Yansong Zhang <916125788@qq.com>
Assisted-by: Codex:gpt-6.2-astra
Replay empty assistant content arrays as empty strings so tool rounds send
valid content to OpenAI-compatible providers.
Preserve nonempty content blocks, tool calls, and provider state, including
false-valued JSON snapshots and signed blocks without visible text.

Cover streaming and blocking replay through the production agent and model
runtime, with only the plugin model client replaced at the external boundary.
Exercise the persisted pause envelope across unknown versions and malformed graph data. Verify that blocking replies retain usage and that literal datasource values are excluded from form bindings. Account for required usage on blocking results directly.
@WH-2099
WH-2099 force-pushed the chore/graphon-0.9.0 branch from 19a3cd1 to 8bc5c74 Compare December 2, 2026 07:14
Advance the event loop clock after the tool request is in flight. Both the runner deadline and the admission callback still fire, without requiring the test machine to reach HTTP dispatch within 20 or 30 milliseconds.
@WH-2099
WH-2099 added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit e9feb35 Dec 2, 2026
71 checks passed
@WH-2099
WH-2099 deleted the chore/graphon-0.9.0 branch December 2, 2026 11:24
@hpiclaranet

Copy link
Copy Markdown

Thanks for merging — and for carrying the opaque_body contract through; the core of this PR (Graphon 0.9.0 + LLMResultAccumulator) is solid and the agent-side fix works.

One thing I want to re-flag post-merge, since the 🔴 blocker from my earlier review is still present in main (verified on the merged head):

Secret query leakage from SecretSegment

  • api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py (v1) — query = variable.value → inputs=variables → persisted (inputs_dict).
  • api/services/knowledge_fs/knowledge_retrieval_v2/knowledge_retrieval_v2_node.py:292 — query = variable.value.strip() → inputs={"query": query} (line 248).
  • api/extensions/otel/parser/retrieval.py:89 — span.set_attribute(RetrieverAttributes.QUERY, query).

Now that (StringSegment, SecretSegment) is accepted as the query source, a secret query is stored unredacted in NodeRunResult.inputs (DB) and exported unredacted to OTel. Graphon's confidentiality masking only applies while the value is still typed as Segment — here it is already a plain string by the time it reaches inputs/OTel. The test asserting result.inputs["query"] contains the original value confirms the behaviour.

Suggestion (follow-up): keep the real query only for retrieval, redact inputs before persist and the OTel attribute, and add regression tests for DB/trace redaction. Happy to open an issue or prepare a small PR if useful — this is the only thing I'd consider blocking from the patch itself, everything else was non-blocking.

Again — thank you; the round-trip contract is the right design.

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

Labels

size:XXL This PR changes 1000+ 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.

5 participants