Workflow generator does not rewrite node-id references nested inside lists
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 88/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
- 領域
- ai, backend, testing-qa
調査の方向性
api/core/workflow/generator/runner.py の WorkflowGenerator._rewrite_refs_in_data と、その case list() 分岐から始めます。api/tests/unit_tests/core/workflow/generator/test_runner.py にある名前付きの2つの回帰テストを実行し、その後、ネストされたセレクターペアとプレースホルダー文字列が _sanitize_node_ids の後に書き換えられ、UNKNOWN_NODE_REFERENCE が残っていないことを確認します。
索引モデルが issue の本文から書いたものです。
説明
Self Checks
- I have read the Contributing Guide and Language Policy.
- This is only for bug report, if you would like to ask a question, please head to Discussions.
- I have searched for existing issues search for existing issues, including closed ones.
- I confirm that I am using English to submit this report, otherwise it will be closed.
- 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- Please do not modify this template :) and fill in all the required fields.
Dify version
1.17.1 (main, 38f9d85)
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
WorkflowGenerator._sanitize_node_ids renames LLM-emitted node ids that contain
characters rejected by the runtime placeholder regex (hyphens, dots, spaces —
e.g. node-1 -> node1) and rewrites every cross-reference to them: edge
source/target, parentId-style id fields, {{#id.var#}} placeholders, and
["node-id", "var"] selector lists.
The rewrite walker _rewrite_refs_in_data handles the selector shape only when
it is a direct dict value. When a ["node-id", "var"] pair is nested inside
another list — e.g. a variable-aggregator node's data.variables
(list[list[str]]), its advanced_settings.groups[].variables, or an end
node's end_stream_variable_selector_mapping values (dict[str, list[list[str]]]) — the case list() arm only recurses, so the stale id is
left in place. Placeholder-bearing strings inside lists are likewise skipped.
Where: api/core/workflow/generator/runner.py, _rewrite_refs_in_data, case list()
arm (around line 2028).
from core.workflow.generator.runner import WorkflowGenerator
nodes = [
{"id": "node-1", "data": {"type": "llm", "title": "A"}},
{"id": "node-2", "data": {"type": "llm", "title": "B"}},
{"id": "join", "data": {
"type": "variable-aggregator",
"variables": [["node-1", "text"], ["node-2", "text"]],
}},
]
WorkflowGenerator._sanitize_node_ids(nodes=nodes, edges=[])
assert nodes[2]["data"]["variables"] == [["node1", "text"], ["node2", "text"]]
# Fails: nested selectors keep the stale ids "node-1"/"node-2", and
# _collect_unresolved_refs then reports UNKNOWN_NODE_REFERENCE for both.
Covered by regression tests
TestWorkflowGeneratorIdSanitization::test_rewrites_selector_pairs_nested_in_lists
and ::test_rewrites_placeholders_inside_string_lists in
api/tests/unit_tests/core/workflow/generator/test_runner.py.
✔️ Expected Behavior
After _sanitize_node_ids, every reference to a renamed node is rewritten, including ["node-id", "var"] selector pairs and {{#id.var#}} strings that sit inside lists: the aggregator above ends up with [["node1", "text"], ["node2", "text"]] and generation proceeds.
❌ Actual Behavior
After sanitization the renamed node id no longer exists, but the nested
selector still points at the old id. The reference collector does see the
leftover pair, so _collect_unresolved_refs reports
UNKNOWN_NODE_REFERENCE (Reference {#node-1.text#} points at unknown node 'node-1') and AI workflow generation fails — even though the sanitize pass
exists precisely to repair these LLM-emitted ids and repairs them everywhere
else.
- 主要言語
- TypeScript
- スター
- 157k
- フォーク
- 24.7k
- 平均マージ
- 22時間 32分
- マージ済み PR(30日)
- 611
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
langgenius/dify のほかの issue
-
Annotation Reply: a stored score threshold of 0.0 is silently replaced with 1, disabling the feature オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
langgenius/dify#42639 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
langgenius/dify#42468 · コメント 1 件 · リアクション 1 件 ·
-
🐞 bug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
langgenius/dify#42446 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
langgenius/dify#42350 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
langgenius/dify#42326 · コメント 1 件 · リアクション 1 件 ·
langgenius/dify の issue をすべて見る
似ている issue
-
calcite-components needs triage refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Esri/calcite-design-system#15203 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Automattic/studio#4908 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100