Skip to content

fix: [Agent] When the "Specified Response" node is set to HTML format, the content in the debugging dialog appears empty, failing to render the HTML code correctly. - #7772

Merged
shaohuzhang1 merged 1 commit into
v3from
pr@v3@fix_html
Nov 9, 2026

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: [Agent] When the "Specified Response" node is set to HTML format, the content in the debugging dialog appears empty, failing to render the HTML code correctly.

…, the content in the debugging dialog appears empty, failing to render the HTML code correctly.
PROGRESS,
GROUP,
HTML
} as Record<string, ContentAggregator>

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.

Here are my findings on this diff:

Issues / Potential Problems

  1. Type/Behavior duplication with TEXT

    • The new HTML aggregator is functionally identical to TEXT (string concatenation). If HTML chunks ever need special handling (e.g., tag balancing, <script> sanitization, or streaming partial tags), this will silently misbehave. At minimum, add a comment clarifying the intended difference from TEXT.
  2. No HTML sanitization

    • Since this produces raw HTML displayed downstream, ensure consumers render it through a sanitizer (DOMPurify or equivalent) to prevent XSS, especially since LLM output is untrusted. Just concatenating is safe at this layer, but the contract should be documented.
  3. Inconsistent ?? prev pattern

    • chunk.id ?? prev.id and chunk.workflowRunId ?? prev.workflowRunId follow the existing convention in GROUP, so consistent — OK. But note content uses || semantics (falsy fallback) while others use ??. That matches TEXT, so acceptable; just be aware empty-string vs undefined ordering.
  4. Missing trailing comma

    • HTML in aggregators lacks a trailing comma; inconsistent style with the rest of the object. Minor.
  5. Repeated boilerplate

    • The six aggregators (TEXT, REASONING, HTML, etc.) now share nearly identical merge logic. Consider extracting a concatAggregator(type) factory:
      const concatAggregator = (type: string): ContentAggregator =>
        (prev = {}, chunk = {}) => ({
          type,
          id: chunk.id ?? prev.id,
          content: (prev.content || '') + (chunk.content || ''),
          workflowRunId: chunk.workflowRunId ?? prev.workflowRunId,
          extra: chunk.extra ?? prev.extra,
        })
      Then const HTML = concatAggregator('HTML'). Reduces drift when fields change.
  6. No test coverage shown

    • Add a unit test verifying: first chunk builds state, subsequent chunks append, missing fields fall back correctly, and an unknown/garbage chunk doesn't corrupt state.
  7. Type safety on aggregators

    • as Record<string, ContentAggregator> casts away key specificity. Prefer satisfies Record<string, ContentAggregator> (TS 4.9+) or an explicit interface so misspelled keys like 'Html' are caught.

Minor

  • Diff header context (@@ ... @@) shows odd characters (,-, +const ) that appear corrupted in paste — verify the patch applies cleanly in your tooling.
  • Confirm consumers dispatch on chunk type 'HTML' case-sensitively everywhere; mismatched casing would bypass this aggregator and drop chunks.

@shaohuzhang1
shaohuzhang1 merged commit c1a1fd8 into v3 Nov 9, 2026
3 of 4 checks passed
@shaohuzhang1
shaohuzhang1 deleted the pr@v3@fix_html branch November 9, 2026 10:14
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.

1 participant