fix: prevent responseListeners memory leak in CoreMessenger (#11901)
Response listeners were only removed when data contained `"done": true`, but most message types (file events, autocomplete, nextEdit, etc.) return responses without a `done` field. This caused every fire-and-forget request to leak its callback lambda permanently in the map. Over a long session with heavy autocomplete and file navigation, this could accumulate hundreds of thousands of entries (40-100+ MB). Fix: invert the removal logic — remove the listener by default, and only keep it when `done == false` (i.e., a streaming response is still in progress). This preserves existing streaming behavior while ensuring all non-streaming responses are cleaned up immediately.
D
Dallin Romney committed
afb6b2111c81bc0aff5d4d8fdce17714cfb6cc6e
Parent: 581980e
Committed by GitHub <noreply@github.com>
on 3/26/2026, 9:59:09 PM