use super::*;
#[test]
fn orphan_repair_result_is_tagged_as_harness_authored() {
let llm_result = crate::stdlib::json_to_vm_value(&json!({
"provider": "local",
"model": "Qwen/Qwen3.6-35B-A3B",
"text": "",
"_agent_tool_format": "native",
"native_tool_calls": [{
"id": "call_9",
"name": "read",
"arguments": {"path": "main.rs"}
}],
}));
let assistant = assistant_message_from_llm_result(&llm_result);
let synthetic = synthesize_orphan_tool_results(
&assistant,
"the required files were never listed",
&std::collections::BTreeSet::new(),
);
assert_eq!(synthetic.len(), 1);
let msg = vm_to_json(&synthetic[0]);
assert_eq!(
msg["_harn"]["origin"], "harness_repair",
"the repair result must carry its authorship: {msg}"
);
assert_eq!(msg["name"], "read");
assert_eq!(msg["tool_call_id"], "call_9");
assert_eq!(msg["content"], "the required files were never listed");
}
#[test]
fn a_dispatched_tool_result_carries_no_origin_tag() {
let msg = vm_to_json(&tool_result_message(ToolResultMessageInput {
channel: crate::llm_config::ToolFormatChannel::Native,
name: "read",
tool_call_id: "call_9",
observation: "file contents",
ok: true,
screenshots: &[],
data: None,
origin: ToolResultOrigin::Dispatch,
}));
assert_eq!(msg["_harn"]["kind"], "tool_result");
assert!(
msg["_harn"].get("origin").is_none(),
"a dispatched result must be byte-identical to before: {msg}"
);
}