Commit c767837
committed
fix local codex review comment
- [P0] Track session diff deterministically — packages/agents-core/src/runImplementation.ts:1870-1884
In the session merge logic we decrement historyCounts before newInputCounts. If a sessionInputCallback reorders the combined list so that a newly supplied item (e.g. a
repeated user message) appears before the matching historical entry, the new turn is treated as history and filtered out of appended. The run will therefore skip persisting that
user input (sessionItems becomes empty), causing the session store to silently drop real customer messages whenever they match the shape of an older entry. This is a blocking
data-loss bug for any callback that returns new items first or otherwise reorders items. We need to differentiate originals by identity (or at least consult newInputCounts1 parent 252c919 commit c767837
File tree
2 files changed
+90
-3
lines changed- packages/agents-core
- src
- test
2 files changed
+90
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1865 | 1865 | | |
1866 | 1866 | | |
1867 | 1867 | | |
| 1868 | + | |
| 1869 | + | |
1868 | 1870 | | |
1869 | 1871 | | |
1870 | 1872 | | |
1871 | 1873 | | |
1872 | | - | |
1873 | | - | |
1874 | | - | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
1875 | 1877 | | |
1876 | 1878 | | |
1877 | 1879 | | |
| |||
1882 | 1884 | | |
1883 | 1885 | | |
1884 | 1886 | | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
1885 | 1898 | | |
1886 | 1899 | | |
1887 | 1900 | | |
| |||
1900 | 1913 | | |
1901 | 1914 | | |
1902 | 1915 | | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
1903 | 1961 | | |
1904 | 1962 | | |
1905 | 1963 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
848 | 848 | | |
849 | 849 | | |
850 | 850 | | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
851 | 880 | | |
852 | 881 | | |
853 | 882 | | |
| |||
0 commit comments