Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(session_host): preserve grounded close state across turn checkpoints

Steven Enamakel869781f97772
diff --git a/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs b/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs
index c14dc596e9..ea421b5538 100644
--- a/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs
+++ b/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs
@@ -12,13 +12,15 @@ use tinyagents_session::transcript::TranscriptMessage;
use tinyinference_llm::model::{ModelRequest, ModelStreamItem};
use tinytools_agent::dialect::ToolDialect;
+use tinyagents_harness::middleware::wrap_harness_instruction;
+
use crate::agent::{
message_convert::dialect_response_from_provider,
session_host::turn_checkpoint::{
self, build_deterministic_checkpoint, build_deterministic_final_summary,
close_repair_instruction, close_verification_prompt, final_answer_instruction,
parse_close_verdict, quotes_harness_instruction, render_tool_results,
- results_from_tool_outcomes, wrap_harness_instruction, CloseVerdict, CloseViolation,
+ results_from_tool_outcomes, CloseVerdict, CloseViolation,
},
tinyagents::{TinyagentsTurnOutcome, TurnModelSource},
};
diff --git a/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs b/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs
index aa9138fdd4..754a927074 100644
--- a/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs
+++ b/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs
@@ -320,7 +320,7 @@ will read."
/// It rides in as a bare user-role message, so a model that reads it as
/// operator content deliberates about it aloud and quotes it back. The closing
/// directives forbid the three shapes that reached a user's screen; the frame
-/// [`wrap_harness_instruction`] adds is what makes it structurally distinct
+/// [`wrap_harness_instruction`] (tinyagents-harness) adds is what makes it structurally distinct
/// from the conversation in the first place.
pub(crate) const FINAL_ANSWER_INSTRUCTION: &str = concat!(
"You have finished using tools for this turn but have not yet written a reply to the user. ",
@@ -349,15 +349,6 @@ The harness stopped this turn early because its tool calls stopped making progre
kept repeating the same step. Its stop note is written for you, not for the user, so explain it in your own \
words rather than repeating it, and describe each call as the tool records show it:";
-/// Frame a harness directive so the model can tell it from operator content,
-/// the way `<stop_note>` and `<tool_records>` already mark their spans.
-pub(crate) fn wrap_harness_instruction(instruction: &str) -> String {
- format!(
- "<harness_instruction>\n{}\n</harness_instruction>",
- instruction.trim()
- )
-}
-
/// Shortest span, in words, that counts as a quotation of harness text.
///
/// Long enough that the floor cannot be cleared by ordinary English — the