fix: Qwen Coder responses not rendering — enhance stream-json parser#59
Open
algojogacor wants to merge 1 commit into
Open
fix: Qwen Coder responses not rendering — enhance stream-json parser#59algojogacor wants to merge 1 commit into
algojogacor wants to merge 1 commit into
Conversation
The Qwen parser only matched bare text/content/message string fields. Qwen Coder actually outputs stream-json (stream_event with text_delta, assistant messages with tool_use) so structured JSON was classified as noise and never filled into the source panel. Fixes nexu-io#58
Contributor
|
Thanks for the PR. I checked the current Suggested migration to current
Recommended validation:
Once the parser fixtures are in place, this should be much easier to review and safely rebase onto the new workspace shape. |
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.
Summary
The Qwen Coder parser in
parseLineWithStateshared a minimal code path with opencode that only matched baretext/content/messagestring fields. Qwen Coder actually outputs a stream-json envelope like Claude (stream_event with content_block_delta/text_delta, assistant messages with tool_use, result with usage metadata). Every structured JSON line was classified as noise and never filled into the source panel — responses only appeared in the log pane.Root Cause
The
agent === "opencode" || agent === "qwen"condition in the parser meant Qwen got the same minimal parsing as opencode, which only handles flat string fields. Qwen Coder's default output format is stream-json with nested structured objects, so the parser'sJSON.parsesucceeded but none of the field checks matched, returning{ kind: "noise" }for every line.What was fixed
Separated Qwen into its own parser block that handles:
stream_event→content_block_delta/text_delta(fine-grained streaming text)stream_event→content_block_delta/thinking_delta(thinking metadata)assistantmessage withtool_userescue (HTML from Write/create_file tools)assistantmessage text content (fallback when no stream deltas seen)resultwith usage/duration_ms/total_cost_usd metadatatext/content/messagefields as a last-resort fallbackTesting Done
Related
Fixes #58
Closes #58