Commit 23ea5bd
committed
fix local codex review comment
- [P1] Preserve new session items when callback mutates history — packages/agents-core/src/runImplementation.ts:1651-1688
If a sessionInputCallback mutates the history array (e.g. the natural pattern history.push(...newItems.map(item => ({ ...item }))); return history; to annotate new rows) the
logic here misclassifies those freshly added items as existing history. Because we build historyCounts/historyRefs after the callback, the cloned entries land in historyRefs
and the loop then skips them, leaving appended empty. Downstream we persist sessionItems: appended.length > 0 ? appended : [], so the turn’s new input never gets written to the
session. That silently drops user input for any in-place merge strategy, which is a severe regression for the new memory feature.1 parent 4d7cdbe commit 23ea5bd
File tree
2 files changed
+50
-5
lines changed- packages/agents-core
- src
- test
2 files changed
+50
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1656 | 1656 | | |
1657 | 1657 | | |
1658 | 1658 | | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
1659 | 1664 | | |
1660 | 1665 | | |
1661 | 1666 | | |
| |||
1665 | 1670 | | |
1666 | 1671 | | |
1667 | 1672 | | |
1668 | | - | |
1669 | | - | |
1670 | | - | |
1671 | | - | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
1672 | 1677 | | |
1673 | 1678 | | |
1674 | 1679 | | |
| |||
1707 | 1712 | | |
1708 | 1713 | | |
1709 | 1714 | | |
1710 | | - | |
| 1715 | + | |
1711 | 1716 | | |
1712 | 1717 | | |
1713 | 1718 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
350 | 390 | | |
351 | 391 | | |
352 | 392 | | |
| |||
0 commit comments