Skip to content

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

fix(goals): populate goal value and emit event on clear

Steven Enamakeld34da455ff30
diff --git a/crates/openhuman-core/src/agent/goals/runtime.rs b/crates/openhuman-core/src/agent/goals/runtime.rs
index a16151d365..a9b92ec97b 100644
--- a/crates/openhuman-core/src/agent/goals/runtime.rs
+++ b/crates/openhuman-core/src/agent/goals/runtime.rs
@@ -111,7 +111,7 @@ pub async fn complete_for_thread(workspace_dir: &Path, thread_id: Option<&str>)
thread_id: goal.thread_id.clone(),
goal_id: goal.goal_id.clone(),
status: goal.status.as_str().to_string(),
- goal: None,
+ goal: Some(super::goal_to_value(&goal)),
});
}
}
@@ -133,7 +133,13 @@ pub async fn clear_for_thread(workspace_dir: &Path, thread_id: Option<&str>) {
return;
};
match store::clear(workspace_dir, &thread_id).await {
- Ok(_existed) => {}
+ Ok(existed) => {
+ if existed {
+ BUS.publish(DomainEvent::ThreadGoalCleared {
+ thread_id: thread_id.clone(),
+ });
+ }
+ }
Err(e) => {
tracing::debug!(thread_id = %thread_id, error = %e, "[thread_goals] clear_for_thread failed");
}