Repository navigation
Commit d03dfad
committed
fix(webview): stop flushing throttled state for partial say messages
`addToClineMessages` called `flushPostStateToWebviewThrottled()` for every
message with `partial === true`. With lodash debounce configured
`{ leading: true, trailing: true }`, a flush issued right after a leading-edge
invocation has no pending trailing invocation to run, so it only cancels the
trailing timer. The next call then hits the leading edge again and posts
immediately, so the debounce never coalesced anything on the streaming path.
Measured against lodash.debounce 4.0.8 with the provider's own settings
(500ms wait, 1000ms maxWait), 20 messages arriving 100ms apart produced:
with the interleaved flush: 20 full-state posts
without it: 3 full-state posts
Because `requiresImmediateState` matched every partial first chunk, throttling
was effectively inert for tool-heavy tasks and the gray-screen OOM that #1078
set out to fix remained reproducible at high message counts.
Drop `partial` from the condition. Partial `say` messages are safe on the
throttled path: the trailing/maxWait post carries the message's current text,
so a `messageUpdated` dropped for a `ts` the webview does not know yet is
superseded rather than lost. Partial asks are unaffected — `Task#ask` adds them
without `isAnswered`, so they keep flushing through the ask clause and retain
the ordering guarantee unanswered asks depend on.
The existing suite could not catch this: every Task-level test mocks the
provider, so it asserted that flush was *called* rather than that state posts
were actually coalesced. Retarget the partial-message test at the new contract
and add a characterization test in ClineProvider.spec.ts that pins the
debounce semantics against the real timer.1 parent 0b2b228 commit d03dfad
3 files changed
Lines changed: 48 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1149 | 1149 | | |
1150 | 1150 | | |
1151 | 1151 | | |
1152 | | - | |
1153 | | - | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1154 | 1165 | | |
1155 | 1166 | | |
1156 | 1167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2050 | 2050 | | |
2051 | 2051 | | |
2052 | 2052 | | |
2053 | | - | |
| 2053 | + | |
2054 | 2054 | | |
2055 | 2055 | | |
2056 | 2056 | | |
| |||
2059 | 2059 | | |
2060 | 2060 | | |
2061 | 2061 | | |
2062 | | - | |
2063 | | - | |
2064 | | - | |
2065 | | - | |
2066 | | - | |
2067 | 2062 | | |
2068 | 2063 | | |
2069 | 2064 | | |
| |||
2072 | 2067 | | |
2073 | 2068 | | |
2074 | 2069 | | |
2075 | | - | |
2076 | | - | |
2077 | | - | |
2078 | | - | |
2079 | | - | |
2080 | 2070 | | |
2081 | | - | |
2082 | | - | |
2083 | | - | |
2084 | | - | |
2085 | | - | |
2086 | | - | |
2087 | | - | |
2088 | | - | |
| 2071 | + | |
| 2072 | + | |
2089 | 2073 | | |
2090 | | - | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
2091 | 2079 | | |
2092 | 2080 | | |
2093 | 2081 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1016 | 1016 | | |
1017 | 1017 | | |
1018 | 1018 | | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
1019 | 1046 | | |
1020 | 1047 | | |
1021 | 1048 | | |
| |||
0 commit comments