Commit 4ebe0ce
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 f2b02dc commit 4ebe0ce
3 files changed
Lines changed: 77 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4498 | 4498 | | |
4499 | 4499 | | |
4500 | 4500 | | |
| 4501 | + | |
| 4502 | + | |
| 4503 | + | |
| 4504 | + | |
| 4505 | + | |
| 4506 | + | |
| 4507 | + | |
| 4508 | + | |
| 4509 | + | |
| 4510 | + | |
| 4511 | + | |
| 4512 | + | |
| 4513 | + | |
| 4514 | + | |
| 4515 | + | |
| 4516 | + | |
| 4517 | + | |
| 4518 | + | |
| 4519 | + | |
| 4520 | + | |
| 4521 | + | |
| 4522 | + | |
| 4523 | + | |
| 4524 | + | |
| 4525 | + | |
| 4526 | + | |
| 4527 | + | |
| 4528 | + | |
| 4529 | + | |
| 4530 | + | |
| 4531 | + | |
| 4532 | + | |
| 4533 | + | |
| 4534 | + | |
| 4535 | + | |
| 4536 | + | |
| 4537 | + | |
| 4538 | + | |
| 4539 | + | |
| 4540 | + | |
| 4541 | + | |
| 4542 | + | |
| 4543 | + | |
| 4544 | + | |
4501 | 4545 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1630 | 1630 | | |
1631 | 1631 | | |
1632 | 1632 | | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
1633 | 1664 | | |
1634 | 1665 | | |
1635 | 1666 | | |
| |||
1641 | 1672 | | |
1642 | 1673 | | |
1643 | 1674 | | |
1644 | | - | |
| 1675 | + | |
1645 | 1676 | | |
1646 | 1677 | | |
1647 | 1678 | | |
| |||
0 commit comments