Skip to content
PR Quorum
Sign inStart free
← Review gallery
XiaomiMiMo/MiMo-Code #1728openreviewed 5h ago

fix(provider): guard non-array message content in part mapping (j.map is not a function)

by wqymi+495 23410 filesreviewed in 1m 52sView PR on GitHub
needs attentionThe panel surfaced issues that deserve attention before merge.2 findings · 1 high+

Reviewer panel

Correctness
deepseek/deepseek-v4-pro
3 found
Security
deepseek/deepseek-v4-pro
0 found
Architecture
deepseek/deepseek-v4-pro
0 found

Findings

01Hhighconf 80%

normalizeContentArray does not convert string content to array, leaving .map() crash unfixed

packages/opencode/src/provider/transform.ts:465

The guard function normalizeContentArray leaves string content unchanged (typeof msg.content === "string" returns early). The PR description states that strings should be converted to [{ type: "text", text: "Hello" }] to prevent downstream .map() failures. If any downstream transform calls .map() on content without first checking Array.isArray, a string will still throw j.map is not a function. The test at line 4350 confirms strings are left as strings. This likely fails to fix the reported crash for string content.

02Mmedconf 90%

isEmptyStep now flags provider-executed tool parts as empty terminals, causing false positives

packages/opencode/src/session/prompt/empty-step-detection.ts:62

The new isEmptyStep returns true when there are no client tool parts and no substantive content, which includes steps that only contain provider-executed tool parts (e.g., server-side web search). The previous implementation explicitly returned false for such steps, treating them as non-empty because they are not client actions. The test change from false to true confirms this regression. This will cause autoRetryEmptyToolCall to discard legitimate provider-executed tool calls and potentially halt the turn.

Want this on your own pull requests?
The same reviewer panel runs on every PR — one focused review, no noise.
Start freeLive demo