Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Cap the size of the Supermaven states buffer (#19246)
Kevin Wang6c7e79eff606
diff --git a/crates/supermaven/src/supermaven.rs b/crates/supermaven/src/supermaven.rsindex 68a55504028..152a41c3be2 100644--- a/crates/supermaven/src/supermaven.rs+++ b/crates/supermaven/src/supermaven.rs@@ -147,6 +147,14 @@ impl Supermaven {updates_tx,},);+ // ensure the states map is max 1000 elements+ if agent.states.len() > 1000 {+ // state id is monotonic so it's sufficient to remove the first element+ agent+ .states+ .remove(&agent.states.keys().next().unwrap().clone());+ }+let _ = agent.outgoing_tx.unbounded_send(OutboundMessage::StateUpdate(StateUpdateMessage {