The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix: correct turn checkpoint handling for grounded close tests
Steven Enamakel1efdad3074f4
diff --git a/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs b/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rsindex f935fd1ea6..5bb02d7d15 100644--- a/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs@@ -24,6 +24,7 @@ fn classified_halt_returns_partial_work_without_provider_usage() {early_exit_tool: None,hit_cap: false,wrap_up_injected: false,+ truncated: false,breaker_halt: Some("Stopping after 1 attempt(s): failure class `permission` still blocks operation `search` on `catalog`. Resolve this blocker before retrying.".into()),tool_outcomes: vec![ToolCallOutcome { call_id: "a".into(), name: "list".into(), arguments: serde_json::json!({}), success: true, content: "three items".into(), duration_ms: 1 },@@ -53,7 +54,7 @@ fn leaking_reply() -> String {/// returning the shipped message, the prompts each attempt was given, the/// candidates that reached the verifier, and the usage recorded.async fn run(candidates: Vec<String>, verdicts: Vec<Option<CloseViolation>>) -> Shipped {- let instruction = final_answer_instruction(None, RECORDS);+ let instruction = final_answer_instruction(None, false, RECORDS);let prompts = RefCell::new(Vec::<String>::new());let verified = RefCell::new(Vec::<String>::new());let remaining = RefCell::new(candidates);diff --git a/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs b/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rsindex 9b0d18412e..38c981d783 100644--- a/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs+++ b/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs@@ -419,7 +419,11 @@ pub(crate) fn close_repair_instruction(instruction: &str, violation: CloseViolat/// The stop note is passed as input, not as text to repeat. The breaker words it/// for a model ("Report this back instead of retrying"), which is right for a/// sub-agent's parent and wrong on a user's screen.-pub(crate) fn final_answer_instruction(stop_reason: Option<&str>, records: &str) -> String {+pub(crate) fn final_answer_instruction(+ stop_reason: Option<&str>,+ _truncated: bool,+ records: &str,+) -> String {let mut directive = String::new();if let Some(reason) = stop_reason {directive.push_str(STOP_NOTE_PREAMBLE);diff --git a/crates/openhuman-core/src/agent/session_host/turn_checkpoint_tests.rs b/crates/openhuman-core/src/agent/session_host/turn_checkpoint_tests.rsindex 579f966446..e790696948 100644--- a/crates/openhuman-core/src/agent/session_host/turn_checkpoint_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/turn_checkpoint_tests.rs@@ -234,12 +234,12 @@ fn the_final_answer_instruction_carries_the_records_and_the_stop_note() {1_000,);- let plain = final_answer_instruction(None, &records);+ let plain = final_answer_instruction(None, false, &records);assert!(plain.contains("<tool_records>") && plain.contains(" > no direct download"));assert!(!plain.contains("<stop_note>"));assert!(plain.contains("do not describe steps you are about to take"));- let halted = final_answer_instruction(Some(STOP_NOTE), &records);+ let halted = final_answer_instruction(Some(STOP_NOTE), false, &records);assert!(halted.contains(&format!("<stop_note>\n{STOP_NOTE}\n</stop_note>")));assert!(halted.contains(" > no direct download"));}@@ -277,7 +277,7 @@ fn the_close_verification_prompt_holds_request_records_and_reply() {/// is grounded in, and names the three shapes that reached a user's screen.#[test]fn the_final_answer_instruction_is_framed_and_forbids_quoting_tools_and_deliberation() {- let out = final_answer_instruction(None, "\n- `read_file` — ok\n > config found\n");+ let out = final_answer_instruction(None, false, "\n- `read_file` — ok\n > config found\n");let frame_end = out.find("</harness_instruction>")@@ -423,7 +423,7 @@ fn the_close_verification_prompt_rejects_deliberation_and_recited_toolsets() {/// carries the original instruction so the retry still has the records.#[test]fn the_repair_re_ask_names_the_violation_and_repeats_the_instruction() {- let instruction = final_answer_instruction(None, "\n- `read_file` — ok\n > config found\n");+ let instruction = final_answer_instruction(None, false, "\n- `read_file` — ok\n > config found\n");let quoted = close_repair_instruction(&instruction, CloseViolation::QuotedHarnessText);assert!(quoted.contains("repeated these directions"), "{quoted}");diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_outcome.rs b/crates/openhuman-core/src/agent/tinyagents/turn_outcome.rsindex e1429f94c3..b8e0e3f576 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_outcome.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_outcome.rs@@ -65,6 +65,13 @@ pub(crate) struct TinyagentsTurnOutcome {/// `text` already carries this same summary; the flag lets the status mapper/// distinguish a breaker halt from a genuine final answer.pub breaker_halt: Option<String>,+ /// `true` when the run ended on a reply that ran out of output tokens+ /// (`finish_reason = length`) with no visible text and no tool call — the+ /// model spent its whole output budget reasoning, even after the harness's+ /// truncated-empty retries and nudge (#6951). `text` is then blank, and+ /// the closing call must say the budget ran out rather than claim the+ /// model finished using tools.+ pub truncated: bool,/// Per-tool-call execution outcomes (success + raw result content), keyed by/// provider call id, captured at the tool boundary. The harness folds a tool/// result into a `Message::tool` that drops its `error` flag, so this is thediff --git a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rsindex b042969e2b..5243d7458c 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs@@ -286,6 +286,7 @@ pub(super) async fn finalize_turn_outcome(hit_cap,wrap_up_injected,breaker_halt,+ truncated: false,tool_outcomes,}}