Skip to content

feat(logging): Auto-inject app_id / workflow_id / node_id and error_s…#38163

Open
ruanimal wants to merge 2 commits into
langgenius:mainfrom
ruanimal:enhance-log
Open

feat(logging): Auto-inject app_id / workflow_id / node_id and error_s…#38163
ruanimal wants to merge 2 commits into
langgenius:mainfrom
ruanimal:enhance-log

Conversation

@ruanimal

Copy link
Copy Markdown
Contributor

Fixes #38156

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

Screenshots

Before After
... ...

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 cd web && pnpm exec vp staged (frontend) to appease the lint gods

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 29, 2026
@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-06-29 09:54:13.722419814 +0000
+++ /tmp/pyrefly_pr.txt	2026-06-29 09:53:58.583237836 +0000
@@ -4123,6 +4123,32 @@
    --> tests/unit_tests/core/app/test_llm_quota.py:626:28
 ERROR Argument `SimpleNamespace` is not assignable to parameter `file` with type `File` in function `core.app.workflow.file_runtime.DifyWorkflowFileRuntime.resolve_file_url` [bad-argument-type]
   --> tests/unit_tests/core/app/workflow/test_file_runtime.py:60:39
+ERROR Argument `SimpleNamespace` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.app.workflow.layers.log_context.WorkflowLogContextLayer.on_node_run_start` [bad-argument-type]
+  --> tests/unit_tests/core/app/workflow/test_log_context_layer.py:61:33
+ERROR Argument `SimpleNamespace` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.app.workflow.layers.log_context.WorkflowLogContextLayer.on_node_run_start` [bad-argument-type]
+  --> tests/unit_tests/core/app/workflow/test_log_context_layer.py:70:33
+ERROR Argument `SimpleNamespace` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.app.workflow.layers.log_context.WorkflowLogContextLayer.on_node_run_end` [bad-argument-type]
+  --> tests/unit_tests/core/app/workflow/test_log_context_layer.py:73:31
+ERROR Argument `SimpleNamespace` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.app.workflow.layers.log_context.WorkflowLogContextLayer.on_node_run_start` [bad-argument-type]
+  --> tests/unit_tests/core/app/workflow/test_log_context_layer.py:83:33
+ERROR Argument `SimpleNamespace` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.app.workflow.layers.log_context.WorkflowLogContextLayer.on_node_run_start` [bad-argument-type]
+  --> tests/unit_tests/core/app/workflow/test_log_context_layer.py:97:33
+ERROR Argument `SimpleNamespace` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.app.workflow.layers.log_context.WorkflowLogContextLayer.on_node_run_end` [bad-argument-type]
+   --> tests/unit_tests/core/app/workflow/test_log_context_layer.py:100:31
+ERROR Argument `SimpleNamespace` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.app.workflow.layers.log_context.WorkflowLogContextLayer.on_node_run_start` [bad-argument-type]
+   --> tests/unit_tests/core/app/workflow/test_log_context_layer.py:103:33
+ERROR Argument `SimpleNamespace` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.app.workflow.layers.log_context.WorkflowLogContextLayer.on_node_run_end` [bad-argument-type]
+   --> tests/unit_tests/core/app/workflow/test_log_context_layer.py:106:31
+ERROR Argument `object` is not assignable to parameter `event` with type `GraphEngineEvent` in function `core.app.workflow.layers.log_context.WorkflowLogContextLayer.on_event` [bad-argument-type]
+   --> tests/unit_tests/core/app/workflow/test_log_context_layer.py:112:24
+ERROR Argument `SimpleNamespace` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.app.workflow.layers.log_context.WorkflowLogContextLayer.on_node_run_start` [bad-argument-type]
+   --> tests/unit_tests/core/app/workflow/test_log_context_layer.py:126:33
+ERROR Argument `SimpleNamespace` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.app.workflow.layers.log_context.WorkflowLogContextLayer.on_node_run_end` [bad-argument-type]
+   --> tests/unit_tests/core/app/workflow/test_log_context_layer.py:128:31
+ERROR Argument `SimpleNamespace` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.app.workflow.layers.log_context.WorkflowLogContextLayer.on_node_run_start` [bad-argument-type]
+   --> tests/unit_tests/core/app/workflow/test_log_context_layer.py:133:33
+ERROR Argument `SimpleNamespace` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.app.workflow.layers.log_context.WorkflowLogContextLayer.on_node_run_end` [bad-argument-type]
+   --> tests/unit_tests/core/app/workflow/test_log_context_layer.py:135:31
 ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_init_params` with type `GraphInitParams` in function `core.workflow.node_factory.DifyNodeFactory.__init__` [bad-argument-type]
   --> tests/unit_tests/core/app/workflow/test_node_factory.py:71:31
 ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `core.workflow.node_factory.DifyNodeFactory.__init__` [bad-argument-type]
@@ -6244,23 +6270,23 @@
 ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `core.workflow.workflow_entry.WorkflowEntry.__init__` [bad-argument-type]
    --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:299:37
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `core.workflow.workflow_entry.WorkflowEntry.single_step_run` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:461:26
+   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:524:26
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `core.workflow.workflow_entry.WorkflowEntry.single_step_run` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:516:26
+   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:579:26
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `core.workflow.workflow_entry.WorkflowEntry.single_step_run` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:585:26
+   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:648:26
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `core.workflow.workflow_entry.WorkflowEntry.single_step_run` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:643:30
+   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:706:30
 ERROR Class member `EmptySplitKey.split` overrides parent class `UserString` in an inconsistent manner [bad-override]
-   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:866:17
+   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:929:17
 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_helpers.py:866:17
+   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:929:17
 ERROR Argument `dict[TestMappingUserInputsBranches.test_rejects_invalid_node_variable_key.EmptySplitKey, list[str]]` is not assignable to parameter `variable_mapping` with type `Mapping[str, Sequence[str]]` in function `core.workflow.workflow_entry.WorkflowEntry.mapping_user_inputs_to_variable_pool` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:871:34
+   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:934:34
 ERROR Argument `TestWorkflowEntryTracing.test_traced_node_run_reports_success.FakeNode` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.workflow.workflow_entry.WorkflowEntry._traced_node_run` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:922:73
+   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:985:73
 ERROR Argument `TestWorkflowEntryTracing.test_traced_node_run_reports_errors.FakeNode` is not assignable to parameter `node` with type `Node[Unknown]` in function `core.workflow.workflow_entry.WorkflowEntry._traced_node_run` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:945:68
+    --> tests/unit_tests/core/workflow/test_workflow_entry_helpers.py:1008:68
 ERROR Missing argument `case` in function `enterprise.telemetry.contracts.TelemetryEnvelope.__init__` [missing-argument]
    --> tests/unit_tests/enterprise/telemetry/test_contracts.py:111:30
 ERROR Missing argument `tenant_id` in function `enterprise.telemetry.contracts.TelemetryEnvelope.__init__` [missing-argument]

@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 51.49% 51.48% -0.02%
Strict coverage 51.01% 50.99% -0.01%
Typed symbols 30,844 30,874 +30
Untyped symbols 29,331 29,377 +46
Modules 2931 2934 +3

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

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(logging): Auto-inject app_id / workflow_id / node_id and error_source into workflow runtime logs

1 participant