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

Function run_handle_only_cancels_current_run

core/src/run.rs:569–588  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

567
568 #[tokio::test]
569 async fn run_handle_only_cancels_current_run() {
570 let store = Arc::new(InMemoryRunStore::new());
571 let run = store.create_run("session-1", "fix tests").await;
572 let cancel_token = Arc::new(Mutex::new(Some(CancellationToken::new())));
573 let current_run_id = Arc::new(Mutex::new(Some(run.id.clone())));
574 let handle = RunHandle::new(
575 run.id.clone(),
576 run.session_id.clone(),
577 store.clone(),
578 cancel_token,
579 current_run_id.clone(),
580 None,
581 );
582
583 assert!(handle.cancel().await);
584 assert_eq!(handle.status().await, Some(RunStatus::Cancelled));
585
586 *current_run_id.lock().await = Some("other-run".to_string());
587 assert!(!handle.cancel().await);
588 }
589}

Callers

nothing calls this directly

Calls 2

create_runMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected