summaryrefslogtreecommitdiffstats
path: root/tests/mock.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-15 18:00:12 +0100
committersalmonik <salmonik@tuta.io>2026-11-15 18:00:12 +0100
commit8ae5bd48cf233315b5f36a7a6b39002a5e77f74b (patch)
tree71c9b71f90f3cc64544dd506041468ee9bcbcda1 /tests/mock.rs
parent0.6.2: resizing no longer duplicates the prompt (diff)
downloadagent686-8ae5bd48cf233315b5f36a7a6b39002a5e77f74b.tar.gz
agent686-8ae5bd48cf233315b5f36a7a6b39002a5e77f74b.zip
0.7.0: resume shows where you left off; no approval for unparsable calls
- --continue prints the last answer, or the last reasoning block if there was none - tool arguments are validated before prompting, so an empty bash call becomes an error for the model instead of a blank approval - empty placeholder tool calls are dropped and reported - sessions tolerate invalid UTF-8 lines from a torn write - AGENT686_DEBUG_STREAM=1 dumps SSE frames
Diffstat (limited to '')
-rw-r--r--tests/mock.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/mock.rs b/tests/mock.rs
index 9b9a56d..7e076e3 100644
--- a/tests/mock.rs
+++ b/tests/mock.rs
@@ -442,3 +442,28 @@ fn a_final_frame_without_a_newline_is_not_lost() {
442 .expect("a trailing frame without a newline should still count"); 442 .expect("a trailing frame without a newline should still count");
443 assert_eq!(outcome.content, "last"); 443 assert_eq!(outcome.content, "last");
444} 444}
445
446#[test]
447fn an_empty_placeholder_tool_call_is_dropped() {
448 const SSE: &str = concat!(
449 "HTTP/1.1 200 OK\r\n",
450 "Content-Type: text/event-stream\r\n",
451 "Connection: close\r\n",
452 "\r\n",
453 "data: {\"choices\":[{\"delta\":{\"tool_calls\":[{\"index\":0,\"id\":\"call_1\",\"function\":{\"name\":\"read\",\"arguments\":\"{\\\"path\\\":\\\"a\\\"}\"}},{\"index\":1}]},\"finish_reason\":\"tool_calls\"}]}\n\n",
454 "data: [DONE]\n\n",
455 );
456 let (base, _rx) = serve_once(SSE);
457 let mut sink = Collector::default();
458 let outcome = provider::chat(
459 &config(base),
460 &[json!({ "role": "user", "content": "hi" })],
461 &[],
462 &AtomicBool::new(false),
463 &mut sink,
464 )
465 .expect("chat should succeed");
466
467 assert_eq!(outcome.tool_calls.len(), 1, "{:?}", outcome.tool_calls);
468 assert_eq!(outcome.tool_calls[0].name, "read");
469}