audit: tool_call_id replay, CoT dup guard, notepad/shell/sqlite/detok hardening (BUG-04/05/06/07/11/16, SEC-11)

This commit is contained in:
adm committed 2026-11-27 18:13:18 +01:00
1 parent b8e1a07e77
commit 09542e05a1
7 files changed
+276 -32

No files matched your search

+31 -4
View File
@@ -214,7 +214,9 @@ fn truncated_tool_falls_back_to_header_name() {
#[test]
fn thinking_only_at_length_surfaces_reasoning() {
// #6682: budget expires mid-thinking with no answer.
// #6682: budget expires mid-thinking with no answer. Thinking is streamed
// live by emit(), so finish() must NOT re-emit it: the whole CoT appears
// exactly once (BUG-06 — duplication was amplified by the 16384 budget).
let outs = run(
&[
(tag::MESSAGE_MODEL, true),
@@ -224,9 +226,34 @@ fn thinking_only_at_length_surfaces_reasoning() {
Some("length"),
);
assert!(content_of(&outs).is_empty());
// the live delta plus the finish-time accumulation both carry it (faithful
// to the reference: patched emit + _finish_typed #6682)
assert!(reasoning_of(&outs).contains("pondering"));
assert_eq!(
reasoning_of(&outs),
"pondering",
"thinking must appear exactly once, not duplicated at finish"
);
}
#[test]
fn quoted_end_message_in_think_end_streams_live() {
// #6675: two consecutive end-messages in thinking — the first is quoted text
// and must surface in reasoning live (mirrors TextEnd), not be lost.
let outs = run(
&[
(tag::MESSAGE_MODEL, true),
(tag::CONTENT_THINKING, true),
("x", false),
(tag::END_MESSAGE, true),
(tag::END_MESSAGE, true),
],
None,
);
let r = reasoning_of(&outs);
assert!(r.contains('x'), "{r}");
assert!(
r.contains(tag::END_MESSAGE),
"quoted tag must stream live: {r}"
);
assert!(content_of(&outs).is_empty());
}
#[test]