Skip to content
← All reviews
XiaomiMiMo/MiMo-Code #1728 · wqymi · 4mo ago

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

Needs attention2 findings · openOpen the pull request on GitHub ↗
Panel verdict

The panel surfaced issues that deserve attention before merge.

3
raised by reviewers
2
kept by the panel

Findings

HighCorrectnessconfidence 0.80

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

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.

MediumCorrectnessconfidence 0.90

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

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.

3 reviewers · deepseek/deepseek-v4-pro · reviewed in 1m 52s · 10 files, +495 −234

Ship the PR.
Skip the noise.

Free on 2 repositories · No credit card · Advisory only—never blocks a merge