MCPcopy Create free account
hub / github.com/AI45Lab/Code / cancel

Method cancel

core/src/agent_api/run_lifecycle.rs:96–114  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

94 }
95
96 pub(super) async fn cancel(&self) -> bool {
97 let token = self.cancel_token.lock().await.clone();
98 if let Some(token) = token {
99 token.cancel();
100 if let Some(run_id) = self.current_run_id.lock().await.clone() {
101 let _ = self.run_store.mark_cancelled(&run_id).await;
102 if let Some(executor) = &self.hook_executor {
103 executor
104 .record_run_cancelled(&run_id, &self.session_id, Some("cancelled by host"))
105 .await;
106 }
107 }
108 tracing::info!(session_id = %self.session_id, "Cancelled ongoing operation");
109 true
110 } else {
111 tracing::debug!(session_id = %self.session_id, "No ongoing operation to cancel");
112 false
113 }
114 }
115
116 pub(super) async fn cancel_run(&self, run_id: &str) -> bool {
117 match self.current_run().await {

Calls 3

mark_cancelledMethod · 0.80
cloneMethod · 0.45
record_run_cancelledMethod · 0.45