From 991925227b62dd8dd447b40c9efd59bd0a830754 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 10:07:24 -0800 Subject: [PATCH] Tests: a headless agent session without folders also refuses a save The test for a headless agent session with no usable agent folder now also saves to a path outside the agent folders, checks that the error names the missing write authority, and checks that no file was written. --- crates/mcp/src/tests/agents.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/mcp/src/tests/agents.rs b/crates/mcp/src/tests/agents.rs index 5a9c7a774e..0453cd552f 100644 --- a/crates/mcp/src/tests/agents.rs +++ b/crates/mcp/src/tests/agents.rs @@ -165,6 +165,10 @@ fn a_headless_agent_session_without_usable_folders_reads_and_writes_nothing() { std::fs::write(&outside, r#""#).unwrap(); let e = b.call("app.open", json!({"path": outside.to_string_lossy()})).unwrap_err(); assert!(e.contains("read authority is absent"), "{e}"); + let saved = dir.file("saved.svg"); + let e = b.call("app.save", json!({"path": saved.to_string_lossy()})).unwrap_err(); + assert!(e.contains("write authority is absent"), "{e}"); + assert!(!saved.exists(), "the refused save must not write the file"); // With Allow Agent Control off, the session is the ordinary headless fallback, as before. fn control_off(dir: &Path) -> AgentSettings {