[PR #32114] fix(api): include file marker for workflow tool file outputs #33558

Closed
opened 2026-02-21 20:53:30 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/32114

State: closed
Merged: Yes


Summary

Fixes #32112.

Workflow-as-tool file outputs currently fail with:
Invalid FileMessage: missing file_marker.

Root cause: create_file_message builds ToolInvokeMessage.FileMessage() without explicitly providing file_marker. The FileMessage validator requires file_marker to be present in input payload, so this path can raise validation errors at runtime.

Changes

  • Updated file message construction in Tool.create_file_message to pass file_marker="file_marker" explicitly.
  • Added regression test in workflow-as-tool tests to assert file message creation includes file_marker.
  • Added focused base-tool unit tests to cover invoke branches, runtime-parameter casting, parameter merge behavior, and message helper factories.
  • Marked TYPE_CHECKING import branch as # pragma: no cover (type-only path).

Testing

Executed locally:

  • uv run --project api --group dev ruff check api/core/tools/__base/tool.py api/tests/unit_tests/core/tools/workflow_as_tool/test_tool.py api/tests/unit_tests/core/tools/test_base_tool.py
  • uv run --project api --group dev pytest api/tests/unit_tests/core/tools/workflow_as_tool/test_tool.py api/tests/unit_tests/core/tools/test_base_tool.py -q
  • uv run --project api --group dev pytest -o addopts='' api/tests/unit_tests/core/tools/workflow_as_tool/test_tool.py api/tests/unit_tests/core/tools/test_base_tool.py -q --cov=core.tools.__base.tool --cov-branch --cov-report=term-missing

Coverage (target module):

  • api/core/tools/__base/tool.py
    • statements: 100%
    • branches: 100%
    • functions: 100%
    • lines: 100%
**Original Pull Request:** https://github.com/langgenius/dify/pull/32114 **State:** closed **Merged:** Yes --- ## Summary Fixes #32112. Workflow-as-tool file outputs currently fail with: `Invalid FileMessage: missing file_marker`. Root cause: `create_file_message` builds `ToolInvokeMessage.FileMessage()` without explicitly providing `file_marker`. The FileMessage validator requires `file_marker` to be present in input payload, so this path can raise validation errors at runtime. ## Changes - Updated file message construction in `Tool.create_file_message` to pass `file_marker="file_marker"` explicitly. - Added regression test in workflow-as-tool tests to assert file message creation includes `file_marker`. - Added focused base-tool unit tests to cover invoke branches, runtime-parameter casting, parameter merge behavior, and message helper factories. - Marked `TYPE_CHECKING` import branch as `# pragma: no cover` (type-only path). ## Testing Executed locally: - `uv run --project api --group dev ruff check api/core/tools/__base/tool.py api/tests/unit_tests/core/tools/workflow_as_tool/test_tool.py api/tests/unit_tests/core/tools/test_base_tool.py` - `uv run --project api --group dev pytest api/tests/unit_tests/core/tools/workflow_as_tool/test_tool.py api/tests/unit_tests/core/tools/test_base_tool.py -q` - `uv run --project api --group dev pytest -o addopts='' api/tests/unit_tests/core/tools/workflow_as_tool/test_tool.py api/tests/unit_tests/core/tools/test_base_tool.py -q --cov=core.tools.__base.tool --cov-branch --cov-report=term-missing` Coverage (target module): - `api/core/tools/__base/tool.py` - statements: 100% - branches: 100% - functions: 100% - lines: 100%
yindo added the pull-request label 2026-02-21 20:53:30 -05:00
yindo closed this issue 2026-02-21 20:53:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33558