Repository navigation
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
Conversation
…, the content in the debugging dialog appears empty, failing to render the HTML code correctly.
shaohuzhang1
commented
Nov 9, 2026
| PROGRESS, | ||
| GROUP, | ||
| HTML | ||
| } as Record<string, ContentAggregator> |
Contributor
Author
There was a problem hiding this comment.
Here are my findings on this diff:
Issues / Potential Problems
-
Type/Behavior duplication with
TEXT- The new
HTMLaggregator is functionally identical toTEXT(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 fromTEXT.
- The new
-
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.
-
Inconsistent
?? prevpatternchunk.id ?? prev.idandchunk.workflowRunId ?? prev.workflowRunIdfollow the existing convention inGROUP, so consistent — OK. But notecontentuses||semantics (falsy fallback) while others use??. That matchesTEXT, so acceptable; just be aware empty-string vs undefined ordering.
-
Missing trailing comma
HTMLinaggregatorslacks a trailing comma; inconsistent style with the rest of the object. Minor.
-
Repeated boilerplate
- The six aggregators (
TEXT,REASONING,HTML, etc.) now share nearly identical merge logic. Consider extracting aconcatAggregator(type)factory:Thenconst 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, })
const HTML = concatAggregator('HTML'). Reduces drift when fields change.
- The six aggregators (
-
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.
-
Type safety on
aggregatorsas Record<string, ContentAggregator>casts away key specificity. Prefersatisfies 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.