magi-code 0.61.0

Repository-aware CLI coding agent for terminal work
Documentation
use super::*;

#[test]
fn cancellation_before_start_skips_provider_request() {
    let provider = ScriptedProvider::new(vec![vec![done()]]);
    let agent = AgentSession::new("model", &[], &SkillDiscovery::default());
    let cancel = Arc::new(AtomicBool::new(true));

    let error = agent
        .run_print_with_tools_streaming_output_cancellable(
            &provider,
            AgentRunRequest {
                cancellation: AgentCancellation::new(cancel),
                ..run_request("say hi", Path::new("."))
            },
        )
        .unwrap_err();

    assert!(is_run_canceled(&error));
    assert!(provider.requests().is_empty());
}