Commit 8248b3e
committed
fix(agents): handle nested Mistral thinking-block arrays and add changelog credit
Round-1 review on PR #75339 caught two gaps:
1. Nested thinking arrays were dropped. The original normalizer only read
`record.thinking` as a string, but the Mistral typed-block reproduction
includes `type:"thinking"` blocks whose `thinking` value is itself
an array of `{type:"text", text:"..."}` parts. Recurse into nested
text/thinking/content arrays-and-objects, then re-tag the resulting
parts as thinking when the outer block declared a thinking-style type
(`thinking`, `reasoning`, or `reasoning.text`). Same recursion is
safe for nested `text` and `content` shapes — they fall through as
text deltas.
2. Missing CHANGELOG entry. Add an Unreleased `### Fixes` bullet with
contributor credit per the repo policy in CLAUDE.md ("every added
entry must include at least one Thanks @author attribution").
Add 4 round-2 regression tests:
- type:thinking block with thinking: [array of text parts] flattens to
per-part thinking deltas keyed on the outer signature
- type:reasoning block with text: [array of text parts] flattens to
per-part thinking deltas
- untyped block with content: [array of text parts] flattens to text
- nested thinking block with only empty sub-blocks returns no parts (the
"never emit [object Object]" invariant still holds for the recursive
case)
Refs #75268, #708061 parent f356077 commit 8248b3e
3 files changed
Lines changed: 77 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4202 | 4202 | | |
4203 | 4203 | | |
4204 | 4204 | | |
| 4205 | + | |
| 4206 | + | |
| 4207 | + | |
| 4208 | + | |
| 4209 | + | |
| 4210 | + | |
| 4211 | + | |
| 4212 | + | |
| 4213 | + | |
| 4214 | + | |
| 4215 | + | |
| 4216 | + | |
| 4217 | + | |
| 4218 | + | |
| 4219 | + | |
| 4220 | + | |
| 4221 | + | |
| 4222 | + | |
| 4223 | + | |
| 4224 | + | |
| 4225 | + | |
| 4226 | + | |
| 4227 | + | |
| 4228 | + | |
| 4229 | + | |
| 4230 | + | |
| 4231 | + | |
| 4232 | + | |
| 4233 | + | |
| 4234 | + | |
| 4235 | + | |
| 4236 | + | |
| 4237 | + | |
| 4238 | + | |
| 4239 | + | |
| 4240 | + | |
| 4241 | + | |
| 4242 | + | |
| 4243 | + | |
| 4244 | + | |
| 4245 | + | |
| 4246 | + | |
| 4247 | + | |
| 4248 | + | |
4205 | 4249 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1596 | 1596 | | |
1597 | 1597 | | |
1598 | 1598 | | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
1599 | 1630 | | |
1600 | 1631 | | |
1601 | 1632 | | |
| |||
1607 | 1638 | | |
1608 | 1639 | | |
1609 | 1640 | | |
1610 | | - | |
| 1641 | + | |
1611 | 1642 | | |
1612 | 1643 | | |
1613 | 1644 | | |
| |||
0 commit comments