Skip to content

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

fix(profiles): restore recovery progress reporting

Steven Enamakel8cd3b0eac46f
diff --git a/crates/openhuman-core/src/core/runtime/bootstrap.rs b/crates/openhuman-core/src/core/runtime/bootstrap.rs
index 4603baefa2..a44c2e1b5d 100644
--- a/crates/openhuman-core/src/core/runtime/bootstrap.rs
+++ b/crates/openhuman-core/src/core/runtime/bootstrap.rs
@@ -126,9 +126,10 @@ pub(crate) async fn bootstrap_core_runtime(
// the finalizer never settled it. Stamp such rows `interrupted` so they stop
// rendering as perpetual "running" timeline entries on thread reopen.
if agent_enabled {
- if host_store.is_none() {
- match tinyagents_session::run_ledger::interrupt_orphaned_agent_runs(&cfg.workspace_dir)
- {
+ if !crate::storage::installed_is_shared() {
+ match crate::agent::session_store::with_ledger(&cfg.workspace_dir, |ledger| async move {
+ ledger.interrupt_orphaned_agent_runs().await
+ }) {
Ok(0) => {}
Ok(count) => {
log::info!("[runtime] settled {count} orphaned agent run(s) on startup")
diff --git a/crates/openhuman-core/src/profiles/recovery.rs b/crates/openhuman-core/src/profiles/recovery.rs
index dfc441d47f..fa4a2df5ad 100644
--- a/crates/openhuman-core/src/profiles/recovery.rs
+++ b/crates/openhuman-core/src/profiles/recovery.rs
@@ -23,7 +23,13 @@ pub(crate) fn recover_workspace(id: &ProfileId, workspace_dir: &std::path::Path)
Ok(turns) => log::info!("[profiles] profile={id} recovered {turns} interrupted turn(s)"),
Err(error) => log::warn!("[profiles] profile={id} turn recovery failed: {error}"),
}
- match tinyagents_session::run_ledger::interrupt_orphaned_agent_runs(workspace_dir) {
+ if crate::storage::installed_is_shared() {
+ // Another replica may still be driving a run in a shared backend.
+ return;
+ }
+ match crate::agent::session_store::with_ledger(workspace_dir, |ledger| async move {
+ ledger.interrupt_orphaned_agent_runs().await
+ }) {
Ok(0) => {}
Ok(runs) => log::info!("[profiles] profile={id} settled {runs} orphaned run(s)"),
Err(error) => log::warn!("[profiles] profile={id} run recovery failed: {error:#}"),
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge.rs b/crates/openhuman-core/src/web_chat/progress_bridge.rs
index ffefc831e5..c600ee48b7 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge.rs
@@ -169,9 +169,9 @@ pub(super) fn ledger_upsert_agent_run(
config: &crate::config::Config,
upsert: tinyagents_session::run_ledger::AgentRunUpsert,
) {
- if let Err(err) =
- tinyagents_session::run_ledger::upsert_agent_run(&config.workspace_dir, upsert)
- {
+ if let Err(err) = crate::agent::session_store::with_ledger(&config.workspace_dir, |ledger| async move {
+ ledger.upsert_agent_run(upsert).await
+ }) {
log::warn!("[run_ledger][web_channel] failed to upsert run: {err}");
}
}
@@ -180,8 +180,9 @@ pub(super) fn ledger_append_event(
config: &crate::config::Config,
event: tinyagents_session::run_ledger::RunEventAppend,
) {
- if let Err(err) = tinyagents_session::run_ledger::append_run_event(&config.workspace_dir, event)
- {
+ if let Err(err) = crate::agent::session_store::with_ledger(&config.workspace_dir, |ledger| async move {
+ ledger.append_run_event(event).await
+ }) {
log::warn!("[run_ledger][web_channel] failed to append event: {err}");
}
}
@@ -190,9 +191,9 @@ pub(super) fn ledger_upsert_telemetry(
config: &crate::config::Config,
telemetry: tinyagents_session::run_ledger::RunTelemetryUpsert,
) {
- if let Err(err) =
- tinyagents_session::run_ledger::upsert_run_telemetry(&config.workspace_dir, telemetry)
- {
+ if let Err(err) = crate::agent::session_store::with_ledger(&config.workspace_dir, |ledger| async move {
+ ledger.upsert_run_telemetry(telemetry).await
+ }) {
log::warn!("[run_ledger][web_channel] failed to upsert telemetry: {err}");
}
}
@@ -201,7 +202,10 @@ pub(super) fn ledger_get_telemetry(
config: &crate::config::Config,
run_id: &str,
) -> Option<tinyagents_session::run_ledger::RunTelemetry> {
- match tinyagents_session::run_ledger::get_agent_run(&config.workspace_dir, run_id) {
+ let id = run_id.to_string();
+ match crate::agent::session_store::with_ledger(&config.workspace_dir, |ledger| async move {
+ ledger.get_agent_run(&id).await
+ }) {
Ok(Some(run)) => {
let telemetry = run.telemetry;
log::debug!(