Skip to content

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

fix(agent): restore delegation journal entry on agent handoff

Steven Enamakelf55aca5f17d1
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/delegation.rs b/crates/openhuman-core/src/agent/tinyagents/host/delegation.rs
index 2c22d08910..8246102692 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/delegation.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/delegation.rs
@@ -68,60 +68,6 @@ fn with_tracing_sink(mut config: DelegationConfig) -> DelegationConfig {
config
}
-/// Run the plan→execute⇄review→finalize delegation graph, invoking `run_stage`
-/// for each stage. Returns the final [`DelegationState`].
-///
-/// See [`tinyagents_graph::delegation::run_delegation`].
-#[allow(dead_code)]
-pub(crate) async fn run_with_tracing<F, Fut>(
- config: DelegationConfig,
- run_stage: F,
-) -> Result<DelegationState, String>
-where
- F: Fn(DelegationStage, DelegationState) -> Fut + Clone + Send + Sync + 'static,
- Fut: Future<Output = Result<DelegationStageOutput, String>> + Send + 'static,
-{
- tinyagents_graph::delegation::run_delegation(with_tracing_sink(config), run_stage).await
-}
-
-/// Run the delegation graph and report whether it finalized or parked on a
-/// durable human-approval interrupt.
-///
-/// See [`tinyagents_graph::delegation::run_delegation_durable`].
-#[allow(dead_code)]
-pub(crate) async fn run_durable_with_tracing<F, Fut>(
- config: DelegationConfig,
- run_stage: F,
-) -> Result<DelegationOutcome, String>
-where
- F: Fn(DelegationStage, DelegationState) -> Fut + Clone + Send + Sync + 'static,
- Fut: Future<Output = Result<DelegationStageOutput, String>> + Send + 'static,
-{
- tinyagents_graph::delegation::run_delegation_durable(with_tracing_sink(config), run_stage).await
-}
-
-/// Resume a delegation graph parked on a durable human-approval interrupt,
-/// delivering the approver's `decision`.
-///
-/// `decision` accepts the approval RPC's stable wire values (`approve_once` /
-/// `approve_always_for_tool` / `deny`), so the existing decision contract routes
-/// into the resume unchanged. TTL expiry → pass [`deny_decision`].
-///
-/// See [`tinyagents_graph::delegation::resume_delegation`].
-#[allow(dead_code)]
-pub(crate) async fn resume_with_tracing<F, Fut>(
- config: DelegationConfig,
- decision: Value,
- run_stage: F,
-) -> Result<DelegationOutcome, String>
-where
- F: Fn(DelegationStage, DelegationState) -> Fut + Clone + Send + Sync + 'static,
- Fut: Future<Output = Result<DelegationStageOutput, String>> + Send + 'static,
-{
- tinyagents_graph::delegation::resume_delegation(with_tracing_sink(config), decision, run_stage)
- .await
-}
-
/// Run the delegation graph, resuming from the last checkpoint boundary when the
/// configured thread has a live, compatible, non-terminal checkpoint, else
/// starting fresh.
diff --git a/crates/openhuman-core/src/agent/tinyagents/journal.rs b/crates/openhuman-core/src/agent/tinyagents/journal.rs
index a299ef481e..327570a75a 100644
--- a/crates/openhuman-core/src/agent/tinyagents/journal.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/journal.rs
@@ -37,8 +37,8 @@
//!
//! ## Follow-ups (not in this slice)
//!
-//! - A replay RPC (`agent.run_events`?) that surfaces [`read_run_events`] /
-//! [`read_run_status`] to the desktop for mid-run reconnect (05.x).
+//! - A replay RPC (`agent.run_events`?) that surfaces [`read_run_events`] to
+//! the desktop for mid-run reconnect (05.x).
//! - Full sub-agent / graph run lineage (`parent_run_id` / `root_run_id`
//! threading) — wired in 05.2/05.3. This slice threads `thread_id` (from the
//! sub-agent task scope) so [`FileStatusStore::list_by_thread`] answers.
@@ -274,14 +274,6 @@ pub(crate) struct TurnJournal {
}
impl TurnJournal {
- /// The durable run id — the journal stream key + status key a future replay
- /// RPC reads back via [`read_run_events`] / [`read_run_status`].
- // Part of the replay seam surfaced to the (follow-up) replay RPC.
- #[allow(dead_code)]
- pub(crate) fn run_id(&self) -> String {
- self.run_id.as_str().to_string()
- }
-
/// Best-effort terminal write: mark the run completed and persist. Non-fatal.
pub(crate) async fn finish_completed(&self) {
self.event_sink.flush();
@@ -405,9 +397,6 @@ pub(crate) async fn attach_turn_journal(
/// reconnect mid-run and backfill the timeline from durable state instead of
/// relying on transient `AgentProgress` buffering. Best-effort: a missing store
/// or unknown run yields an empty `Vec`, not an error.
-// Replay-RPC seam (05.x): no in-tree caller yet — the persisted journal is
-// provably replayable through this reader.
-#[allow(dead_code)]
pub(crate) async fn read_run_events(
run_id: &str,
from_offset: u64,
@@ -421,20 +410,6 @@ pub(crate) async fn read_run_events(
.map_err(|e| anyhow::anyhow!("[journal] read_run_events failed run_id={run_id}: {e}"))
}
-/// Late-attach replay reader: the latest durable [`HarnessRunStatus`] for
-/// `run_id`, or `None` if unknown. Companion to [`read_run_events`] for the
-/// future replay RPC.
-#[allow(dead_code)]
-pub(crate) async fn read_run_status(run_id: &str) -> anyhow::Result<Option<HarnessRunStatus>> {
- let workspace = resolve_workspace().await?;
- let stores = open_session_stores(&workspace);
- let status = FileStatusStore::new(stores.kv);
- status
- .get_status(run_id)
- .await
- .map_err(|e| anyhow::anyhow!("[journal] read_run_status failed run_id={run_id}: {e}"))
-}
-
#[cfg(test)]
#[path = "journal_tests.rs"]
mod tests;