fix: Qwen Coder responses not rendering — enhance stream-json parser#59
fix: Qwen Coder responses not rendering — enhance stream-json parser#59algojogacor 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
|
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. |
|
Hey @algojogacor! 👋 Just checking in — it's been a few days since @PerishCode left their migration guidance, and we haven't heard back from you. Are you still planning to work on the rebase and Vitest fixtures? To recap the key ask:
Totally fine if life got busy — just let us know if you want to keep this going or if we should re-open the door for someone else to pick it up. Happy to help with any questions about the |
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