attempted fix of lag

This commit is contained in:
Ryan Ward
2026-08-20 08:52:36 -05:00
parent 87080c8086
commit 32d969ea4f
5 changed files with 100 additions and 0 deletions
@@ -1129,6 +1129,23 @@ impl BlocklistAIActionExecutor {
}
}
/// Removes all per-conversation retained state from sub-executors.
/// Called when a conversation is removed or cleared from memory.
pub fn cleanup_conversation(
&mut self,
conversation_id: AIConversationId,
ctx: &mut ModelContext<Self>,
) {
self.restored_action_ids
.retain(|(conv_id, _)| *conv_id != conversation_id);
self.async_executing_actions
.0
.retain(|(conv_id, _), _| *conv_id != conversation_id);
self.run_agents_executor.update(ctx, |executor, _| {
executor.cleanup_conversation(conversation_id);
});
}
fn should_autoexecute(&self, input: ExecuteActionInput, ctx: &mut ModelContext<Self>) -> bool {
if self
.restored_action_ids
@@ -155,6 +155,15 @@ impl RunAgentsExecutor {
self.terminal_view_id
}
/// Removes all per-conversation state for a conversation that has been removed.
pub(super) fn cleanup_conversation(&mut self, conversation_id: AIConversationId) {
self.launched_agents.remove(&conversation_id);
self.pending
.retain(|(conv_id, _), _| *conv_id != conversation_id);
self.recovery_action_ids
.retain(|(conv_id, _)| *conv_id != conversation_id);
}
/// Cancels the parent tool wait without cancelling independently-running children.
pub(super) fn cancel_execution(
&mut self,