Skip to content

fix: for simple application, the execution process of skill outputs is disabled, the execution process of skill tools is still displayed - #8188

Merged
peslyn merged 1 commit into
v3from
pr@v3@fix_for_simple_application_the_execution_process_of_skill_outputs_is_disabled
Nov 26, 2026
Merged

peslyn merged 1 commit into
v3from
pr@v3@fix_for_simple_application_the_execution_process_of_skill_outputs_is_disabled

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: for simple application, the execution process of skill outputs is disabled, the execution process of skill tools is still displayed

…s disabled, the execution process of skill tools is still displayed
data["nodes"][10]["properties"]["node_data"]["mcp_output_enable"] = application.mcp_output_enable
data["nodes"][10]["properties"]["node_data"]["model_setting"] = {
key: model_setting.get(key)
for key in ["reasoning_content_enable", "reasoning_content_start", "reasoning_content_end"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Findings

Potential Issues

  1. Missing attribute guard (most important)
    application.mcp_output_enable is accessed directly twice. If the Application model doesn't define this field — or if it's None for existing/legacy records — you'll get an AttributeError or write null into the workflow JSON, which downstream consumers may not expect.

    • Use getattr(application, "mcp_output_enable", False) or add a model default (default=False) plus ideally a JSON-schema default.
  2. Duplicated mutation logic
    The same block of 7 assignments is repeated for nodes 5 and 10. Every future field addition requires touching two places, which is error-prone (easy to forget one, as could have happened here before).

    • Refactor into a helper:
      def _apply_node_data(node, application, model_id=None, model_params_setting=None):
          nd = node["properties"]["node_data"]
          nd.update({
              "application_ids": application.application_ids,
              "tool_ids": application.tool_ids,
              "dialogue_number": application.dialogue_number,
              "mcp_output_enable": getattr(application, "mcp_output_enable", False),
          })

    That makes the change a one-liner and prevents drift between the two nodes.

  3. Magic indices (data["nodes"][5], [10])
    Hardcoded positional indexing is fragile: any reorder in the workflow template silently targets the wrong node.

    • Prefer locating nodes by id / type / name, e.g. build a lookup map, or at least add an assertion on expected node type before mutating.
  4. No type/consistency validation
    Ensure mcp_output_enable is a bool. If it can come from a serializer as string "true"/"false", cast explicitly (bool(...) is unsafe for "false"; use a proper parser).

Optimization Suggestions

  • Batch updates: Instead of many separate key assignments, use a single dict.update() per node — marginally faster and much more readable.
  • Extract workflow-building into a declarative structure (list of (node_index/tag, field_mapping)), so adding fields becomes configuration rather than code.
  • Add unit tests asserting that both nodes receive mcp_output_enable, including the case where the attribute is absent/None.
  • Consider schema versioning: if mcp_output_enable is a new node-data field, gate it behind a schema/version flag so older workflow templates aren't broken.

Summary

Functionally the change looks correct, but it inherits two pre-existing weaknesses (duplication + magic indices) and introduces a new one (unguarded attribute access). Minimal safe fix: use getattr(..., default=False) and deduplicate the node-update logic.

@peslyn
peslyn merged commit 11002c7 into v3 Nov 26, 2026
3 of 4 checks passed
@peslyn
peslyn deleted the pr@v3@fix_for_simple_application_the_execution_process_of_skill_outputs_is_disabled branch November 26, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants