Commit 7a5e4c8
committed
fix: invalidate streaming-stats cache on stream-error
Codex P2 on PR #3219: streamingStatsStore was bumped on stream-end and
stream-abort but not on stream-error. Subscribers (TypewriterMarkdown
via useWorkspaceStreamingStats) could keep returning the failed
stream's TPS/charsPerSec until the next delta arrived, leaking stale
rates into the next stream's early renders.
Mirror the stream-end / stream-abort terminal-cleanup pattern in the
stream-error path: cancel any pending coalesced bumps, then bump
streamingStatsStore so consumers re-read and the snapshot collapses to
null (getActiveStreamMessageId is already undefined post-error).
Adds a regression test that drives stream-start + stream-delta +
caught-up to populate the cache, then asserts both that subscribers
are notified and that the post-error snapshot is null.1 parent ff12fce commit 7a5e4c8
2 files changed
Lines changed: 79 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1875 | 1875 | | |
1876 | 1876 | | |
1877 | 1877 | | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 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 | + | |
1878 | 1949 | | |
1879 | 1950 | | |
1880 | 1951 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3830 | 3830 | | |
3831 | 3831 | | |
3832 | 3832 | | |
| 3833 | + | |
| 3834 | + | |
| 3835 | + | |
| 3836 | + | |
| 3837 | + | |
| 3838 | + | |
| 3839 | + | |
3833 | 3840 | | |
| 3841 | + | |
3834 | 3842 | | |
3835 | 3843 | | |
3836 | 3844 | | |
| |||
0 commit comments