From 84e70c0e73460e5db1297c47d02d9b76802bfdf7 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 18 Nov 2026 12:28:29 +0100 Subject: 0.9.1: correctness fixes from the audit - 64 MiB limit detected by file length, so pipelines and redirects are reported - bash temp files removed on every path via a scope guard - validate requires content/new as the schemas declare (present, may be empty) - Session::open folds in model-switch records; resume matches --list - combining mark at a wrap boundary no longer counts as a new row - --flag=value accepted; flag-shaped values rejected - dead code removed; last_reply folded into open (one read per resume) --- tests/tools.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests/tools.rs') diff --git a/tests/tools.rs b/tests/tools.rs index e54b5ff..4a8176e 100644 --- a/tests/tools.rs +++ b/tests/tools.rs @@ -490,3 +490,30 @@ fn bash_honours_a_per_call_output_budget() { assert!(text.contains("output truncated"), "{text}"); assert!(text.len() < 10_000, "output was {} bytes", text.len()); } + +#[test] +fn validate_requires_content_and_new_but_allows_empty() { + use agent686::tools::validate; + + // Missing, not empty. + assert!(validate("write", &json!({ "path": "a" })).is_err()); + assert!(validate("edit", &json!({ "path": "a", "old": "b" })).is_err()); + // Present but empty is legitimate (empty file, deletion). + assert!(validate("write", &json!({ "path": "a", "content": "" })).is_ok()); + assert!(validate("edit", &json!({ "path": "a", "old": "b", "new": "" })).is_ok()); +} + +#[test] +fn a_pipeline_that_exceeds_the_file_limit_is_reported() { + // 70 MiB through a pipeline: the grandchild (head) is the writer, so only the + // file-length check can detect the limit. + let text = run( + "bash", + &json!({ "cmd": "yes | head -c 70000000" }), + ) + .unwrap(); + assert!( + text.contains("output exceeded 64 MiB"), + "should report the file limit: {text}" + ); +} -- cgit v1.2.3