Commit 95bfca1
authored
🤖 fix: stop compaction state leaking into continue streams (#2894)
## Summary
Fix the streaming indicator so the follow-up continue turn after
compaction is treated as a normal stream instead of incorrectly showing
the compacting state.
## Background
The browser-side stream aggregator was inferring `isCompacting` from the
latest `/compact` user message whenever `stream-start.mode` was not
explicitly `compact`. That fallback predates this PR (introduced in
`ba125e654ae` / retained in `0b947aa6aa`), and it let the continue
stream inherit stale compaction state even though the backend already
emits the authoritative `stream-start.agentId` (`compact` for
compaction, normal agent IDs for follow-up turns).
The bug showed up recently because the newer activity-snapshot/catch-up
path from `ba2b7b32911` can keep stale aggregator state visible for
longer, but the root cause was the older compaction inference fallback.
## Implementation
- prefer `stream-start.agentId == "compact"` as the primary compaction
signal in `StreamingMessageAggregator.handleStreamStart`
- only consult historical `/compact` request metadata for legacy
stream-start events that do not include `agentId`
- stop reusing an older compaction request once a compaction boundary
summary has already landed
- add regression coverage for both modern and legacy continue-stream
cases
## Validation
- `bun test
src/browser/utils/messages/StreamingMessageAggregator.test.ts`
- `make static-check`
## Risks
Low. The change is narrowly scoped to compaction stream classification
in the browser aggregator and preserves the existing fallback for older
replayed stream-start events.
---
_Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` •
Cost: `unknown`_
<!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=unknown
-->1 parent c4f3841 commit 95bfca1
File tree
2 files changed
+109
-14
lines changed- src/browser/utils/messages
2 files changed
+109
-14
lines changedLines changed: 77 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1831 | 1831 | | |
1832 | 1832 | | |
1833 | 1833 | | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 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 | + | |
1834 | 1911 | | |
1835 | 1912 | | |
1836 | 1913 | | |
| |||
Lines changed: 32 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1115 | 1115 | | |
1116 | 1116 | | |
1117 | 1117 | | |
1118 | | - | |
1119 | | - | |
1120 | | - | |
1121 | | - | |
1122 | | - | |
| 1118 | + | |
| 1119 | + | |
1123 | 1120 | | |
1124 | 1121 | | |
1125 | 1122 | | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
1126 | 1129 | | |
1127 | 1130 | | |
1128 | 1131 | | |
1129 | | - | |
| 1132 | + | |
1130 | 1133 | | |
1131 | 1134 | | |
1132 | 1135 | | |
1133 | 1136 | | |
1134 | 1137 | | |
1135 | 1138 | | |
1136 | 1139 | | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
1137 | 1162 | | |
1138 | 1163 | | |
1139 | 1164 | | |
| |||
1454 | 1479 | | |
1455 | 1480 | | |
1456 | 1481 | | |
1457 | | - | |
1458 | | - | |
1459 | | - | |
1460 | | - | |
1461 | | - | |
1462 | | - | |
1463 | | - | |
1464 | | - | |
| 1482 | + | |
1465 | 1483 | | |
1466 | 1484 | | |
1467 | 1485 | | |
| |||
0 commit comments