File tree Expand file tree Collapse file tree
lua/codecompanion/interactions/chat Expand file tree Collapse file tree Original file line number Diff line number Diff line change 310310
311311--- Handle completion
312312function ACPHandler :handle_completion ()
313+ -- Ignore completions from a stale handler (e.g. a late cancel ack after a new request started)
314+ if self .chat ._acp_handler ~= self then
315+ return
316+ end
317+
313318 if not self .chat .status or self .chat .status == " " then
314319 self .chat .status = " success"
315320 end
320325--- Handle errors
321326--- @param error string
322327function ACPHandler :handle_error (error )
328+ if self .chat ._acp_handler ~= self then
329+ return
330+ end
331+
323332 self .chat .status = " error"
324333 log :error (" [ACP::Handler] %s" , error )
325334
Original file line number Diff line number Diff line change @@ -1145,6 +1145,7 @@ end
11451145--- @return nil
11461146function Chat :_submit_acp (payload )
11471147 local acp_handler = require (" codecompanion.interactions.chat.acp.handler" ).new (self )
1148+ self ._acp_handler = acp_handler
11481149 self .current_request = acp_handler :submit (payload )
11491150end
11501151
You can’t perform that action at this time.
0 commit comments