Skip to content

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

fix(agent): remove v1 memory and citation logic from session host

Steven Enamakeleba656e5453b
diff --git a/crates/openhuman-core/src/agent/context/channels_prompt.rs b/crates/openhuman-core/src/agent/context/channels_prompt.rs
index 759facfbb4..d296316cbe 100644
--- a/crates/openhuman-core/src/agent/context/channels_prompt.rs
+++ b/crates/openhuman-core/src/agent/context/channels_prompt.rs
@@ -86,7 +86,6 @@ fn load_openclaw_bootstrap_files(
None => inject_workspace_file(prompt, workspace_dir, "SOUL.md", max_chars_per_file),
}
inject_workspace_file(prompt, workspace_dir, "IDENTITY.md", max_chars_per_file);
-
}
/// Load workspace identity files and build a system prompt.
diff --git a/crates/openhuman-core/src/agent/context/channels_prompt_tests.rs b/crates/openhuman-core/src/agent/context/channels_prompt_tests.rs
index 8c2510bc74..dd6b2d15a1 100644
--- a/crates/openhuman-core/src/agent/context/channels_prompt_tests.rs
+++ b/crates/openhuman-core/src/agent/context/channels_prompt_tests.rs
@@ -122,11 +122,12 @@ fn identity_workspace() -> tempfile::TempDir {
.unwrap();
std::fs::write(tmp.path().join("IDENTITY.md"), "Name: OpenHuman").unwrap();
std::fs::write(tmp.path().join("MEMORY.md"), "shared root memory marker").unwrap();
+ std::fs::write(tmp.path().join("PROFILE.md"), "root profile marker").unwrap();
tmp
}
#[test]
-fn identity_override_replaces_root_soul_and_memory() {
+fn identity_override_replaces_root_soul() {
let tmp = identity_workspace();
let prompt = build_system_prompt_with_identity(
tmp.path(),
@@ -137,7 +138,6 @@ fn identity_override_replaces_root_soul_and_memory() {
Some("Discord"),
PromptIdentityOverride {
soul_md: Some("I am Alice, a meticulous archivist."),
- memory_md: Some("alice private memory marker"),
},
ProjectContextPlacement::Inline,
);
@@ -152,36 +152,12 @@ fn identity_override_replaces_root_soul_and_memory() {
prompt.contains("Name: OpenHuman"),
"IDENTITY.md is not overridable and stays the root file"
);
- assert!(prompt.contains("### MEMORY.md"));
- assert!(prompt.contains("alice private memory marker"));
assert!(
- !prompt.contains("shared root memory marker"),
- "profile MEMORY.md must replace the root one"
+ !prompt.contains("shared root memory marker") && !prompt.contains("root profile marker"),
+ "v1 MEMORY.md / PROFILE.md files are never injected"
);
}
-#[test]
-fn memory_override_renders_even_when_root_memory_is_absent() {
- let tmp = tempdir().unwrap();
- std::fs::write(tmp.path().join("SOUL.md"), "root soul").unwrap();
- let prompt = build_system_prompt_with_identity(
- tmp.path(),
- "model",
- &[],
- &[],
- None,
- None,
- PromptIdentityOverride {
- soul_md: None,
- memory_md: Some("profile-only memory"),
- },
- ProjectContextPlacement::Inline,
- );
- assert!(prompt.contains("root soul"), "no soul override → root soul");
- assert!(prompt.contains("### MEMORY.md"));
- assert!(prompt.contains("profile-only memory"));
-}
-
#[test]
fn empty_identity_override_matches_root_render_byte_for_byte() {
let tmp = identity_workspace();
@@ -208,7 +184,6 @@ fn omitted_placement_leaves_the_project_context_to_the_caller() {
let tmp = identity_workspace();
let identity = PromptIdentityOverride {
soul_md: Some("I am Alice, a meticulous archivist."),
- memory_md: None,
};
let mut prompt = build_system_prompt_with_identity(
tmp.path(),
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
index 188782b059..3a92d44f39 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -1162,7 +1162,7 @@ impl OpenHumanSessionHost {
workflows: self.workflows.clone(),
composio_events: None,
skill_events: None,
- pending_user_autosave: None,
+ pending_user_text: None,
})),
});
}
@@ -1208,9 +1208,8 @@ impl OpenHumanSessionHost {
"OpenHumanTurnPrelude",
)
})?;
- prelude
- .refresh_turn_boundary(!view.resumed && view.history.is_empty())
- .await;
+ let new_session = !view.resumed && view.history.is_empty();
+ prelude.refresh_turn_boundary(new_session).await;
let context_window = prelude
.turn_model_source
.effective_context_window(&prelude.model_name)
@@ -1224,12 +1223,7 @@ impl OpenHumanSessionHost {
.unwrap_or_else(std::sync::PoisonError::into_inner)
.context_window = context_window;
let original_user_message = user_text_with_markers(&request.input);
- prelude.begin_user_effects(
- &mut state
- .lock()
- .unwrap_or_else(|poisoned| poisoned.into_inner()),
- request,
- );
+ prelude.begin_user_effects(request);
let overrides = std::mem::take(
&mut state
.lock()
@@ -1241,11 +1235,12 @@ impl OpenHumanSessionHost {
&original_user_message,
&overrides,
&mut options.run_context.data,
+ new_session,
)
.await;
request.input = user_message_from_text(&enriched);
let mut preparation = prelude
- .prepare(!view.resumed && view.history.is_empty())
+ .prepare(new_session)
.await
.map_err(|error| {
tinyagents_runtime::RuntimeError::Driver(error.to_string())
@@ -1378,11 +1373,6 @@ impl OpenHumanSessionHost {
.unwrap_or_else(|poisoned| poisoned.into_inner())
.prelude
.clone();
- let citations = state
- .lock()
- .unwrap_or_else(|poisoned| poisoned.into_inner())
- .pending_citations
- .take();
if let Some(prelude) = prelude {
prelude.finalize_after_durable_commit(&receipt).await;
account_committed_turn_against_goal(
@@ -1392,14 +1382,6 @@ impl OpenHumanSessionHost {
)
.await;
}
- // Citations are display-only, but their result belongs
- // to this committed turn. Join only after durability so
- // a failed/cancelled candidate never becomes the UI's
- // "last turn" citation set.
- let citations = match citations {
- Some(task) => task.await.unwrap_or_default(),
- None => Vec::new(),
- };
let _ =
progress::send_receipt_progress(&receipt, &input, &output, iterations)
.await;
@@ -1413,7 +1395,6 @@ impl OpenHumanSessionHost {
.unwrap_or_else(|poisoned| poisoned.into_inner());
state.last_turn_hit_cap = interrupted;
state.last_turn_usage = Some(usage);
- state.last_turn_citations = citations;
}
crate::agent::hooks::fire_hooks(
&post_turn_hooks,